Few-shot examples

Few-shot examples are input-output demonstrations supplied in model context so the model can infer desired task, style, and format patterns without changing model weights. Each exemplar demonstrates one behavior or failure-mode response, a common case, an ambiguous input, missing data, a refusal, a formatting rule, or a tool-use decision, with an explicit input/output boundary and a coverage role. They are runtime behavior controls with token, latency, maintenance, and privacy costs, proven by eval comparison and ablation rather than by count: they demonstrate how to answer, they do not supply fresh facts (retrieval), enforce machine contracts (structured outputs), retrain the model (fine-tuning), or substitute for system-level safety controls.

When to use it

  • The task is ambiguous or format-strict, tone, field interpretation, refusal shape, or fallback wording, and sharper instructions alone do not produce the pattern reliably.
  • Specific failure modes recur, ambiguous requests, missing data, out-of-scope questions, unsafe requests, and each can be captured as a labeled demonstration of the correct response.
  • A new AI-powered flow needs a cheap runtime baseline before investing in heavier levers such as retrieval pipelines, schema enforcement, or model adaptation.
  • Exemplar changes can be paired with representative eval cases and versioned review, so each example must earn its token cost against a with-versus-without comparison.
  • The failure diagnosis points at missing behavioral demonstration, the model does not map inputs to the desired pattern, not at missing facts, stale retrieval, tool schemas, or model capability.

PM decision impact

The PM owns the exemplar-set contract: the target behavior each example teaches, the failure mode it covers, its input/output boundary, its token contribution, its eval contribution, its owner and version, its privacy review, and when it is removed. Engineering owns prompt implementation in code, schema and tool integration, and eval infrastructure; trust and safety own policy and refusal requirements. The PM decides the smallest set that measurably covers needed behaviors, and routes missing-facts problems to retrieval, machine-contract problems to schemas, capability gaps to model or architecture choices, and governance of the resulting assets to the prompt library.

How to do it

Define the target behavior and the failure modes that matter, then choose the smallest set of candidate exemplars that covers them, preferring one distinct coverage role per example over near-duplicate happy paths. Label each example with its coverage role, keep inputs realistic but anonymized or synthetic, keep outputs correct and format-consistent, and check for contradictions across examples before shipping. Compare quality with and without each example on representative eval cases, ablate exemplars that no longer move results, track token and latency cost per example, and revalidate the set on event-driven triggers, policy, schema, tool, model, or tone changes, rather than on a calendar schedule.

Example

Synthetic example, hypothetical scenario, not measured results. A support copilot answers billing questions without inventing policy. The set carries four exemplars, each with a coverage role: a common refund question (common case), an ambiguous account state (ask-or-escalate instead of guessing), a prohibited promise such as a guaranteed refund (refusal plus redirection), and an incomplete request missing the account identifier (missing-data behavior). A later eval comparison shows the missing-data exemplar changes missing-data handling while a fifth near-duplicate happy-path exemplar changes nothing, so the team keeps the former and removes the latter.

Common mistakes

  • Treating a fixed count as a rule: a universal 3–6 prescription confuses quantity with coverage, near-duplicate happy paths add tokens without adding behavior.
  • Assuming more examples always improve quality: unhelpful, contradictory, or stale exemplars can narrow outputs, leak example details, or override current intent.
  • Leaving stale examples live after UI labels, pricing tiers, policies, schemas, tools, or brand tone change, the model follows the stale demonstration literally.
  • Pasting real customer conversations or production data into prompts for realism instead of using anonymized or synthetic-but-realistic exemplars with a privacy review.
  • Showing a bad output with no label or contrast and expecting the model to infer the correction, negative examples need an explicit what-to-do-instead.
  • Using examples as a substitute for the correct control: schema enforcement for machine contracts, retrieval for fresh facts, permissions and guardrails for safety.

Related terms

Learn it in CraftUp

Last updated: September 23, 2026

The exemplar set design & coverage lab

