Zero-Shot Prompting

Zero-shot prompting means asking an LLM to complete a task with no examples — just an instruction. It's the simplest prompt structure and the right default for well-known tasks. Here's when it works, when it breaks, and how to fix a weak zero-shot prompt.

What is zero-shot prompting?

A zero-shot prompt contains only the task instruction — no demonstrations, no examples, no labeled input-output pairs. You rely entirely on the model's pre-trained knowledge to figure out what format and quality of answer you expect.

Zero-Shot
"Translate this sentence to French: The meeting is at 3pm."
No examples — just instruction + input
Few-Shot
"English: Good morning. French: Bonjour.
English: Thank you. French: Merci.
English: The meeting is at 3pm. French: …"
2 examples before the real input

Zero-shot vs few-shot: when to use which

ScenarioRecommended approachWhy
Translation (common language pair)Zero-shotWell-known task; model has seen millions of examples
Summarization with no format constraintZero-shotModel understands "summarize" deeply
JSON extraction with a custom schemaZero-shot + schema in instructionEmbedding the schema acts like a single-shot template
Classification with a fixed label setFew-shot (1 ex per class)Examples lock in label vocabulary and prevent drift
Unusual domain (legal, medical, niche)Few-shotModel needs domain-specific format cues
Math/logic with multiple stepsZero-shot CoT ("think step by step")CoT trigger unlocks reasoning without examples
Consistent tone/style matchingFew-shot (2–3 tone samples)Examples communicate style better than description

Before → After: improving zero-shot prompts

Weak Zero-Shot → Strong Zero-Shot (Sentiment)
A vague task gets inconsistent format. Adding an output constraint and format spec fixes it without any examples.
Before (weak)
Classify the sentiment of this review: "Setup took 30 minutes and the documentation is terrible, but once running it's fast."
After (strong)
Classify the sentiment of this customer review. Output exactly one word: Positive, Negative, or Mixed. No explanation.

Review: "Setup took 30 minutes and the documentation is terrible, but once running it's fast."
Why it works: The weak prompt produces "The sentiment is Mixed because…" — 40 words when you needed 1. The strong prompt adds the output format constraint and eliminates the preamble.
Zero-Shot Data Extraction
Structured extraction without examples — works when the output schema is explicit in the instruction.
Before (weak)
Extract the key information from this job posting.
After (strong)
Extract the following fields from this job posting. Return a JSON object only — no markdown, no explanation.

Fields: {"title": "", "company": "", "location": "", "salary_range": "", "required_years_exp": 0, "remote": true/false}

Job posting:
[PASTE JOB POSTING HERE]
Why it works: Pasting the schema into the instruction is a zero-shot alternative to showing an example. The model fills in the template rather than inventing a format.
Zero-Shot CoT (Math / Logic)
Append "Think step by step" to any zero-shot prompt to unlock chain-of-thought reasoning. Dramatically improves accuracy on multi-step problems.
Before (weak)
A train leaves Chicago at 9am traveling 80mph. Another leaves Detroit at 10am traveling 60mph. Chicago to Detroit is 300 miles. When do they meet?
After (strong)
A train leaves Chicago at 9am traveling 80mph toward Detroit. A second train leaves Detroit at 10am traveling 60mph toward Chicago. The distance between cities is 300 miles.

Think step by step, showing your working. Then state the meeting time clearly on the last line.
Why it works: "Think step by step" is the simplest zero-shot CoT trigger. Adding "showing your working" prevents the model from shortcutting to a wrong answer.

Zero-Shot CoT: the single best zero-shot upgrade

Appending "Think step by step" to any zero-shot prompt triggers chain-of-thought reasoning — the model shows its working before committing to an answer. Research (Wei et al., 2022) shows this alone closes most of the gap between zero-shot and few-shot for math and logic tasks.

Zero-Shot CoT pattern
[Your task or question here]

Think step by step, then give your final answer on the last line as "Answer: <value>".

Improve your zero-shot prompts automatically

Paste any prompt into Prompt Improver — it rewrites it and shows a changelog explaining exactly what changed and why. Free, no account needed.

Try Prompt Improver Free →

Frequently asked questions

What is zero-shot prompting?

Zero-shot prompting means asking an LLM to perform a task with no examples in the prompt — you rely entirely on the model's pre-trained knowledge. Example: "Classify this review as Positive, Negative, or Neutral: 'The product broke after one use.'" The model answers without seeing any labeled demonstrations. Zero-shot works well for well-known tasks (translation, basic classification) but can produce inconsistent output formats compared to few-shot prompting.

When should I use zero-shot vs few-shot prompting?

Use zero-shot when: (1) the task is well-known and unambiguous (e.g., "Translate this to Spanish"), (2) you want the shortest possible prompt, or (3) you're prototyping and don't yet have examples. Use few-shot when: output format consistency matters, the task is unusual or domain-specific, you need the model to produce structured data (JSON, tables), or zero-shot is giving inconsistent results. Few-shot typically outperforms zero-shot on structured extraction and classification tasks.

Does zero-shot prompting work with Claude?

Yes — Claude handles zero-shot prompts well for common tasks like summarization, translation, sentiment analysis, and Q&A. For more complex or structured tasks, adding a detailed system prompt (role, output format, constraints) improves zero-shot performance significantly. Claude's instruction-following is strong enough that a well-written zero-shot prompt often matches the quality of few-shot prompts from earlier models.

What is the difference between zero-shot and chain-of-thought prompting?

These are orthogonal techniques. Zero-shot describes how many examples are in the prompt (none). Chain-of-thought (CoT) describes whether you ask the model to reason step-by-step before giving the final answer. You can combine them: "Zero-shot CoT" = no examples + "Think step by step" instruction. Zero-shot CoT has been shown to dramatically improve accuracy on math and logic problems compared to plain zero-shot.

How do I improve a zero-shot prompt that's giving bad results?

Try these in order: (1) Add a role/persona to the system prompt ("You are an expert data analyst…"). (2) Specify the exact output format ("Return a JSON object with keys: …"). (3) Add a constraint list ("Do not include preamble, output only the result"). (4) Ask for reasoning first ("Think step by step, then give your final answer"). If none of these work, add 2–3 examples to convert it to a few-shot prompt — sometimes examples communicate the pattern better than any instruction.

Related prompt engineering guides

Few-Shot PromptingChain-of-Thought PromptingPrompt Engineering ToolAI Prompt OptimizerPrompt Library — 25 ExamplesClaude Prompt Examples
🔥 Tonight: Claude Code Power Prompts · £5 £3 first 10Get PDF →