Code Safari

Chapter 30·Beginner·10 min read

Zero-Shot Prompting: Getting Results With No Examples

What is zero-shot prompting? A clear guide to asking an LLM to do a task with no examples — why it works, when it's the right choice, its limits, and the simple techniques that make zero-shot prompts far more reliable.

June 29, 2026

In the previous chapter you learned to write a clear prompt. When you do that — describe a task and let the model do it, with no examples — you're doing zero-shot prompting. It's the most basic and most common style, and understanding exactly when it works (and when it doesn't) tells you when to reach for the more advanced techniques in this guide.

What "zero-shot" means

The "shot" in zero-shot refers to examples. Zero-shot means zero examples — you give instructions only, and the model performs the task cold.

"Translate this sentence into French: 'Where is the train station?'"

No example translations, no demonstration. Just the instruction and the input. The vast majority of everyday prompting is zero-shot, even if you never knew the name.

Why it works at all

How can the model do a task it was never shown in the prompt? Because it was shown thousands of similar tasks during training. It has read enormous amounts of translated text, summaries, answered questions, and rewritten passages. Those patterns are baked into its parameters.

So when you say "translate this," you're not teaching it to translate — you're activating a capability it already has. The instruction points it at the right pattern. This is why instruction tuning matters: it specifically trained the model to recognise and follow instructions like these.

Where zero-shot shines

Zero-shot is excellent when the task is common and well-defined — something the model has effectively seen endlessly:

TaskTypical zero-shot prompt
Translation"Translate to Spanish: ..."
Summarisation"Summarise this in 3 sentences: ..."
Classification"Is this review positive or negative? ..."
Rewriting"Rewrite this more formally: ..."
Q&A"What's the difference between TCP and UDP?"

For these, examples are usually overkill. A clear, specific instruction does the job, and you keep the prompt short and cheap.

Where zero-shot breaks down

Zero-shot gets shaky when:

  • The output format is specific or unusual. "Return the result as a JSON array of objects with exactly these keys" — the model may get the idea but drift on the details.
  • The task is niche or ambiguous. If your task isn't a standard one, the model may misread what you want.
  • Consistency matters. Across many runs, zero-shot results on tricky tasks can vary in shape and quality.
  • The task needs reasoning. Complex multi-step problems answered in one leap are error-prone.

Making zero-shot prompts much better

Before reaching for examples, squeeze more out of zero-shot with three cheap moves:

1. Tighten the instruction. Apply everything from basic prompting: specify task, format, and constraints. Most zero-shot failures are really specificity failures.

2. Set a role and format. "You are a meticulous proofreader. Return only the corrected text, no commentary." This removes guesswork about tone and shape.

3. Ask it to think — "zero-shot CoT". For anything involving reasoning, adding a single phrase like "Let's think step by step" measurably improves accuracy, with no examples needed.

Pose the problem
Add 'think step by step'
Model reasons in steps
Better final answer
Zero-shot chain-of-thought: one phrase unlocks step-by-step reasoning

That last trick is so effective it gets its own chapter — see Chain of Thought. The remarkable part is it works without any examples, which is why it's called zero-shot CoT.

The practical decision rule

Where does zero-shot fit in your toolkit? At the start:

  1. Try zero-shot first. It's the simplest, fastest, cheapest option.
  2. If it's inconsistent, tighten the instruction and add "think step by step."
  3. If it's still off, escalate to few-shot examples or structured output techniques.
Common task
high
Specific format
medium
Niche / reasoning
low
Rough reliability as task difficulty rises (illustrative)

Don't over-engineer. Plenty of real work is solved perfectly well by a good zero-shot prompt. Escalate only when the results tell you to.

Recap

  • Zero-shot prompting = instructions only, no examples. It's the default style of prompting.
  • It works because training already taught the model countless examples of common tasks.
  • It shines for common, well-defined tasks (translate, summarise, classify, rewrite).
  • It breaks down on specific formats, niche tasks, and when consistency or heavy reasoning is needed.
  • Improve it cheaply by tightening the instruction, setting a role/format, and adding "think step by step" (zero-shot CoT).
  • Start zero-shot, escalate only when results demand it.

When zero-shot isn't consistent enough, the next move is almost always to show the model what you want. Continue to Few-shot prompting.

Zero-Shot Prompting: Getting Results With No Examples | Code Safari