Course Content
Zero-Shot and Few-Shot Prompting
Control model behavior without fine-tuning using examples in the prompt
Zero-Shot Prompting
Zero-shot means giving the model no examples — just a clear instruction. Modern LLMs handle zero-shot well for standard tasks.
Classify the following text as Technical, Business, or General.
Text: "The new transformer architecture reduces inference latency by 40%."Output: Technical
Zero-shot works when:
- The task is well-defined and common
- The output format is standard
- You need speed and simplicity
Few-Shot Prompting
Few-shot adds 2–5 examples before the actual input. The model learns the pattern and applies it.
Classify each text. Reply with only the label.
Text: "Q3 revenue up 12% YoY" → Business
Text: "Updated the CI/CD pipeline" → Technical
Text: "The weather is nice today" → General
Text: "Deployed new containerization strategy to reduce costs" →Output: Business or Technical — the model will infer from context.
When to Use Each
| Situation | Use |
|---|---|
| Standard task, common format | Zero-shot |
| Custom classification scheme | Few-shot |
| Ambiguous output expected | Few-shot |
| Prompt length is a concern | Zero-shot |
| Need high consistency | Few-shot |
How Many Examples?
- 3 examples: usually sufficient for simple classification
- 5 examples: good for nuanced tasks
- 8–10 examples: complex tasks or rare edge cases
- More than 10: rarely helps and increases cost
Always include at least one example of each class you want the model to produce.
