---
title: "What is few-shot prompting? Examples in the prompt | BroadRouter"
description: "Few-shot prompting puts a handful of worked examples in the prompt so the model copies the pattern. How it works, how many examples to use, and what they cost."
url: https://broadrouter.com/glossary/few-shot-prompting/
lang: en
updated: 2026-11-16
publisher: BroadRouter (a BroadNet site); API by BroadNet Inference, https://inference.broadnet.ai
---

# Few-shot prompting

Updated 2026-11-16

Few-shot prompting is a technique in which a prompt includes a small number of worked input-output examples before the real input, so a language model infers the task and format from them. The model's weights do not change; zero-shot uses no examples and one-shot uses one.

Also called: few-shot learning, multishot prompting, in-context examples, one-shot prompting

Showing beats telling. A few examples often fix format and tone faster than a paragraph of rules.

## How it works

The GPT-3 paper by Brown and colleagues made the term common. It tested a 175-billion-parameter model with tasks “specified purely via text interaction with the model”, with no gradient updates or fine-tuning, and found that few-shot performance improved strongly with model size. The paper defines three settings:

| Setting | Examples in the prompt |
| --- | --- |
| Zero-shot | none, only an instruction |
| One-shot | one |
| Few-shot | several, limited by the context window |

A few-shot prompt for labelling support tickets might look like this:

```text
Ticket: "My card was charged twice." -> billing
Ticket: "The app crashes on login." -> bug
Ticket: "Can you add dark mode?" -> feature_request
Ticket: "I was billed after cancelling." ->
```

The model continues the pattern. Anthropic’s guide calls examples “one of the most reliable ways to steer” format, tone and structure, and asks that they be relevant, diverse and wrapped in tags so the model can tell them apart from instructions.

## Why it matters

-   **Format control.** Examples show edge cases that rules miss, such as how to write an empty field. For strict JSON, pair them with [structured output](https://broadrouter.com/glossary/structured-output/).
-   **Cost.** Every example is resent as input on every call. Five 200-token examples add 1,000 tokens per request. Placed in a fixed prefix, they can be billed as [cached input tokens](https://broadrouter.com/glossary/cached-input-tokens/).
-   **Reasoning.** Examples that show the steps, not just the answer, are [chain-of-thought](https://broadrouter.com/glossary/chain-of-thought/) prompting.
-   **When to stop.** If you need hundreds of examples, [fine-tuning](https://broadrouter.com/glossary/fine-tuning/) may be cheaper per call than sending them every time.

## On BroadNet Inference

Few-shot prompting needs no special API feature; it is plain text in `messages`. BroadNet reports `cached_tokens` in `usage`, so you can check whether your example block is being read from cache. On a PAYG key the cached price is lower than the input price; on DeepSeek V4.1 Flash that is $0.0055 against $0.175 per 1M tokens. For Arabic tasks, see [Arabic prompt engineering](https://broadrouter.com/blog/arabic-prompt-engineering/), and for document extraction with examples, the [Arabic invoices guide](https://broadrouter.com/guides/read-arabic-invoices-with-vision/).

## Common mistakes

-   Using examples that all share one label or length. The model copies the bias.
-   Rotating examples per request. It breaks the cached prefix and makes results harder to compare.

## Questions

### How many examples should a few-shot prompt have?

Anthropic suggests 3 to 5 for best results. More examples cost more input tokens on every call, so stop adding them once quality stops improving.

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

No. Few-shot examples live in the prompt and are resent on every request. Fine-tuning changes the model weights once, so the examples no longer need to be sent.

### Should the examples go in the system prompt or as chat turns?

Either works. Keep them in a fixed position near the start so they form a stable, cacheable prefix.

## See also

-   [System prompt](https://broadrouter.com/glossary/system-prompt/) (term)
-   [Chain-of-thought (CoT)](https://broadrouter.com/glossary/chain-of-thought/) (term)
-   [Fine-tuning](https://broadrouter.com/glossary/fine-tuning/) (term)
-   [Cached input tokens](https://broadrouter.com/glossary/cached-input-tokens/) (term)
-   [Structured output](https://broadrouter.com/glossary/structured-output/) (term)
-   [Prompt engineering](https://broadrouter.com/glossary/prompt-engineering/) (term)
-   [Read Arabic invoices and receipts with a vision model](https://broadrouter.com/guides/read-arabic-invoices-with-vision/) (guide)
-   [Arabic prompt engineering: register, RTL, numerals and mixed text](https://broadrouter.com/blog/arabic-prompt-engineering/) (article)
-   [How to structure prompts so the prefix caches](https://broadrouter.com/blog/prompt-structure-for-caching/) (article)

Try it on your real workload. New accounts start with $5 of credit for Gemma and transcription. DeepSeek, GLM and Qwen3.8 need a top-up.

[Get started](https://inference.broadnet.ai/account/?utm_source=broadrouter&utm_medium=referral&utm_campaign=glossary-few-shot-prompting&utm_content=page-cta) ·

**Sources**

-   [Brown et al. (2020), Language Models are Few-Shot Learners (checked 2026-11-16)](https://arxiv.org/abs/2005.14165)
-   [Anthropic, prompting best practices (use examples effectively) (checked 2026-11-16)](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices)
-   [BroadNet Inference API reference, cached tokens (checked 2026-11-16)](https://inference.broadnet.ai/docs?utm_source=broadrouter&utm_medium=referral&utm_campaign=glossary-few-shot-prompting&utm_content=sources)
