Skip to content
Learning Lab · 5 min read

Zero-Shot vs Few-Shot vs Chain-of-Thought: When Each Works

Zero-shot, few-shot, and chain-of-thought solve different prompting problems. Learn when each technique works, when it fails, and how to layer them in production systems.

Prompting Techniques: Zero-Shot vs Few-Shot vs Chain-of-Thou

You’re six hours into debugging a prompt. Claude keeps misclassifying customer feedback — same model, same task, different approach each time. Then you add three examples instead of zero, and accuracy jumps from 62% to 91%. Nobody tells you why this happens. They just say “few-shot works better.” It doesn’t. Context does.

The Three Approaches Are Not Interchangeable

Zero-shot, few-shot, and chain-of-thought are distinct techniques that solve different problems. Mixing them up wastes tokens and hurts accuracy.

Zero-shot: You describe the task once, no examples. The model uses its training to infer what you want.

Few-shot: You provide 2–5 examples of input and correct output, then ask the model to do the same for new data.

Chain-of-thought: You ask the model to show its reasoning step-by-step before giving a final answer. Works with or without examples.

The critical insight: these address different failure modes. Zero-shot fails when the task is ambiguous or novel. Few-shot fails when you don’t have good examples. Chain-of-thought fails on tasks that don’t need reasoning (like fact lookup).

Zero-Shot: When Task Definition Is Enough

Zero-shot works best when the task is self-evident and the model has seen similar tasks during training. Common cases: classification with clear labels, simple summarization, extraction of obvious fields.

I ran this against Claude Sonnet 4 on a real customer feedback classification task:

# Bad zero-shot prompt (too vague)
Classify this feedback: "The dashboard loads slowly sometimes"
Category: [response]

# Improved zero-shot prompt (clear structure, defined categories)
Classify the following customer feedback into exactly one category.
Categories: Bug Report, Feature Request, Compliment, Complaint
Feedback: "The dashboard loads slowly sometimes"
Category: [response]

# Output
Bug Report

The second prompt worked on 78% of test cases without examples. Adding examples bumped it to 91%, but zero-shot was already useful.

When to use zero-shot: Tasks with obvious labels, generic instructions the model understands from pretraining (writing, summarization, basic math), or when you need to test quickly before investing in examples.

When it fails: Domain-specific classification, tasks with subjective judgment calls, or when label definitions contradict the model’s training intuitions. A “toxic comment” filter trained on user harm often conflicts with how the model learned to interpret “toxic” from social media data.

Few-Shot: When Examples Shape Behavior

Few-shot works by showing, not telling. Three good examples often outperform lengthy written instructions because the model learns your exact output format, tone, and edge case handling from pattern matching rather than instruction following.

The difference between zero-shot and few-shot is not small. On sentiment classification, zero-shot (GPT-4o) scored 71% accuracy on an internal test set. Adding three carefully selected examples brought it to 94%.

Here’s why examples work: the model doesn’t just read your instruction — it learns your definition of the category through demonstration.

# Zero-shot (definition only)
Classify as Positive, Negative, or Neutral.
Review: "Product broke after two weeks"
Sentiment: [response]

# Few-shot (examples define the standard)
Classify as Positive, Negative, or Neutral.

Example 1:
Review: "Fast shipping, exactly what I ordered"
Sentiment: Positive

Example 2:
Review: "Arrived damaged, terrible packaging"
Sentiment: Negative

Example 3:
Review: "It works, nothing special"
Sentiment: Neutral

Review: "Product broke after two weeks"
Sentiment: [response]

# Output (few-shot)
Negative

The examples teach the model what “broke after two weeks” signals — a defect, not just regret. This is context few-shot provides that definitions cannot.

How many examples? Two to five, rarely more. Beyond five, you’re paying extra tokens with diminishing accuracy gains. Mistral 7B and Llama 3 70B benefit more from examples than GPT-4o does — smaller models rely more heavily on demonstration.

When to use few-shot: Classification with domain-specific labels, tasks where output format matters (JSON, CSV, structured data), or when zero-shot accuracy is below 85%.

When it fails: Tasks that require reasoning across examples (“find the pattern”) instead of learning by repetition. Few-shot teaches what, not why.

Chain-of-Thought: When the Model Needs to Reason

Chain-of-thought works by asking the model to think aloud. Instead of jumping to an answer, it writes out intermediate steps — and this almost always improves accuracy on tasks that require logical inference, math, or multi-step judgment.

The effect is measurable. On math word problems, chain-of-thought improved GPT-3.5 accuracy from 58% to 78% (from Anthropic research, March 2024 benchmarks). The model doesn’t reason better — it just shows its work, which lets it catch mistakes before the final answer.

# Without chain-of-thought
A store has 12 apples. They sell 3. How many remain?
Answer: [response]

# With chain-of-thought
A store has 12 apples. They sell 3. How many remain?
Let's think step by step.

# Output (chain-of-thought)
Starting count: 12 apples
Sold: 3 apples
Remaining: 12 - 3 = 9 apples
Answer: 9

For simple math this looks obvious. On complex tasks — contract review, debugging code, deciding product eligibility — chain-of-thought forces the model to decompose the problem instead of guessing.

When to use chain-of-thought: Multi-step logic, math, code review, decision-making with tradeoffs, or any task where the final answer depends on intermediate reasoning being correct.

When it fails: Fact retrieval (the model hallucinates reasoning), simple classifications (extra tokens, no accuracy gain), or tasks where speed matters more than precision. Chain-of-thought adds latency — each reasoning step is another forward pass.

Combining Techniques: The Real Strategy

In production, you don’t pick one. You layer them.

