Zero-shot / Few-shot
Why You Need to Understand Zero-shot and Few-shot
Getting a model to complete a task doesn't necessarily require training it — you can direct it directly through Prompt.
But there are two ways to "direct directly": give no examples, or give a few examples. Which is more effective? Depends on task complexity and the model's familiarity.
What Are Zero-shot and Few-shot
One-line definition: Zero-shot and Few-shot are ways to complete tasks through Prompt without training the model — essentially "learning through context" (In-context Learning).
- Zero-shot: give no examples, describe the task directly
- Few-shot: give several examples in the Prompt first, letting the model learn by imitation
Intuitive example:
Zero-shot:
Translate the following sentence into English:
The weather is nice today.
Few-shot:
Translate the following sentences into English:
Examples:
I love you. -> I love you.
He is tall. -> He is tall.
The weather is nice today. ->
The core of Few-shot isn't the number of examples, but whether the examples clearly explain the task rules, format, and style.
How to Do It: When to Use Zero-shot / Few-shot
Use Zero-shot for scenarios:
- Task is simple, model already excels at it
- Caring more about Prompt conciseness and cost
- Format requirements not strict
Use Few-shot for scenarios:
- Output format requirements very specific
- Task boundaries are implicit, hard to explain in one sentence
- Model easily misinterprets under Zero-shot
- Wanting the model to mimic a certain fixed style or judgment standard
Notes:
- More examples aren't always better: too many increase Token costs, may dilute the focus
- Examples should be representative: covering the most common and most error-prone input types
- Can combine with Chain of Thought: if examples show reasoning processes, complex tasks often work better
Remember this: Zero-shot gives direct commands, Few-shot uses examples to demonstrate — both are essentially "without training, letting the model learn through Prompt."
Related terms: Prompt · Chain of Thought
Related Products