Zero-shot prompting

Zero-shot prompting asks an AI model to do a task with instructions only and no examples. Few-shot prompting adds a few examples to show the pattern.

Zero-shot prompting means asking an AI model to do a task without showing it any examples. You describe what you want, and the model relies on what it learned in training.

Most everyday prompts are zero-shot. “Summarize this article” and “Translate this email into Spanish” are both zero-shot prompts.

Zero-shot vs few-shot

Few-shot prompting adds a few worked examples before the real task. The model copies the pattern. The terms come from the GPT-3 paper, Language Models are Few-Shot Learners (2020).

A zero-shot prompt looks like this.

Classify the sentiment of this review as positive, negative or mixed.

Review: The boots are comfortable but the laces broke in a week.

A few-shot prompt for the same task looks like this.

Classify the sentiment of each review as positive, negative or mixed.

Review: Fast delivery and great fit.
Sentiment: positive

Review: Too small and the return took a month.
Sentiment: negative

Review: The boots are comfortable but the laces broke in a week.
Sentiment:

The examples set the exact output format. With them, the model returns one word. Without them, it may answer in a full sentence or add an explanation.

Zero-shot Few-shot
Examples in the prompt None Two to five
Effort to write Lowest More
Output format Model decides Follows your examples
Best for Common, clear tasks Strict formats, unusual labels, a house style

When to use each

Start zero-shot. Modern models handle most clear tasks without examples. Add examples when the output drifts, the format must be exact, or the task uses labels the model can’t guess.

Examples also cost tokens. Five long examples in every message add up in a busy AI workflow. Put them in a system prompt or project instructions so you write them once.

Tips for better zero-shot prompts

  • Name the output. “Return one word” beats “tell me the sentiment”.
  • Give the audience. “Explain to a new customer” changes the whole answer.
  • List the options. If there are fixed labels, write them all out.
  • Ask for one thing. Split multi-part tasks into separate prompts.
Chandan Kumar

Chandan Kumar

Founder, Sparkian and Geekflare

Chandan Kumar is a founder of Sparkian & Geekflare. He is a technology enthusiast and entrepreneur who loves to help businesses and people around the world.

Ready to spark your next idea?

Your next question, first draft, or big idea. Start here.