Few-shot prompting is the practice of placing a small number of worked examples inside the input sent to a large language model (LLM), so that the model infers the task from the pattern rather than from retraining. Each example, called a shot or a demonstration, pairs an input with the output its author wants. The model reads the examples and then completes one final, unanswered input in the same manner. Its parameters stay frozen; the examples shape only the response that follows and vanish when the call ends.

The technique exists because the alternative was expensive. Adapting a model to a new task used to mean fine-tuning it on thousands of labelled examples, work that demanded machine learning staff and compute. Few-shot prompting moved that adaptation into plain text, which is why it remains a standard lever for anyone who can shape a model's input but cannot retrain or fine-tune it.

How a few-shot prompt is built

A few-shot prompt has four parts, usually in this order: an optional instruction, the examples, the new input, and an open slot where the answer belongs. An illustrative prompt for sorting search queries by intent might read:

Classify each search query as transactional, informational or navigational.
Query: cheap running shoes sale - Intent: transactional
Query: how to clean suede trainers - Intent: informational
Query: zalando returns login - Intent: navigational
Query: best trail shoes for wide feet - Intent:

The model is expected to supply one of the three labels in the format shown. The terminology is a count. A prompt with none is zero-shot, one with a single example is one-shot, and one with several is few-shot. OpenAI's GPT-3 paper fixed those conventions in 2020, defining few-shot as allowing as many demonstrations as fit the model's context window, typically 10 to 100. The ceiling was physical rather than theoretical: GPT-3 accepted 2,048 tokens in total, so K, the paper's symbol for the number of examples, was bounded by length.

Current vendor guidance asks for far fewer. Anthropic's documentation for Claude, as of September 2026, advises three to five examples that are relevant and varied, wrapped in example tags so the model can distinguish them from instructions. A September 2024 Google whitepaper by Lee Boonstra gives the same rule of thumb.

Examples can be fixed or chosen per request. Static prompts reuse one set; dynamic selection retrieves, for each new input, the most similar stored examples. Jiachang Liu and colleagues proposed that approach in January 2021 after finding that GPT-3's results depended heavily on which examples were picked; according to their paper, retrieval of semantically similar examples consistently beat random selection.

Every example is billed. Demonstrations are converted into tokens and charged as input on each call, so a five-example block is paid for on every classification. Prompt caching, added by Anthropic in August 2024 and by OpenAI two months later, discounts a repeated prefix, which favours a static example block over one assembled afresh for each request.

From computer vision to GPT-3

The word shot came from image recognition. Li Fei-Fei, Rob Fergus and Pietro Perona published "One-shot learning of object categories" in IEEE Transactions on Pattern Analysis and Machine Intelligence in April 2006, arguing that reusing knowledge of previously learned categories let a model learn a new one from one or a handful of images, where conventional methods needed hundreds or thousands.

GPT-3 changed the meaning. Tom Brown and 30 co-authors at OpenAI posted "Language Models are Few-Shot Learners" on May 28, 2020, describing a 175 billion parameter model tested without any weight updates. The paper treated few-shot learning and in-context learning as the same setting, and reported gains with more examples and far larger gains with model size. A shot was no longer a training sample. It was text in the prompt.

Tony Zhao, Eric Wallace and colleagues showed in February 2021 that the choice of format, the examples themselves and even their order could move GPT-3's accuracy from near chance to near state of the art; their contextual calibration method lifted average accuracy by up to 30 percentage points. Jason Wei and colleagues at Google posted chain-of-thought prompting on January 28, 2022, placing intermediate reasoning inside each demonstration. Eight such exemplars took the 540 billion parameter PaLM model to state of the art on the GSM8K maths benchmark.

Longer context windows then stretched the idea. Rishabh Agarwal and colleagues at Google DeepMind described many-shot in-context learning in April 2024, using Gemini 1.5 Pro's window of 1 million tokens to test up to 8,192 examples, reporting significant gains over few-shot prompting.

Reasoning models reversed part of the advice. OpenAI's guidance for its o-series models, published by February 2025, recommends trying zero-shot first because such models often do not need examples. DeepSeek went further in its R1 paper, published in Nature on September 17, 2025, reporting that few-shot prompting consistently degraded the model and recommending zero-shot prompts that state the problem and output format directly.

Why marketers encounter it

Many marketing uses of LLMs are labelling and formatting jobs where consistency matters more than invention: tagging search terms, classifying pages against a taxonomy, extracting attributes from product feeds, writing variants in a house style. According to Google's Gemini API documentation, few-shot prompts are often used to regulate the formatting, phrasing, scope and general patterning of responses.

Content classification is the clearest ad tech case. Amazon's contextual targeting system combined human annotators with conversational agents and tenet-based chain-of-thought prompting, a hybrid the company said was 25% more accurate than crowd-sourced annotation. Scale is the difficulty. IAB Content Taxonomy 3.1 carries more than 1,500 categories, and one argument that AI ad agents need taxonomy IDs rather than natural language rests on the gap between deterministic matching and probabilistic inference. Five demonstrations cannot illustrate 1,500 labels.

Advertising platforms mostly expose instructions rather than demonstrations. Google's text guidelines for Performance Max and AI Max, introduced on September 10, 2025, accept up to 25 term exclusions and 40 natural-language messaging restrictions, and the beta went global on February 26, 2026AI Brief, launched on April 30, 2026, lets advertisers steer AI Max with plain-text rules. Each asks for rules, not sample outputs; demonstrations remain the domain of teams building their own tools. Anthropic's free prompt engineering course teaches few-shot learning alongside role prompting.

Where it fails

