Menu

Zero-Shot Prompting: Examples and When It Works

Zero-shot prompting means asking a model to do a task from instructions alone, with no examples of the answer. It is how most people use ChatGPT, Claude and Gemini, and it works well when the task is common and the instruction is precise.

Every prompt below is editable: change it, then open it in ChatGPT, Claude or another AI app.

Zero-shot prompting means asking a model to do a task from an instruction alone, without showing it any examples of the answer you want. "Translate this paragraph into Spanish" and "Summarize this email in two sentences" are zero-shot prompts. It is the default way people use chat models, and for common tasks it is usually all you need.

What zero-shot means

In machine learning, a "shot" is a worked example. The terms are older than chat models, but their prompting sense was popularized by Brown et al. 2020, "Language Models are Few-Shot Learners", which tested GPT-3 in three settings: a task description with zero, one or a few demonstrations in the prompt, and no retraining in any of them. For that model, a few examples usually beat none.

Since then, chat models have been trained heavily on following instructions, which is why a plain request now works so well. A zero-shot prompt is exactly the situation they were trained for: someone describes a job in words and expects it done.

Zero-shot does not mean zero context. A good zero-shot prompt still states the audience, pastes the input, and describes the format and the limits. The only thing it leaves out is a finished example of the output.

A zero-shot prompt, done well

The prompt below extracts action items from meeting notes with no example of the output, only a precise description of it. Switch parts off to see which lines do the work.

Action items from meeting notes
Parts
Pull the action items out of these meeting notes.
The list goes into our team's task tracker, so every item needs exactly one owner.
One line per item: the owner, a colon, the task starting with a verb, then the deadline in parentheses if the notes give one.
Include only work that someone agreed to do. Skip discussions and ideas nobody took on. If a task has no owner, write "Unassigned" as the owner.
Sprint sync, Tuesday Priya will fix the login timeout before Friday. Talked about moving to a new CI provider, no decision. Tom to write the release notes for 2.4. Someone should update the onboarding doc. Lena: I'll review Tom's notes by Thursday.
Try it
Example replyReplies vary between models and runs.

Priya: Fix the login timeout (before Friday) Tom: Write the release notes for 2.4 Unassigned: Update the onboarding doc Lena: Review Tom's release notes (by Thursday)

The format line does the job an example would: it spells out the exact shape of each line, so there is nothing to copy. Switch it off and the reply picks its own shape, often a bulleted list with bold names, which reads fine but no longer pastes cleanly into a tracker. Switch the constraints off and the CI discussion may appear as a task, because nothing told the model that undecided topics do not count.

When zero-shot is enough

Zero-shot works when the model can infer everything from your words:

  • The task is common. Summarizing, translating, explaining, fixing grammar and writing a function to a clear spec are all tasks the model has seen countless times in training.
  • You can describe the output exactly. "One line per item, owner first" is as clear as an example. See structured output for describing formats a program will read.
  • The categories mean what they say. Sorting reviews into positive and negative usually needs no examples, because those labels mean the same thing to nearly everyone.

When to add examples instead

Some things are hard to put into words, and those are where zero-shot prompts start to miss:

  • Your own boundaries. If your support team files "can't log in" under account problems rather than bugs, the model cannot know that. It will pick the reading most people would.
  • A house style. Your team's commit messages or the tone of your newsletter are easier to show than to describe.
  • Repeated near misses. If you have reworded the instruction twice and the output is still slightly off in the same way, stop rewording and show two or three correct answers.

That is few-shot prompting. A sensible habit is to start zero-shot, look at what comes back, and add examples only for the specific thing it gets wrong.

Zero-shot chain of thought

Kojima et al. 2022, "Large Language Models are Zero-Shot Reasoners", found that adding one sentence, "Let's think step by step", made large models noticeably better at arithmetic, symbolic and logic problems, with no examples at all. The phrase makes the model write out intermediate steps before the answer, and each step it writes becomes context for the next. Their method used two calls: the first produced the reasoning, and the second asked for the final answer.

In the block below, the first tab forces an immediate answer and the second gives the model room to work.

A train is scheduled to leave at 9:40. It leaves 25 minutes late. The trip normally takes 2 hours 35 minutes, but the train makes up 10 minutes on the way. What time does it arrive? Answer with the time only.
Try it
Example replyReplies vary between models and runs.

12:40

The first reply dropped the 10 minutes the train made up: the kind of slip that happens when a model must commit to the answer in its first few tokens. A current model may well get this one right either way; the difference grows with the number of steps in the problem. The second version has one more advantage: every step is visible, so you can see where an answer went wrong.

Models that reason internally before they answer already do this work without being asked, so "Let's think step by step" adds little for them beyond a longer reply. Chain of thought prompting covers the technique in depth, including the few-shot version.

Zero-shot versus few-shot at a glance

Zero-shotFew-shot
What the prompt containsInstructions, context and inputThe same, plus a few input and answer pairs
Best forCommon tasks with an easy-to-describe outputCustom labels, unusual formats, house style
CostShort promptLonger prompt, more tokens per call
Typical failurePicks the most common interpretation, not yoursCopies accidental patterns in the examples

Frequently Asked Questions

What is zero-shot prompting?

Zero-shot prompting is giving a language model a task with instructions only, and no worked examples of the output. "Summarize this email in two sentences" is a zero-shot prompt. Modern chat models are trained to follow instructions, so zero-shot prompts handle most everyday tasks well.

What is the difference between zero-shot and few-shot prompting?

A zero-shot prompt describes the task in words. A few-shot prompt adds a few examples, each an input paired with the answer you want, so the model can copy the pattern. Start zero-shot; switch to few-shot when the output keeps missing a format or a distinction that is easier to show than to describe.

Why is it called zero-shot?

In machine learning a "shot" is a worked example. Brown et al.'s 2020 GPT-3 paper, "Language Models are Few-Shot Learners", tested the model with zero, one or a few demonstrations of a task in the prompt, and that made the names standard for prompting: zero-shot, one-shot and few-shot.

When does zero-shot prompting not work?

It struggles when the task depends on rules only you know, such as your team's categories or house style, when the output format is unusual, and on multi-step reasoning where the model answers too fast. Examples fix the first two; asking the model to work step by step helps with the third.

What is zero-shot chain of thought?

It is a zero-shot prompt that asks the model to reason before answering, most famously by adding "Let's think step by step." Kojima et al. showed in 2022 that this one sentence, with no examples, improved large models' results on arithmetic and logic problems.

Coddy programming languages illustration

Learn to code with Coddy

GET STARTED