Loading...
Loading...
Chain-of-thought, few-shot, step-back, meta-prompting, and tree-of-thought techniques
Ask the model to show its work:
Standard: "What is 23 x 47?" -> "1081" (may guess)
CoT: "What is 23 x 47? Let's calculate:
1) 20 x 47 = 940
2) 3 x 47 = 141
3) 940 + 141 = 1081
Answer: 1081" (much more accurate)When to use: Math, logic, multi-step reasoning.
Provide examples of what you want:
Classify sentiment: Positive, Negative, or Neutral.
Example 1: "Great product!" -> Positive
Example 2: "Terrible service." -> Negative
Now classify: "The quality is good but shipping was slow."Tips: 2-5 examples, cover edge cases, order simple to complex.
Ask the model to recall general principles before solving the specific problem.
Ask the model to design its own prompt for the task.
| Task | Best Technique |
|---|---|
| Math, logic | Chain-of-Thought |
| Classification | Few-Shot |
| Expert analysis | Role + CoT |
| Creative writing | Role + constraints |
| Design problems | Tree-of-Thought |
Convert this to a CoT prompt:
def make_cot_prompt(question):
return f'''{question}
Let's work through this step by step:
Step 1: What information am I given?
Step 2: What am I trying to find?
Step 3: Apply the approach carefully.
Step 4: Double-check my work.
Final answer:'''
problem = "A store offers a 20% discount on an $80 jacket, plus an additional 10% off the discounted price. What is the final price?"
print(make_cot_prompt(problem))