Course contentsShow
← Machine Learning and Deep Learning
Lesson 1840 of 3,53839. Prompt Engineering FundamentalsFree lesson

When to Use Zero-Shot vs Few-Shot

Decision framework: task complexity, model capability, context limits, and available example data.

When to Use Zero-Shot vs Few-Shot

What you'll learn: How to decide between zero-shot and few-shot prompting based on task complexity, model capability, context limits, and available examples.

The Decision Framework

Choosing between zero-shot and few-shot prompting isn't arbitrary—it's a strategic decision based on four key factors working together.

1. Task Complexity

Simple, well-defined tasks (like "Translate to French" or "Summarize in one sentence") often work fine with zero-shot. The model has seen countless similar examples during pretraining.

Complex or ambiguous tasks (like nuanced sentiment analysis, structured data extraction with specific fields, or domain-specific classification) benefit dramatically from few-shot examples that clarify exactly what you want.

2. Model Capability

Larger, more capable models (GPT-4, Claude) can follow zero-shot instructions reliably because they've learned stronger instruction-following during training.

Smaller or base models may struggle with zero-shot and need few-shot examples as concrete demonstrations of the desired behavior.

3. Context Window Limits

Few-shot prompting consumes tokens rapidly. If you have a tight context budget or need to process long documents, zero-shot keeps more room for your actual content.

When context is plentiful, few-shot is "cheap" and often worth the investment.

4. Available Example Data

No quality examples? Zero-shot is your only option. High-quality, representative examples available? Few-shot will likely improve consistency and accuracy, especially for edge cases.

Practical Decision Tree

Start with zero-shot for speed and simplicity. Switch to few-shot when you observe: inconsistent formatting, misinterpreted instructions, or poor handling of edge cases. Use retrieval-based dynamic few-shot when you have many examples but limited context.

Key Takeaway: Use zero-shot for simple tasks with capable models and tight context; use few-shot when task complexity increases, model capability decreases, or output consistency matters more than token efficiency.