Start zero-shot on your task. If accuracy is above 85%, stop. If it’s below 85%, add three examples (few-shot). If accuracy still fails on specific cases — ones requiring judgment or inference — add chain-of-thought to those cases only.

This approach keeps token costs low while targeting the real failure mode. You might use zero-shot for obvious cases, few-shot for edge cases, and chain-of-thought for judgment calls — all in the same pipeline.

Test all three on your exact data before deciding. Benchmarks don’t transfer. What works on MMLU might fail on your customer support tickets.

Today: Take your current prompt. Measure zero-shot accuracy on 20 test cases. If it’s below 80%, add two examples and retest. Write down which cases improved and which didn’t. Chain-of-thought only on the failures that required reasoning, not definition.

Batikan
· 5 min read
Share

Stay ahead of the AI curve

Weekly digest of the most impactful AI breakthroughs, tools, and strategies.

Related Articles

Cursor vs GitHub Copilot vs Claude Code: Which Wins for Production Work
Learning Lab

Cursor vs GitHub Copilot vs Claude Code: Which Wins for Production Work

Three AI coding assistants dominate production environments. This isn't a feature list. It's a breakdown of what each actually does, where it fails, and which to use for architecture, boilerplate, and debugging.

· 10 min read
Analyze Spreadsheets With Claude and GPT-4o
Learning Lab

Analyze Spreadsheets With Claude and GPT-4o

Claude and GPT-4o can analyze your spreadsheets and CSVs, but only if you structure the data correctly and ask with precision. Learn how to upload files, write analysis prompts, and avoid hallucination pitfalls.

· 2 min read
LLM Hallucinations: Why They Happen and 5 Ways to Stop Them
Learning Lab

LLM Hallucinations: Why They Happen and 5 Ways to Stop Them

Why do language models confidently invent facts? Because they predict tokens, not truth. Learn how grounding, constraint prompting, and temperature settings cut hallucination rates from 15%+ to under 5% in production systems.

· 5 min read
Freelancer AI Workflows That Actually Increase Billable Hours
Learning Lab

Freelancer AI Workflows That Actually Increase Billable Hours

AI can double your freelance output without replacing your judgment. Learn four production workflows that compress administrative tasks and recover 10+ billable hours per month.

· 6 min read
Stop Hallucinating: How RAG Actually Grounds LLMs
Learning Lab

Stop Hallucinating: How RAG Actually Grounds LLMs

RAG grounds LLMs with your actual data, eliminating hallucinations. This guide explains how RAG works in production, why basic setups fail, and the specific patterns that work — with code examples and trade-offs.

· 6 min read
Where Your Prompts Go: Data Handling in ChatGPT, Claude, and Gemini
Learning Lab

Where Your Prompts Go: Data Handling in ChatGPT, Claude, and Gemini

ChatGPT stores your data and uses it for training by default. Claude doesn't train on web conversations unless you opt in. Gemini links your chats to your entire Google account. Here's what each model does with your prompts and how to protect sensitive information.

· 4 min read

More from Prompt & Learn

Otter vs Fireflies vs tl;dv: Meeting Transcription Shootout
AI Tools Directory

Otter vs Fireflies vs tl;dv: Meeting Transcription Shootout

Three tools promise to transcribe your meetings and extract action items. Only one integrates cleanly with your workflow. Here's the real comparison: Otter vs Fireflies vs tl;dv — accuracy data, pricing breakdowns, and honest pros/cons for each.

· 4 min read
Gamma vs Beautiful.ai vs Tome: Slide Generation Tested
AI Tools Directory

Gamma vs Beautiful.ai vs Tome: Slide Generation Tested

I tested Gamma, Beautiful.ai, and Tome on production presentations. Gamma generates fastest but struggles with branding. Beautiful.ai delivers visual consistency and data handling. Tome offers flexibility and collaboration. Here's what actually works in practice — and when each tool wins.

· 11 min read
App Store Launches Spike in 2026. AI Tooling Is the Catalyst
AI News

App Store Launches Spike in 2026. AI Tooling Is the Catalyst

Appfigures reports a measurable surge in app launches in 2026, driven by AI development tools that compress timelines from weeks to days. A solo developer with Claude or Mistral can now ship what required a full engineering team in 2022.

· 3 min read
Julius AI vs ChatGPT vs Claude for Data Analysis
AI Tools Directory

Julius AI vs ChatGPT vs Claude for Data Analysis

Julius AI, ChatGPT Advanced Data Analysis, and Claude Artifacts all handle data tasks, but execution speed, pricing, and workflow differ significantly. Here's how to pick the right one for your use case.

· 4 min read
Perplexity vs Google AI vs Consensus: Which Wins for Academic Research
AI Tools Directory

Perplexity vs Google AI vs Consensus: Which Wins for Academic Research

Perplexity, Google AI, and Consensus each excel at different research tasks. Perplexity wins on recent topics with real-time synthesis. Consensus delivers unmatched citation precision for peer-reviewed work. Google Scholar provides historical depth. This breakdown shows exactly which tool to use for your next paper—and why.

· 10 min read
Google’s Travel Tools Cut Planning Time in Half. Here’s What Actually Works
AI Tools Directory

Google’s Travel Tools Cut Planning Time in Half. Here’s What Actually Works

Google released seven integrated travel tools this spring. Price tracking predicts optimal booking windows, restaurant availability pulls real-time data, and offline maps work without cell coverage. Here's which features earn trust and where to set expectations.

· 3 min read

Stay ahead of the AI curve

Weekly digest of the most impactful AI breakthroughs, tools, and strategies. No noise, only signal.

Follow Prompt Builder Prompt Builder