Beginner4 min read27 of 52

Zero-Shot Prompting

Asking the model to perform a task without any examples — relying purely on its training.

Read first:Prompt

SPEC: Zero-Shot

Definition

[Definition] Zero-shot prompting is the technique of asking an LLM to perform a task without providing any examples of the desired input-output behavior in the prompt. The model relies entirely on its pre-trained knowledge to understand and execute the task.

The "Shot" Terminology

TermMeaning
Zero-shot0 examples in prompt
One-shot1 example in prompt
Few-shot2–10+ examples in prompt

"Shot" refers to a demonstration or example provided in context.

How Zero-Shot Works

The model generalizes from patterns learned during pre-training across billions of documents:

Prompt: "Translate the following English text to French: 'Good morning'" Output: "Bonjour"

No translation examples were provided — the model has seen translations in training data.

Zero-Shot Examples by Task Type

Classification

Prompt: "Classify the sentiment of this review as positive, negative, or neutral: 'The product broke after two days.'" Output: "Negative"

Summarization

Prompt: "Summarize the following paragraph in one sentence: [paragraph]" Output: [one-sentence summary]

Code Generation

Prompt: "Write a Python function that checks if a number is prime." Output: [Python function]

Question Answering

Prompt: "What is the capital of Australia?" Output: "Canberra"

Zero-Shot vs. Few-Shot Performance

Task TypeZero-Shot PerformanceNotes
Common NLP tasksHighTranslation, summarization, sentiment
Domain-specific tasksModerateLegal, medical — benefits from examples
Niche/format-specificLow-MediumCustom output formats benefit from examples
Multi-step reasoningLowerCoT prompting helps significantly

Zero-Shot Chain of Thought

[Key Insight] Simply adding "Let's think step by step" to a zero-shot prompt dramatically improves reasoning: Without: "What is 23 × 17?" → May get wrong answer With: "What is 23 × 17? Let's think step by step." → Walks through the math This is called Zero-Shot Chain of Thought (Zero-Shot CoT) — one of the most impactful zero-shot prompting techniques.

Instruction Tuning Enables Zero-Shot

Base models perform poorly at zero-shot tasks (they complete text instead of answering). Instruct-tuned models are specifically trained to respond to zero-shot instructions:

  • Pre-training → learns knowledge
  • Instruction tuning → learns to follow zero-shot instructions

Zero-Shot with Roles

Assigning a role improves zero-shot performance:

"You are an expert nutritionist. What are the key macronutrients in a banana?"

The role primes the model to respond from a specific knowledge frame.

Limitations of Zero-Shot

LimitationWorkaround
Poor on novel formatsProvide few-shot examples
Inconsistent output structureSpecify format explicitly or use few-shot
Struggles with complex reasoningUse Chain of Thought prompting
Domain-specific jargonAdd context or examples
Long multi-step tasksDecompose into sub-tasks

When to Use Zero-Shot

  • Task is common and well-represented in training data
  • Prototyping / quick experiments
  • Token budget is tight (no room for examples)
  • Output format is simple (yes/no, a number, a word)

Emergent Zero-Shot Abilities

Larger models show emergent zero-shot abilities — capabilities that appear suddenly at scale:

  • Multi-step arithmetic
  • Logical reasoning
  • Code execution tracing
  • Novel analogy completion

These behaviors were absent in smaller models and appear without specific training.

Related Concepts

  • Few-Shot, Chain of Thought, Prompt, Instruct Model, Inference, In-Context Learning