This is the operating worksheet for the page: nine steps that turn “add a few examples” into an inspectable coverage contract. Work it top to bottom for one behavior; statuses use text labels, never color alone.

  1. Define target behavior: one sentence stating what the model must do, and what it must never do, for this task.
  2. List intents and failure modes: common case, ambiguous input, missing data, refusal or out-of-scope, formatting, locale or tone, tool use, safety boundary, long input, multi-turn context. Keep only the ones this task actually faces.
  3. Add candidate exemplars: short, realistic, anonymized or synthetic inputs with correct, format-consistent outputs, one candidate per behavior you need to teach.
  4. Tag each exemplar by coverage role: which single behavior or failure mode does this example own? An example without a role is decoration.
  5. Flag duplication, contradiction, and sensitive data: near-duplicates merge or go; conflicting patterns (tone, format, field names, refusal behavior) resolve to one policy before shipping; real customer data never ships.
  6. Estimate token contribution: record each exemplar's share of the prompt so cost and latency trade-offs are visible per example, not just per prompt.
  7. Link exemplars to eval cases: every coverage role gets at least one representative eval case that fails without its exemplar.
  8. Compare with versus without: run the baseline, add the example, rerun, inspect target-case improvement, regressions elsewhere, and cost.
  9. Decide keep, revise, or remove: an exemplar stays only if its removal would bring a failure back at a token cost worth paying. Record owner, version, and last-validated date.

Deterministic by design: no model call is needed to run the lab. The eval-comparison step uses whatever harness the team already has, execution and grading live with the evaluation harness, not inside this worksheet.

The example coverage matrix

Rows are exemplars; columns are the behaviors a Product team usually needs to cover. Mark each cell teaches, reinforces, or out of scope, in text. A healthy set covers distinct columns with few exemplars; ten checks in the happy-path column and none in refusal or missing-data is the classic failure this matrix exists to expose.

ExemplarCommon intentAmbiguous inputMissing dataRefusal / out-of-scopeFormattingTool use
Common refund questionteachesout of scopeout of scopeout of scopereinforcesout of scope
Ambiguous account stateout of scopeteachesreinforcesout of scopeout of scopeout of scope
Prohibited promiseout of scopeout of scopeout of scopeteachesreinforcesout of scope
Incomplete requestout of scopereinforcesteachesout of scopeout of scopeout of scope

Coverage categories are a menu, not a mandate: locale or tone, localization, unsafe requests, long inputs, and multi-turn context join the matrix only when the task faces them. Small models and strict formats often need more formatting coverage; support flows need more refusal and missing-data coverage. Let the failure modes choose the columns.

The example ablation decision card

One card per exemplar, reviewed whenever the set changes. If a reviewer cannot answer each row, the example's place in the set is unproven.

Behavior it teaches
The single coverage role: which input pattern maps to which output pattern, and which eval case fails without it.
What changes when removed
The ablation result: target-case delta, regressions elsewhere, and the eval set, version, date, and model behind the claim.
Token and latency cost
The exemplar's share of prompt tokens plus its measured latency contribution on the deployed combination.
Maintenance and privacy risk
What breaks when policy, schema, tools, models, or tone change, plus anonymization status, owner, version, and last-validated date.
Decision
Keep, revise, or remove, with the reason recorded so the next reviewer does not relitigate it.

Ablation is practical discipline, not causal proof: it answers “is this example still earning its place on current traffic?”, not a universal claim about the example's truth across all distributions.

Worked example: support copilot that must not invent policy

Hypothetical scenario with illustrative structure, not measured results. Goal: answer billing questions without inventing policy. Four exemplars, each owning one coverage role:

ExemplarCoverage roleWhat it teaches
Common refund questionCommon caseAnswer shape: short grounded answer citing the supplied policy excerpt, no invented details.
Ambiguous account stateAmbiguity handlingAsk for the missing distinguishing fact or escalate instead of guessing between two plan states.
Prohibited promiseRefusal + redirectionDecline the guaranteed-refund promise, state what is possible, offer a human review path.
Incomplete requestMissing-data behaviorRequest the account identifier explicitly rather than answering generically.

Why four near-duplicate happy-path examples would be weaker: they would all land in the first row's column, adding tokens without teaching ambiguity, refusal, or missing-data behavior, the exact failures billing support faces. Testing the set means one eval case per row that fails when its exemplar is removed, plus a leakage check for verbatim overlap with example phrasing and entity reuse.

Worked example: structured PRD extraction, schema vs examples

