Zero-shot, one-shot, and few-shot prompting are three ways to structure an LLM prompt: give instructions only, add one example, or add two to five examples of the input-output pattern you want. This lesson covers when to use each method, how many examples to include, and how to combine instructions with examples for reliable, consistent output.
What you will be able to do
- Choose between zero-shot, one-shot, and few-shot prompting based on how common or unusual the task is
- Write few-shot prompts using 2 to 5 examples that are varied but consistent, so the model learns the pattern instead of overfitting
- Structure a combined prompt in order: role, goal, task, instructions, examples, context/input, rules, format
- Decide how many examples to use, starting with 2 and adding more only when results come back inconsistent
- Adapt the newsletter subject line, social post, and customer support reply templates to your own recurring writing tasks
Before you start
- Access to an LLM such as ChatGPT, Claude, or Gemini
- A specific recurring task in mind (subject lines, captions, support replies, meeting notes) to apply the patterns to
- One or two real examples of your own best output, to use as few-shot examples
Reference
| Pattern | Examples used | When to use | Note |
|---|---|---|---|
| Zero-shot | 0 | Common, well-understood tasks (summarize, translate, explain out-of-office replies) | Fastest to write, but output can vary between runs and miss subtle requirements |
| One-shot | 1 | You have a specific format or style in mind, or need brand-voice consistency | Clear format guidance, but a single example can cause overfitting |
| Few-shot | 2 to 3 | The sweet spot for most tasks: enough pattern recognition without wasting context | Start here before adding more examples |
| Few-shot | 4 to 5 | Complex patterns, unusual formats, tasks where consistency is critical | Takes longer to prepare and uses more context window |
| Few-shot | 5+ | Rarely needed | Rarely improves results and wastes context window |
| Combined prompt order | n/a | Any task needing both instructions and demonstrated pattern | Role, Goal, Task, Instructions, Examples, Context/Input, Rules, Format |
Common errors and fixes
| What goes wrong | The fix |
|---|---|
| Zero-shot output is inconsistent between runs or misses subtle requirements | Move to one-shot or few-shot so the model copies a demonstrated pattern instead of guessing |
| Few-shot examples are all too similar (e.g. every subject line starts with a number) | Use varied examples that follow the same underlying pattern, not the same surface structure |
| Examples use vague placeholders like "[topic]" instead of real content | Use real, high-quality content in every example so the model has something concrete to copy |
| Output length does not match what you wanted | Match the length of your examples to the length you want in the output |
| Adding more and more examples hoping for better results | Stop at 2 to 5; beyond that it rarely improves results and just wastes context window |
Read the full walkthrough
The complete lesson, with screenshots and any downloads, is published on Substack as part of Prompt Engineering for AI Automation.
More in this section
- Lesson 1: LLMs and Prompts in Generative AI
- Lesson 2: How to control the large language models output?
Continue the course
Browse all lessons in the Prompt Engineering for AI Automation course, or subscribe to the GenAI Unplugged newsletter to get new lessons in your inbox.