learning objectives prompt A fiddling
Browse files- app/ui/prompts_tab.py +1 -1
- app/ui/test_set_tab.py +1 -1
- config/system_prompt_texts.py +99 -1
- config/templates.py +6 -39
app/ui/prompts_tab.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
def build_prompts_tab():
|
| 4 |
-
with gr.TabItem("🗒🚧️ See Prompts"):
|
| 5 |
gr.HTML(
|
| 6 |
"""
|
| 7 |
<div style="margin-bottom: 10px;">
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
def build_prompts_tab():
|
| 4 |
+
with gr.TabItem("🗒🚧️ See Prompts", visible=False):
|
| 5 |
gr.HTML(
|
| 6 |
"""
|
| 7 |
<div style="margin-bottom: 10px;">
|
app/ui/test_set_tab.py
CHANGED
|
@@ -15,7 +15,7 @@ def build_test_set_tab():
|
|
| 15 |
with gr.Row():
|
| 16 |
with gr.Column(scale=1):
|
| 17 |
subset_choice = gr.Dropdown(
|
| 18 |
-
choices=["Exercises ❔🚧", "Study Texts ️ℹ️🚧", "Show all
|
| 19 |
value="Show all ❔ℹ️",
|
| 20 |
label="Subset Filter 🚧"
|
| 21 |
)
|
|
|
|
| 15 |
with gr.Row():
|
| 16 |
with gr.Column(scale=1):
|
| 17 |
subset_choice = gr.Dropdown(
|
| 18 |
+
choices=["Exercises ❔🚧", "Study Texts ️ℹ️🚧", "Learning Objectives 🧠🚧", "Show all"],
|
| 19 |
value="Show all ❔ℹ️",
|
| 20 |
label="Subset Filter 🚧"
|
| 21 |
)
|
config/system_prompt_texts.py
CHANGED
|
@@ -230,9 +230,107 @@ template_distractors_brainstorm_2_text = """
|
|
| 230 |
template_consolidate_distractors_text = """
|
| 231 |
"""
|
| 232 |
|
| 233 |
-
template_gen_prompt_a_text = """
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 234 |
"""
|
| 235 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 236 |
template_gen_prompt_b_text = """
|
| 237 |
"""
|
| 238 |
|
|
|
|
| 230 |
template_consolidate_distractors_text = """
|
| 231 |
"""
|
| 232 |
|
| 233 |
+
template_gen_prompt_a_text = """
|
| 234 |
+
# Learning Objective Extraction Task
|
| 235 |
+
|
| 236 |
+
Your task is to analyze a study text and extract high-quality learning objectives that will later serve as the basis for multiple-choice questions. Each learning objective must perfectly adhere to all specified requirements.
|
| 237 |
+
|
| 238 |
+
## Analysis Approach
|
| 239 |
+
Before extracting learning objectives:
|
| 240 |
+
* Carefully analyze the text's language level and target audience
|
| 241 |
+
* Note the terminology, voice (active/passive), and perspective (2nd/3rd person)
|
| 242 |
+
* Pay attention to the complexity of vocabulary and sentence structures used
|
| 243 |
+
|
| 244 |
+
## Core Requirements for Learning Objectives
|
| 245 |
+
|
| 246 |
+
### Format and Language
|
| 247 |
+
* Begin with "- The student knows that" (or equivalent in the text's language)
|
| 248 |
+
* Mirror the source text's:
|
| 249 |
+
- Language level and vocabulary
|
| 250 |
+
- Terminology and jargon
|
| 251 |
+
- Voice (active/passive)
|
| 252 |
+
- Perspective (2nd/3rd person)
|
| 253 |
+
|
| 254 |
+
### Content Quality
|
| 255 |
+
* **Falsifiable**: Must be unambiguously, demonstrably true or false
|
| 256 |
+
* **Factually Equivalent**: Represent exactly the knowledge as written
|
| 257 |
+
* **Specific**: Express the smallest coherent, testable knowledge unit, instead of several things at once
|
| 258 |
+
|
| 259 |
+
<examples>
|
| 260 |
+
<specificity_example>
|
| 261 |
+
<too_broad>- De student weet dat het hart uit vier holtes bestaat: twee boezems aan de bovenkant en twee kamers aan de onderkant.</too_broad>
|
| 262 |
+
<explanation>Combines multiple knowledge elements that could be tested separately</explanation>
|
| 263 |
+
<better>
|
| 264 |
+
- De student weet dat het hart uit vier holtes bestaat.
|
| 265 |
+
- De student weet dat het hart uit twee boezems en twee kamers bestaat.
|
| 266 |
+
- De student weet dat de boezems van het hart aan de bovenkant zitten.
|
| 267 |
+
- De student weet dat de kamers van het hart aan de onderkant zitten.
|
| 268 |
+
</better>
|
| 269 |
+
<explanation>Focuses on each specific, testable knowledge element individually</explanation>
|
| 270 |
+
</specificity_example>
|
| 271 |
+
</examples>
|
| 272 |
+
|
| 273 |
+
### Language Precision
|
| 274 |
+
* Avoid universal terms ("always", "never") unless 100% accurate, and there are in fact no exceptions
|
| 275 |
+
* Avoid vague modifiers ("can", "could", "might", "may"), because those make meaningless statements
|
| 276 |
+
* Replace subjective terms ("often", "sometimes", "many", "few") with specific comparisons
|
| 277 |
+
* Use "important" only when there is no other option to say something more meaningful ("X is important" doesn't say much)
|
| 278 |
+
|
| 279 |
+
## Quality Assurance Process
|
| 280 |
+
1. Extract all potential learning objectives
|
| 281 |
+
2. For each objective, verify it meets ALL requirements
|
| 282 |
+
3. Refine and potentially split objectives until each one is:
|
| 283 |
+
- Maximally specific
|
| 284 |
+
- Perfectly aligned with source text, mirroring difficulty level and terminology
|
| 285 |
+
- Completely falsifiable
|
| 286 |
+
- Properly phrased
|
| 287 |
+
4. Return final list in the same language as the source text
|
| 288 |
"""
|
| 289 |
|
| 290 |
+
|
| 291 |
+
"""
|
| 292 |
+
<examples_of_specificity>
|
| 293 |
+
<bad_example>
|
| 294 |
+
<content>
|
| 295 |
+
[sample too broad learning objective
|
| 296 |
+
</content>
|
| 297 |
+
<explanation>
|
| 298 |
+
not specific enough, can still be decomposed into smaller knowledge elements that are individually coherent and useful to know.
|
| 299 |
+
</explanation>
|
| 300 |
+
</bad_example>
|
| 301 |
+
|
| 302 |
+
<good_example>
|
| 303 |
+
<content>
|
| 304 |
+
[sample nice and focused learning objective]
|
| 305 |
+
</content>
|
| 306 |
+
<explanation>
|
| 307 |
+
states the most distilled, isolated version of useful fact.
|
| 308 |
+
</explanation>
|
| 309 |
+
</good_example>
|
| 310 |
+
</examples_of_specificity>
|
| 311 |
+
"""
|
| 312 |
+
|
| 313 |
+
"""
|
| 314 |
+
<examples_of_>
|
| 315 |
+
<bad_example>
|
| 316 |
+
<content>
|
| 317 |
+
content
|
| 318 |
+
</content>
|
| 319 |
+
<explanation>
|
| 320 |
+
explanation
|
| 321 |
+
</explanation>
|
| 322 |
+
</bad_example>
|
| 323 |
+
|
| 324 |
+
<good_example>
|
| 325 |
+
|
| 326 |
+
<explanation>
|
| 327 |
+
|
| 328 |
+
</explanation>
|
| 329 |
+
</good_example>
|
| 330 |
+
</examples_of_>
|
| 331 |
+
"""
|
| 332 |
+
|
| 333 |
+
|
| 334 |
template_gen_prompt_b_text = """
|
| 335 |
"""
|
| 336 |
|
config/templates.py
CHANGED
|
@@ -175,41 +175,7 @@ template_consolidate_distractors = ChatPromptTemplate(
|
|
| 175 |
|
| 176 |
template_gen_prompt_a = ChatPromptTemplate(
|
| 177 |
messages=[
|
| 178 |
-
("system",
|
| 179 |
-
You are given a study text that is part of an e-learning and an accompanying list of learning objectives based on the text. Your goal is to refine the learning objectives, such that they adhere to the requirements as closely as possible. These learning objectives will later serve as the basis for multiple-choice exercises, and for this purpose it is crucial that they live up to the requirements in every way.
|
| 180 |
-
|
| 181 |
-
# General approach
|
| 182 |
-
- First intensely study and really internalize the requirements for good learning objectives (listed below).
|
| 183 |
-
- Then, rewrite and improve the learning objectives to better fall in line with the requirements.
|
| 184 |
-
|
| 185 |
-
# Requirements for individual learning objectives
|
| 186 |
-
Good learning objectives:
|
| 187 |
-
- Start with 'The student knows that', or whatever semantic equivalent matching the language of the study text (eg. for Dutch texts, use 'De student weet dat')
|
| 188 |
-
- Are unambiguous, and contain what later will become the specific correct answer for any multiple choice exercises that would test the learning objective
|
| 189 |
-
- Represent exactly the knowledge as written in the study text
|
| 190 |
-
- Use exactly the same terminology that's used in the study text
|
| 191 |
-
- Mirror also the general language level of the study text. If the text is written with very simple words, then the learning objectives should be also written in very simple words
|
| 192 |
-
- Mirror also the voice of the text (passive or active voice) and the perspective of the text (second or third person)
|
| 193 |
-
- Are as **specific** as can be: they contain the smallest possible knowledge element. A learning objective does not combine multiple facts, but rather isolates individual facts
|
| 194 |
-
<illustration of 'specific'>
|
| 195 |
-
<bad example: not specific enough>
|
| 196 |
-
|
| 197 |
-
</bad example: not specific enough>
|
| 198 |
-
<good example: states isolated fact>
|
| 199 |
-
|
| 200 |
-
</good example: states isolated fact>
|
| 201 |
-
</illustration of 'specific'>
|
| 202 |
-
- Avoid absolute terms that overstate their universality, like 'always' and 'never', unless that actually is true 100% of the time (usually there are exceptions to every rule, so account for those in your phrasing)
|
| 203 |
-
- Alternatively avoid vague terms that make what they wanna say too meaningless, like 'can', 'could', 'might' and 'may' (many things 'can', 'could' or 'might be', this doesn't say much)
|
| 204 |
-
- Also avoid subjective terms like 'often', 'sometimes', 'many', 'few', 'common', 'rare'. Instead, make more specific and falsifiable claims like 'in most cases' or 'A is more common than B'
|
| 205 |
-
- Avoid the use of 'important', again a signal word indicating subjectivity. Only use 'important' in statements that you cannot rephrase, yet are actually indisputable ánd meaningful to know when phrased in this way
|
| 206 |
-
|
| 207 |
-
# Process
|
| 208 |
-
- For each learning objective, go over all of the requirements, like methodically checking off a checklist.
|
| 209 |
-
- For any aspect of any learning objective that upon reflection doesn't adhere to the requirements as well as it could, carry out a rewrite (or split up one learning objective into two, for example) of the learning objective.
|
| 210 |
-
- Iteratively keep doing this for each of the individual learning objectives again and again, until you are certain that they are the best versions they can be: each entirely and maximally satisfying the requirements for good learning objectives.
|
| 211 |
-
- Take as much time as you need to get it perfect, then return the list of final learning objectives (for this, use the same language as the study text).
|
| 212 |
-
"""),
|
| 213 |
("human", "{standardized_text}")
|
| 214 |
],
|
| 215 |
input_variables=["standardized_text"]
|
|
@@ -318,14 +284,15 @@ template_gen_prompt_b = ChatPromptTemplate(
|
|
| 318 |
|
| 319 |
template_sanitize_learning_objectives = ChatPromptTemplate(
|
| 320 |
messages=[
|
| 321 |
-
("system", "You are given
|
| 322 |
-
"turn this
|
|
|
|
| 323 |
"<example of a perfect list>\n"
|
| 324 |
"De student weet dat de neus een zintuig is.\n"
|
| 325 |
"De student weet dat de tong een zintuig is.\n"
|
| 326 |
"De student weet dat de huid een zintuig is.\n"
|
| 327 |
-
"</example of a perfect list
|
| 328 |
-
("human", "Here is the
|
| 329 |
"{raw_output}")
|
| 330 |
],
|
| 331 |
input_variables=["raw_output"]
|
|
|
|
| 175 |
|
| 176 |
template_gen_prompt_a = ChatPromptTemplate(
|
| 177 |
messages=[
|
| 178 |
+
("system", template_gen_prompt_a_text),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 179 |
("human", "{standardized_text}")
|
| 180 |
],
|
| 181 |
input_variables=["standardized_text"]
|
|
|
|
| 284 |
|
| 285 |
template_sanitize_learning_objectives = ChatPromptTemplate(
|
| 286 |
messages=[
|
| 287 |
+
("system", "You are given the result of a brainstorming session that lead to the generation of learning objectives. Your task is to "
|
| 288 |
+
"turn this result into a neat clean prose list of just the learning objectives, nothing else. Do not translate or otherwise edit the learning objectives, just relay them as a list without explicit formatting: merely every learning objective on its own line, without newline separation.\n\n"
|
| 289 |
+
"Here's an example of what good output could look like:\n"
|
| 290 |
"<example of a perfect list>\n"
|
| 291 |
"De student weet dat de neus een zintuig is.\n"
|
| 292 |
"De student weet dat de tong een zintuig is.\n"
|
| 293 |
"De student weet dat de huid een zintuig is.\n"
|
| 294 |
+
"</example of a perfect list>\n"),
|
| 295 |
+
("human", "Here is the brainstorming result:\n "
|
| 296 |
"{raw_output}")
|
| 297 |
],
|
| 298 |
input_variables=["raw_output"]
|