Hypothetical scenario with illustrative structure, not measured results. Goal: extract problem, evidence, non-goals, and open questions from PRD prose into four fields. The boundary is clean: the schema enforces the fields, names, types, required status, while examples clarify what counts as evidence versus assumption. One exemplar shows a metrics claim with a cited source mapped to evidence; a second shows an identical-sounding claim with no source mapped to assumption plus an open question. Without the schema, examples alone cannot guarantee machine-readable shape; without the examples, the schema cannot teach semantic judgment. Route shape guarantees to structured outputs; keep meaning calibration here.

Worked example: the stale-pricing regression

Hypothetical scenario with illustrative structure, not measured results. An old exemplar contains a deprecated pricing tier. After a pricing change, the new model follows the stale demonstration too literally, quoting the retired tier confidently, even though the current instructions state the new tiers. The lesson: examples are live Product assets that can override current intent, so they need ownership, versions, eval cases that would catch the drift, and event-driven review triggers (policy, schema, tool, model, or tone changes). Deprecation with a replacement belongs to the prompt library; detecting that the exemplar went stale belongs here, in the ablation card's maintenance row.

Worked example: the ablation that pays for itself

Hypothetical scenario with illustrative structure, not measured results. Three exemplars, common case, missing data, refusal, each linked to eval cases. Removing the common-case example changes nothing: the instructions already carry the pattern, so the team removes it and reclaims its tokens. Removing the missing-data example brings the missing-data failure straight back, so the team keeps it and records the ablation result on its card. Expected Product decision: keep the missing-data and refusal exemplars, drop the redundant common case, and spend the saved budget on the next uncovered failure mode. No benchmark numbers are claimed; the decision logic is the asset.

Exemplar quality rules

Review each exemplar for

  • Realism and relevance: mirrors real inputs at representative difficulty, not the easiest demonstration available.
  • Correctness and output quality: the output is the response you want repeated, with consistent format, field names, and refusal shape.
  • Privacy: anonymized or synthetic-but-realistic, data-minimized, with logging and provider-handling boundaries checked.
  • Coverage role: exactly one owned behavior or failure mode, recorded on the card, no role, no ship.
  • Compatibility: consistent with current instructions, policy, schema, tools, and the deployed model combination.

No aggregate score is computed: descriptive checks beat an arbitrary number that invites gaming.

Positive vs negative examples

Negative examples, demonstrations of what not to do, can help when paired with an explicit labeled contrast showing what to do instead. Never ship a bare bad output and expect the model to infer the correction, and never assume all providers and models interpret negative demonstrations identically: verify on your deployed combination.

Contradictions

Conflicting exemplars, divergent tone, formatting, field names, refusal behavior, or policy, do not average out; they resolve by accident. More examples never fix inconsistent Product policy: reconcile the conflict first, then encode one answer in the set.

Order and similarity

Order can matter in some contexts and models, and similar-versus-diverse selection serves different mechanisms (fit vs coverage vs resemblance to the current request), but neither direction is a universal law. Anthropic's current guidance suggests relevant, diverse examples wrapped in <example> tags inside <examples>, with a starting tip of 3–5 that must be validated rather than obeyed; OpenAI's current guide shows diverse input/output pairs placed in the developer message with XML or Markdown boundaries. Treat every such recommendation as attributed and model-dependent, pin what your evals confirm, and record it on the card.

Static vs dynamic selection

A static set is predictable, reviewable, versionable, and stable in token cost. Dynamically retrieving the most similar exemplars per request can improve fit but adds retrieval complexity, per-request behavior variance, and provenance requirements. Do not build a retrieval system inside this page: when dynamic selection is on the table, route its architecture to context engineering and retrieval-augmented generation.

Token, staleness, and privacy contract

Token, latency, and cost

Every exemplar consumes context on every request: more tokens, more latency, higher provider cost, and less room for user data and retrieved context. Long-context placement also matters, current provider guidance favors stable reusable content early (which can interact with prompt-caching behavior depending on provider and runtime) and query-specific material late. Prefer decision logic over price tables: no vendor pricing is frozen here because it would be stale on arrival. Size the set against the token budget and the workflow latency SLO, per exemplar.

Staleness and ownership

Exemplars drift when UI labels, policies, schemas, tools, model behavior, regulatory requirements, or brand tone change. Ownership plus event-driven review triggers, not calendar rotation, keeps the set current: each change class names which cards get revalidated, and governance of versions and deprecation lives with the prompt library. Re-evaluate the whole set on every model migration.

