Module 9 Lesson 1: Prompt Design for Smaller Models
Optimization for 8B. Why 'Chain of Thought' is the secret weapon for making small models act like giants.
Prompt Design: Squeezing Quality from 8B
In Module 3, we learned basic prompting. Now, we dive into advanced techniques specifically for Small Language Models (SLMs) like Llama-3-8B or Mistral-7B. These models have less "internal logic" than GPT-4, so you have to provide the logic externally through your prompt.
1. COT: Chain of Thought
This is the most effective way to improve a small model's reasoning. Instead of asking for an answer, you tell the model to "Think out loud."
The "Standard" Prompt (Bad): "What is 25 * 34?" Result: The model might guess 840 (wrong).
The "Chain of Thought" Prompt (Good): "What is 25 * 34? Think step-by-step. First, multiply 25 by 30. Then, multiply 25 by 4. Finally, add the results." Result: By forcing it to process small chunks, the model will correctly arrive at 850.
2. Delimiters (The Brackets)
Small models can get confused between your instructions and the data you want them to process. Use clear delimiters like ###, ---, or """ to separate sections.
Example:
I want you to summarize the text between the triple-backticks.
Text: ```[Your long 5-page document here]```
Summary:
3. Negative Constraints
Tell the model what NOT to do explicitly. Smaller models are prone to "yapping" (providing unnecessary introductions).
Add this to every prompt: "Answer ONLY with the requested information. Do not say 'Sure' or 'Here is your info'. Do not provide context unless asked."
4. Role-Based Prompting (Persona)
Giving a small model a role isn't just for fun; it changes which "weights" are activated in its brain.
- Scientist role: Activates formal, evidence-based language.
- Coder role: Activates logical, syntax-heavy language.
Summary Checklist for 8B Models
- Chain of Thought: Did I ask it to "think step-by-step"?
- Structure: Did I use
###to separate instructions from data? - Constraint: Did I tell it what to avoid?
- Few-Shot: Did I include at least one example?
Key Takeaways
- Chain of Thought (thinking out loud) drastically reduces logic errors.
- Delimiters help the model distinguish between your command and your data.
- Small models need explicit negative constraints to stop rambling.
- Prompt quality is the difference between a "Toy" AI and a "Tool" AI.