Few-shot prompts are fragile. Zhao and colleagues identified majority label bias, where an unbalanced set of examples skews predictions, and recency bias, where a prompt ending with two negative examples leans negative. A model also favours answers common in its pre-training data.

What the examples actually teach is disputed. Sewon Min and colleagues reported in February 2022 that replacing correct labels with random ones barely hurt performance across 12 models, including GPT-3, concluding that demonstrations work by showing the label space, the input distribution and the format. Kang Min Yoo and colleagues challenged that finding later in 2022 in "Ground-truth labels matter"; according to a summary from the Hanyang University NLP lab, the original result held mainly under verbose templates and smaller models. Both positions remain cited.

Vendor guidance conflicts as well. Google's Gemini API documentation, as of September 2026, recommends always including few-shot examples and says prompts without them are likely to be less effective. Google Cloud's documentation warns that too many examples can make a model overfit. OpenAI and DeepSeek point the other way for reasoning models, and according to a PromptHub summary, Microsoft researchers found few-shot prompting degraded o1-preview in medical benchmarks. Anthropic's context engineering guidance, published on September 29, 2025, takes a middle position, starting from a minimal prompt and adding instructions and examples only as failures appear.

Demonstrations are also an attack surface. Anthropic disclosed many-shot jailbreaking on April 2, 2024: an attacker fills the prompt with faux dialogues in which an assistant complies with harmful requests. According to the paper, the attack failed with 5 shots and worked consistently with 256, and hardening models through fine-tuning raised the number of shots required without changing the scaling pattern.

Not the same as

Fine-tuning updates a model's weights with a training dataset and persists across calls. Few-shot prompting changes only one input. Google's tuning documentation recommends starting with prompting and fine-tuning only if needed.

Few-shot learning in its pre-2020 sense means training a model on scarce data, the meaning Fei-Fei and colleagues used.

Chain-of-thought prompting concerns what the output contains, not how many examples precede it. It can be few-shot, as in Wei's paper, or zero-shot, as in the phrase "Let's think step by step" tested by Takeshi Kojima and colleagues in 2022.

Example prompts published by vendors, such as the five query patterns Microsoft released for Clarity on August 18, 2026 or SISTRIX's platform-specific prompt examples, are templates for people to copy, not demonstrations inside a model's input.

Recent developments

The unit of work has widened from prompt to context. Industry commentary in mid-2025 held that context quality determines agent reliability more than model sophistication, and in agent systems examples now compete for window space with tool definitions, retrieved documents and conversation history.

Privacy is the newest pressure. A study whose second version was posted on September 15, 2026 passed questions, along with any few-shot examples in the prompt, through an anonymizer across five models and 6,210 samples, finding modest losses on reasoning tasks and a collapse on retrieval. Demonstrations drawn from customer records carry personal data into every call. Whether examples stay necessary at all, as reasoning models absorb what demonstrations once supplied, is unresolved.

Timeline

  • April 2006: Li Fei-Fei, Rob Fergus and Pietro Perona publish "One-shot learning of object categories" in IEEE TPAMI
  • May 28, 2020: OpenAI posts "Language Models are Few-Shot Learners", defining zero-shot, one-shot and few-shot prompting for GPT-3
  • January 17, 2021: Jiachang Liu and colleagues propose retrieving semantically similar in-context examples
  • February 2021: Tony Zhao and colleagues publish "Calibrate Before Use", documenting majority label and recency biases
  • January 28, 2022: Jason Wei and colleagues post chain-of-thought prompting, using eight exemplars on GSM8K
  • February 25, 2022: Sewon Min and colleagues report that random demonstration labels barely hurt performance
  • 2022: Kang Min Yoo and colleagues publish "Ground-truth labels matter", contesting the random-label finding
  • April 2, 2024: Anthropic discloses many-shot jailbreaking, tested with up to 256 faux dialogues
  • April 2024: Google DeepMind describes many-shot in-context learning with up to 8,192 examples
  • September 2024: Lee Boonstra's Google prompt engineering whitepaper recommends at least three to five examples
  • February 2025: OpenAI guidance advises trying zero-shot first with reasoning models
  • September 10, 2025: Google introduces text guidelines for Performance Max and AI Max
  • September 17, 2025: DeepSeek-R1 paper published in Nature, reporting that few-shot prompting degrades the model
  • September 29, 2025: Anthropic frames context engineering as the successor to prompt engineering
  • February 26, 2026: Google text guidelines go global
  • April 30, 2026: Google launches AI Brief for plain-text steering of AI Max
  • September 15, 2026: Second version of a study on anonymized prompts and few-shot examples posted to arXiv

Summary

Who. Model providers including OpenAI, Google, Anthropic and DeepSeek publish the guidance and train the models that respond to examples. Agency teams, ad tech vendors, publishers and verification firms write few-shot prompts inside their own classification, extraction and copy tools. Academic researchers continue to test what demonstrations actually teach.

What. Few-shot prompting places a small number of input-output examples in a model's prompt so the model infers the task, label set and format without any change to its weights. Zero-shot uses no examples, one-shot uses one, and many-shot extends the method to hundreds or thousands.

When. The word shot dates to computer vision work published in 2006. The prompting sense was defined by OpenAI's GPT-3 paper on May 28, 2020, refined through calibration and chain-of-thought research in 2021 and 2022, extended to many-shot in 2024, and qualified by reasoning-model guidance in 2025.

Where. Inside the input to any LLM call: chat interfaces, APIs, agent frameworks and the internal tools marketers build on them. Advertising platforms themselves mostly accept instructions rather than demonstrations.

Why. Examples are the cheapest way to make a model's output consistent without retraining it. They are also fragile, billed on every call, contested in what they teach, exploitable at scale, and possibly unnecessary for the newest reasoning models.