Leakage and copy risk

Exemplars can cause phrase copying, entity reuse, stale-name carryover, accidental disclosure, and style overfitting. Test for verbatim overlap, invented reuse of example details, and unsafe carryover, without claiming exact memorization probabilities the evidence does not support.

Privacy and synthetic data

Keep sensitive customer conversations out of prompts; use anonymized or synthetic-but-realistic exemplars, minimize data, and check logging and provider data-handling boundaries, this page makes no legal-compliance claims. Synthetic examples cover edge cases and privacy needs but can encode unrealistic assumptions and create circular evals when the same system generates and grades them: every synthetic exemplar gets human review. Route redaction mechanics to PII redaction and leak containment to data leakage.

Safety and localization notes

Exemplars can demonstrate allowed answers, refusals, redirections, and escalation, but safety policy lives in the system layer, permissions, and guardrails, never in examples alone. Translated exemplars do not preserve behavior automatically: evaluate per locale. Tool-use demonstrations (when to call, how to fill arguments, when not to call) stay illustrative here; interface truth lives with tool instructions.

What few-shot examples are not

These adjacent concepts overlap with demonstrations. The table states the boundary so this page does not absorb their jobs, each links to its specialist owner.

ConceptIts jobBoundary
Prompt engineeringThe discipline of designing and testing instructionsFew-shot is one technique inside that discipline; method, iteration, and technique selection live there.
Prompt templateReusable parameterized structure with variables and renderingExamples may live inside templates as versioned fixtures; structure, variables, escaping, and rendering live with the template owner.
Prompt libraryGovernance of reusable prompt assetsA library may store exemplar sets; discovery, ownership, versioning, and deprecation live there, design of the set itself lives here.
Structured outputsSchema-constrained, machine-readable response contractsSchemas enforce shape; examples teach field semantics and content quality. Never use prose demonstrations as a shape guarantee.
Tool instructionsWhen and how the model may call toolsExamples may demonstrate tool use, but interface design, permissions, and authorization live outside any demonstration.
Retrieval-augmented generationSupplying current, task-specific factsRetrieval answers with fresh facts; examples demonstrate how to answer. Never smuggle stale knowledge into exemplars.
Evaluation harnessTest execution, datasets, rubrics, regression comparisonThe harness runs and grades with-versus-without and ablation comparisons; deciding what each exemplar must prove lives here.

Fine-tuning has no glossary owner in the current inventory: the boundary is stated in the definition and FAQ (runtime context vs training) without inventing an owner link. Zero-shot and one-shot are modes of this same technique, defined on this page, not separate owners.

Common failure modes

  • Magic-count compliance: hitting 3–6 or any fixed number while covering only the happy path, tokens spent, failures untaught.
  • Contradictory exemplars: conflicting tone, format, field names, or refusal behavior that resolves by accident instead of by policy.
  • Stale demonstrations: retired tiers, renamed fields, or changed policies quoted confidently because the example outranks current intent.
  • Leakage and overfitting: verbatim phrase copying, example-entity reuse, style narrowing, untested because nobody checked overlap.
  • Wrong control: facts that belong in retrieval, shapes that belong in schemas, and safety that belongs in guardrails, all duct-taped with prose examples.
  • Unevaluated bulk: a growing set nobody ablates, where each addition is assumed helpful and none is ever removed.
  • Privacy shortcut: real production conversations pasted for realism, logged and retained beyond their review.

PM exemplar-set checklist

Coverage

  • Target behavior written down, what the model must do and must never do?
  • Every exemplar owns exactly one coverage role; near-duplicates merged or removed?
  • Failure modes (ambiguous, missing-data, refusal, formatting, tool-use) covered where the task faces them?

Evidence

  • With-versus-without comparison run on representative cases, improvement plus no regressions?
  • Ablation recorded per exemplar, removal brings the failure back, or the example goes?
  • Order and similarity choices pinned only where evals confirm they move results?

Cost and care

  • Token and latency contribution visible per exemplar, inside the token budget and latency SLO?
  • Anonymized or synthetic exemplars with privacy review, no production PII, logging checked?
  • Owner, version, and last-validated date recorded; event-driven triggers (not calendar rotation) arm revalidation?

