---
title: "What is few-shot prompting? Few-shot vs zero-shot"
description: "Few-shot prompting puts a handful of examples in an LLM prompt so the model infers the task and format. How it works, and few-shot vs zero-shot prompting."
type: "glossary-term"
canonical_url: "https://theaiengineering.com/glossary/few-shot-prompting"
markdown_url: "https://theaiengineering.com/glossary/few-shot-prompting.md"
topic: "Prompt and context engineering"
author: "The AI Engineering Editors"
publisher: "The AI Engineering"
updated: "2026-11-06"
keywords: ["Few-shot prompting","few-shot learning","in-context learning","k-shot prompting","multishot prompting"]
citation: "The AI Engineering Editors. \"What is few-shot prompting? Few-shot vs zero-shot.\" The AI Engineering, updated Nov 06, 2026. https://theaiengineering.com/glossary/few-shot-prompting"
---

# What is few-shot prompting? Few-shot vs zero-shot

Also called few-shot learning, in-context learning, k-shot prompting, multishot prompting.

> **Definition of Few-shot prompting:** Few-shot prompting is a technique that puts a few example inputs paired with desired outputs in a prompt, so a language model infers the task, format, and labels without changing its weights.

Few-shot prompting is the practice of placing a few worked examples, each an input paired with the desired output, in a prompt before the real input. The model infers the task, the output format, and the label set from the examples and continues the pattern, with no training or weight updates. It is one of the cheapest ways to make a [large language model](https://theaiengineering.com/glossary/large-language-model) produce consistent output, and the examples often live in the [system prompt](https://theaiengineering.com/glossary/system-prompt).

## How few-shot prompting works

Few-shot prompting works through in-context learning: the model conditions on the demonstrations in its input and applies the same pattern to the new case. The [GPT-3 paper](https://arxiv.org/abs/2005.14165) (Brown et al., 2020) named the settings by example count: zero-shot gives only an instruction, one-shot adds one demonstration, and few-shot adds several.

For GPT-3, few-shot meant roughly 10 to 100 examples, as many as fit in its 2,048-token context window. The paper found that scale improves this ability. Its 175-billion-parameter model performed many tasks from demonstrations alone, sometimes matching earlier fine-tuned systems.

On classification and multiple-choice tasks, the examples teach format more than correctness. [Min et al. (2022)](https://arxiv.org/abs/2202.12837) replaced the labels in demonstrations with random ones and found that performance barely dropped, across 12 models including GPT-3. What mattered was that the examples showed the label space, the distribution of input text, and the overall format. Choose examples that resemble real inputs and cover the full range of expected outputs.

## Few-shot vs zero-shot prompting

Zero-shot prompting gives the model only an instruction; few-shot prompting adds worked examples. Examples are the more reliable way to fix an output format, a tone, or a custom label set. They also cost input tokens on every request and can over-steer, since a model may copy surface features of the examples, such as their length or phrasing.

| | Zero-shot | Few-shot | [Fine-tuning](https://theaiengineering.com/glossary/fine-tuning) |
|---|---|---|---|
| What you provide | An instruction | An instruction plus examples | A training dataset |
| Weights change | No | No | Yes |
| Prompt length | Shortest | Grows with each example | Can shrink |
| Good fit | Clear, common tasks | Strict formats, custom labels | Behavior too complex to show in a prompt |

Anthropic's [prompting best practices](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices) recommend 3 to 5 examples that are relevant and diverse, wrapped in `<example>` tags so the model can tell them apart from instructions. A fixed block of examples sits at the same position in every request, which makes it a good candidate for [prompt caching](https://theaiengineering.com/glossary/prompt-caching).

[Reasoning models](https://theaiengineering.com/glossary/reasoning-model) change the default. OpenAI's [reasoning best practices](https://developers.openai.com/api/docs/guides/reasoning-best-practices) advise trying zero-shot first and adding examples only if needed, matched closely to the instructions. Anthropic notes that worked examples still shape how its models approach similar problems in their thinking.

The [LLM benchmarks guide](https://theaiengineering.com/articles/llm-benchmarks) lists prompt format, including few-shot examples, among the main reasons published scores disagree.

## Related terms

- [Prompt engineering](https://theaiengineering.com/glossary/prompt-engineering): Prompt engineering is the practice of designing the instructions, examples, and formatting given to a large language model so it produces accurate, consistent output for a task, without changing model weights.
- [System prompt](https://theaiengineering.com/glossary/system-prompt): A system prompt is the set of developer-written instructions sent to a language model ahead of the conversation, defining its role, rules, output format, and tool use for every turn that follows.
- [Chain-of-thought prompting](https://theaiengineering.com/glossary/chain-of-thought): Chain-of-thought prompting is a technique that has a language model write intermediate reasoning steps before its final answer, which improves large models' accuracy on arithmetic, commonsense, and symbolic reasoning tasks.
- [Fine-tuning](https://theaiengineering.com/glossary/fine-tuning): Fine-tuning is the process of further training a pretrained model on a smaller, task-specific dataset so its weights change to improve performance on a particular task, domain, style, or output format.
- [Reasoning model](https://theaiengineering.com/glossary/reasoning-model): A reasoning model is a large language model trained, usually with reinforcement learning, to generate intermediate reasoning tokens before its final answer, spending more inference compute to solve multi-step problems.
- [Prompt caching](https://theaiengineering.com/glossary/prompt-caching): Prompt caching is an LLM API and inference-server feature that stores the computed attention state for a repeated prompt prefix, so later requests sharing that prefix skip reprocessing it.

## Guides that cover few-shot prompting

- [AI engineer roadmap: skills, projects, and resources by stage](https://theaiengineering.com/articles/ai-engineer-roadmap): A practical AI engineer roadmap in seven stages, each with the skills to learn, a project to ship, and resources worth the time, from Python to production.
- [What is context engineering? A practical guide for AI agents](https://theaiengineering.com/articles/context-engineering): Context engineering is the practice of choosing what fills an LLM context window. Learn its components, why context rot happens, and how to measure results.
- [LLM benchmarks explained: what they measure and how to read them](https://theaiengineering.com/articles/llm-benchmarks): LLM benchmarks explained: what MMLU-Pro, GPQA, SWE-bench, LiveCodeBench, ARC-AGI, and LMArena measure, why scores saturate, and how to read a leaderboard.
- [LLM inference optimization: a practical guide for engineers](https://theaiengineering.com/articles/llm-inference-optimization): LLM inference optimization guide: prefill vs decode, TTFT, KV cache and PagedAttention, continuous batching, quantization, speculative decoding, and GPUs.
- [Reasoning models: how they work and when to use them](https://theaiengineering.com/articles/reasoning-models): Reasoning models explained: how test-time compute and reinforcement learning produce chain-of-thought reasoning, when to use them, and their cost and latency.
- [What is the Model Context Protocol (MCP)? How it works](https://theaiengineering.com/articles/what-is-model-context-protocol): The Model Context Protocol (MCP) is an open standard for connecting AI apps to tools and data. Learn its architecture, transports, tool calls, and security.
- [RAG vs fine-tuning: how to choose for your LLM application](https://theaiengineering.com/articles/rag-vs-fine-tuning): RAG vs fine-tuning: RAG adds knowledge at query time, while fine-tuning changes model behavior. Compare freshness, cost, latency, data needs, LoRA, and hybrids.
- [What are AI agents? How agents work and when to use one](https://theaiengineering.com/articles/what-are-ai-agents): AI agents are LLM systems that call tools in a loop until a task is done. Learn how the loop works, agents vs agentic AI, examples, failure modes, and limits.

Part of the [Prompt and context engineering](https://theaiengineering.com/topics/prompt-engineering) topic hub.

## Cite this definition

The AI Engineering Editors. "What is few-shot prompting? Few-shot vs zero-shot." The AI Engineering, updated Nov 06, 2026. https://theaiengineering.com/glossary/few-shot-prompting

- Title: What is few-shot prompting? Few-shot vs zero-shot
- Author: The AI Engineering Editors
- Publisher: The AI Engineering
- Updated: 2026-11-06
- URL: https://theaiengineering.com/glossary/few-shot-prompting
- Markdown: https://theaiengineering.com/glossary/few-shot-prompting.md
