Zero-Shot Prompting

Zero-shot prompting asks an LLM to perform a task without providing any examples, relying entirely on the model's pre-trained knowledge and the clarity of the instruction. It works well for common tasks but often requires examples for specialised or nuanced outputs.

What is Zero-Shot Prompting?

Zero-shot prompting means giving an LLM a task description with no training examples — just an instruction and the input. The model must generalise from its pre-training to handle the task.

Classify the sentiment of the following review as Positive, Negative, or Neutral.
Review: "The battery life is outstanding but the camera is mediocre."
Sentiment:

Why Zero-Shot Works

Large LLMs have encountered millions of classification, summarisation, translation, and reasoning tasks during pre-training. Zero-shot performance exploits this latent knowledge — the model can often perform tasks it was never explicitly trained for, simply because similar tasks appeared in its training data.

Zero-Shot CoT

One of the most impactful zero-shot techniques: appending "Let's think step by step" to a prompt dramatically improves reasoning accuracy on complex problems, without any examples. This phrase triggers the model's chain-of-thought reasoning mode.

When Zero-Shot Fails

  • Highly specialised domain terminology the model hasn't seen.
  • Non-standard output formats.
  • Tasks requiring very consistent formatting.
  • Tasks where the exact boundary conditions matter.

In these cases, move to few-shot prompting or fine-tuning.

Example

'Translate the following to French: The meeting is at 3pm.' — This is zero-shot; no translation example is provided. GPT-4 will correctly handle this since translation is common in training data.

Related terms

  • Few-Shot Prompting Few-shot prompting is a technique where you include a small number of example input-output pairs in your prompt to guide an LLM's response format and style. It's one of the most effective prompt engineering techniques for improving output quality without fine-tuning.
  • Chain-of-Thought (CoT) Prompting Chain-of-Thought prompting elicits step-by-step reasoning from an LLM before it produces a final answer. By showing or requesting intermediate reasoning steps, CoT dramatically improves accuracy on arithmetic, logical reasoning, and multi-step problem-solving tasks.
  • In-Context Learning In-context learning is the ability of LLMs to learn new tasks from examples provided directly in the prompt, without updating model weights. By showing the model input-output pairs (few-shot examples), it generalises to new inputs in the same format.
  • LLM (Large Language Model) A Large Language Model is a neural network trained on massive text corpora to predict and generate text. LLMs like GPT-4, Claude, and Gemini exhibit broad language understanding, reasoning, and generation capabilities that emerge from scale.