Boundaries

  • Shape guarantees routed to schemas, fresh facts to retrieval, asset governance to the library, safety to guardrails?
  • Whole set flagged for re-evaluation on the next model migration?

Few-shot examples FAQ

What is few-shot prompting?

Few-shot prompting supplies input-output demonstrations in model context so the model can infer desired task, style, and format patterns without changing model weights. Each exemplar demonstrates one behavior or failure-mode response with an explicit input/output boundary and a coverage role, it is a runtime behavior control, not training.

How many examples should I include?

There is no universal count: use the smallest set that measurably covers the behaviors and failure modes you care about, then verify with evals. Ten near-duplicate happy-path examples usually add less value than a smaller set covering distinct cases, common, ambiguous, missing-data, refusal, formatting, and tool-use, each proven by a with-versus-without comparison and an ablation check.

Is one-shot the same as few-shot?

One-shot is the single-example special case; few-shot uses several demonstrations; zero-shot uses instructions alone with no examples. None is categorically better: the right mode depends on model capability, task ambiguity, format strictness, edge-case coverage, context budget, cost and latency, maintenance burden, and eval evidence.

Do more examples always improve output?

No. Unhelpful, contradictory, or stale exemplars can narrow outputs, leak example details into answers, or override current intent, while always consuming tokens. Every example should earn its place through measured improvement on its target cases without regressions elsewhere.

Does example order matter?

Order can matter in some contexts and models, recency and position effects are reported in the literature, but no single ordering rule holds universally. Treat ordering as an eval-backed Product choice on your deployed model combination: if reordering moves results, pin the order and record it; if it does not, do not enshrine a placement ritual.

Should examples be similar or diverse?

Both pressures are real: similar examples improve task fit, diverse examples improve coverage. The Product question is which mechanism each exemplar serves, common-case fit, failure-mode coverage, or resemblance to the current request, and a set chosen only for similarity usually under-covers failures while a set chosen only for diversity can dilute the core pattern.

What is the difference between few-shot prompting and fine-tuning?

Few-shot examples are runtime context: cheap to change, easy to version, paid for on every request in tokens and latency, and they do not change model weights or guarantee generalization. Fine-tuning changes model behavior through training: stronger for stable high-volume patterns but heavier to build, evaluate, and maintain. Route stable, high-volume, latency-sensitive patterns toward fine-tuning only with current provider guidance and eval evidence, never assume one always replaces the other.

When should I use few-shot examples vs RAG?

Ask whether the model needs an example of how to answer or fresh facts to answer with. Demonstrations of desired behavior belong to few-shot examples; current or task-specific knowledge belongs to retrieval. Do not smuggle stale facts into exemplars that should come from a permissioned, fresh corpus.

Can examples replace structured outputs?

No. When downstream systems parse the output, a native schema mechanism plus validation is the contract that guarantees machine-readable shape; examples teach field semantics and content quality inside that shape, for instance, a schema enforces a risk_level enum while examples teach what evidence maps to each label.

Can examples contain real customer data?

Do not paste real sensitive customer conversations into prompts for realism. Prefer anonymized or synthetic-but-realistic exemplars with a privacy review, minimize data, and check logging and provider data-handling boundaries. Synthetic examples still need human review: they can encode unrealistic assumptions and create circular evals when generated by the same system they test.

How do I know whether an example helps?

Compare quality with and without it on representative eval cases, inspect target-case improvement and regressions elsewhere, and measure token and latency cost. Then ablate: remove one exemplar, rerun the relevant evals, and keep only examples whose removal would bring the failure back. One offline metric never captures full Product quality.

Do few-shot examples work the same across models?

No. A set that works on one model may be unnecessary, behave differently, cost too much, or conflict with new native capabilities on another. Treat every model upgrade or migration as a re-evaluation trigger for the whole exemplar set, examples are not model-agnostic product policy.

For the broader instruction-design discipline, see prompt engineering; for reusable parameterized structure, see prompt template; and for governance of exemplar sets as assets, see prompt library. For hands-on prompting workflows, continue to Prompt engineering for PMs , that guide owns tutorial workflows; this page owns the entity reference. For the broader AI product picture, see the AI Product Management hub.

Download App

Ready to become a better product manager?

Build your product skills with short, practical lessons you can fit around your day.
Start with our free courses and upgrade anytime.

CraftUp mobile app preview