Skip to content

Commit 97f3a71

Browse files
committed
update prompt guide
1 parent 33cd99c commit 97f3a71

File tree

2 files changed

+13
-44
lines changed

2 files changed

+13
-44
lines changed

examples/prompt/optimize.py

Lines changed: 6 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# weco-cli/examples/prompt/optimize.py
12
"""
23
optimize.py
34
This module holds the prompt template and the LLM call.
@@ -8,44 +9,12 @@
89
from openai import OpenAI
910

1011
client = OpenAI() # API key must be in OPENAI_API_KEY
12+
# MODEL constant removed from here
1113

12-
PROMPT_TEMPLATE = """You are an expert competition mathematician specializing in AIME problems. Your goal is to solve the following AIME problem accurately and present the final answer as a three-digit integer (000-999) enclosed in \\boxed{{}}. The evaluation script relies *absolutely* on this specific format \\boxed{{XXX}}. Meticulous accuracy is paramount.
13-
14-
Please structure your detailed thinking process as follows:
15-
16-
1. **Understand the Problem:**
17-
* Carefully read the problem statement multiple times.
18-
* Identify exactly what is being asked (the final quantity to find).
19-
* List all given conditions, constraints, variables, and specific definitions or terminology.
20-
* Identify the type of math problem (e.g., algebra, geometry, number theory, combinatorics).
21-
* Ensure you fully grasp all aspects of the problem before proceeding.
22-
23-
2. **Plan the Solution:**
24-
* Outline the mathematical approach you will take. What are the key steps?
25-
* Identify relevant mathematical concepts, theorems, formulas, or techniques (e.g., casework, symmetry, invariants, specific algebraic/geometric manipulations, modular arithmetic, pigeonhole principle).
26-
* Consider if the problem can be simplified, reframed, or approached using a specific known AIME strategy.
27-
* Consider different strategies and choose the most promising one, explaining why.
28-
* Break down the problem into smaller, manageable parts if necessary.
29-
30-
3. **Execute the Plan:**
31-
* Work through the problem step-by-step according to your plan.
32-
* Show ALL calculations and logical derivations explicitly. Do not skip steps. Ensure every step logically follows from the previous one.
33-
* Clearly state your reasoning at each stage. Define any variables used.
34-
* Perform calculations accurately. Pay close attention to details. Double-check arithmetic.
35-
* Keep track of your intermediate results and units (if any).
36-
37-
4. **Verify the Solution:**
38-
* Review your entire solution process from beginning to end.
39-
* Re-read the original problem statement. Did you answer the specific question asked?
40-
* Double-check your calculations, especially critical ones and the final arithmetic.
41-
* Does the answer satisfy all the conditions and constraints given in the problem statement?
42-
* Does the answer make sense in the context of the problem? (e.g., Is it the right order of magnitude? Is it the correct type of number?)
43-
* Consider potential edge cases or common pitfalls. Did you account for them?
44-
45-
5. **Final Answer:**
46-
* State your final result clearly.
47-
* The final answer must be a single three-digit integer between 000 and 999, inclusive.
48-
* Enclose the three-digit integer in the required format: \\boxed{{XXX}}. For example, if the answer is 42, write \\boxed{{042}}. If the answer is 123, write \\boxed{{123}}.
14+
PROMPT_TEMPLATE = """You are an expert competition mathematician tasked with solving an AIME problem.
15+
The final answer must be a three-digit integer between 000 and 999, inclusive.
16+
Please reason step-by-step towards the solution. Keep your reasoning concise.
17+
Conclude your response with the final answer enclosed in \\boxed{{}}. For example: The final answer is \\boxed{{042}}.
4918
5019
Problem:
5120
{problem}
@@ -61,6 +30,5 @@ def solve(problem: str, model_name: str) -> str:
6130
response = client.chat.completions.create(
6231
model=model_name, # Use the passed-in model name
6332
messages=[{"role": "user", "content": prompt}],
64-
temperature=0.0 # Set temperature to 0 for deterministic output
6533
)
6634
return response.choices[0].message.content.strip()

examples/prompt/prompt_guide.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,17 @@ The primary goal is to enhance the model's reasoning process for these challengi
2929

3030
**Ideas to Explore:**
3131
You don't have to implement all of them, but the following ideas might be helpful:
32-
* **Explicit Workflow Definition:**
33-
* Define a clear step-by-step thinking process within the prompt template itself. E.g., "1. Understand the problem constraints. 2. Identify relevant theorems/formulas. 3. Formulate a plan. 4. Execute calculations step-by-step. 5. Verify intermediate results. 6. State the final answer in the required format."
34-
* Use headings or numbered lists within the template to guide the model's output structure during reasoning.
35-
* **Advanced CoT Techniques:**
32+
* **Workflow Patterns:**
33+
* **Linear**: step-by-step thinking process could be a good starting point E.g., "1. Understand the problem constraints. 2. Identify relevant theorems/formulas. 3. Formulate a plan. 4. Execute calculations step-by-step. 5. Verify intermediate results. 6. State the final answer in the required format."
34+
* **List Candidates**: You can ask the model to propose a few solutions in a particular step and pick the best solution. You can potentially also set the criterias in the prompt.
35+
* **Code** Write pesudo code to define even more complex workflows with loops, conditional statement, or go to statement.
36+
* **Other CoT Techniques:**
3637
* Self-Correction/Reflection
3738
* Plan Generation
38-
* Simulated Multi-Path Exploration (within the prompt):
39-
* Write pesudo code to define complex workflows
4039
* Debate, simulating multiple characters
40+
* Tree of thought
4141
* **Few-Shot Examples:** You *could* experiment with adding 1-2 high-quality AIME problem/solution examples directly into the `PROMPT_TEMPLATE` string (similar to how Weco attempted in one of the runs). Ensure the examples clearly show the desired reasoning style and the final `\boxed{XXX}` format. *Caution: This significantly increases prompt length and cost.*
42+
* **Play with format:** The way you format the prompt. Markdown, xml, json, code or natural language. Similarly for the thinking tokens themselves you can also try out different formats.
4243

4344
## 5. Constraints
4445
* **Ensure the final output reliably contains `\boxed{XXX}` as the evaluation script depends on it.**

0 commit comments

Comments
 (0)