85 agentic tools audited for security incidents · Talk to the lab →
MotionticBook a call
Glossary

What is few-shot prompting?

Few-shot prompting is the technique of including a small number of worked input and output examples in a prompt so a language model infers the task, format and tone from them, without any change to its weights.

The term was set by OpenAI's GPT-3 paper, "Language Models are Few-Shot Learners" (Brown and colleagues, May 2020). It showed a 175-billion-parameter model doing new tasks from demonstrations given purely as text, with no gradient updates, and compared zero-shot (instructions only), one-shot and few-shot settings.

The technique is still one of the most reliable ways to control output. Anthropic's current prompting guidance calls examples one of the most reliable ways to steer format, tone and structure, and recommends three to five of them.

What makes examples work

  • Relevant

    Examples should mirror the real inputs the system will see, not textbook cases.

  • Diverse

    Anthropic's guidance warns that examples which are too alike teach unintended patterns. Vary length, edge cases and the shape of the answer.

  • Clearly marked

    Wrapping each one in example tags keeps the model from confusing examples with instructions or with the live input.

  • Canonical, not exhaustive

    Anthropic's "Effective context engineering" (September 2025) advises a few diverse, canonical examples rather than a long list of edge cases stuffed into the prompt.

Examples in agents

The same idea applies to tools. Anthropic's "Introducing advanced tool use" (November 2025) adds tool use examples to tool definitions, to teach conventions that a JSON schema cannot express, such as which optional fields to fill together or how IDs are formatted.

Examples also work with reasoning models. Anthropic's guidance notes that worked examples shape how the model approaches similar problems in its own thinking, and suggests presenting each one as the problem, the method and the expected answer.

Where few-shot prompting fails

  • Copying surface features

    The model mimics the length, wording or order of the examples when that was never the point.

  • Token cost

    Examples are resent on every call. Prompt caching softens this, but long examples still use the context window.

  • Leaking into evals

    If the same cases appear in the prompt and in the eval set, scores look better than real performance.

  • A ceiling

    When a format or skill needs more examples than a prompt can reasonably hold, fine-tuning or a different design may be the next step.

How Motiontic's engineers apply it

Motiontic's engineers draw prompt examples from the client's real cases, keep them separate from the golden dataset used for evals, and test each example set against the eval suite, because a single bad example can move results more than a paragraph of instructions.

Zero-shot, few-shot and fine-tuning

Zero-shot, few-shot and fine-tuning
Zero-shotFew-shotFine-tuning
What the model getsInstructions onlyInstructions plus a few examplesTraining on many examples
Changes the weightsNoNoYes
Time to tryMinutesMinutesData preparation and training runs
Cost per callLowestHigher, examples are resentLower prompts, plus training cost
FitsClear, common tasksA specific format or toneFixed behaviour at high volume

Common questions

What is few-shot prompting?

Including a handful of example inputs and outputs in a prompt so the model copies the task, format and tone, without retraining the model.

How many examples should a few-shot prompt have?

Anthropic's guidance suggests three to five well-chosen, varied examples. More can help on unusual formats, but each one adds tokens to every call.

What is the difference between zero-shot and few-shot prompting?

Zero-shot gives the model instructions only. Few-shot adds worked examples, which usually makes format and tone more consistent.

Is few-shot prompting the same as fine-tuning?

No. Few-shot examples live in the prompt and change nothing about the model. Fine-tuning trains the model on examples and changes its weights.

Running agents that have to hold up?

Describe the agent, the systems it touches and what it must never get wrong. The first call is with a lab engineer, who will say plainly whether it is ready for production, and whether Motiontic is the right team.