# Few-shot Prompting

- **Canonical URL:** https://getaimath.com/dictionary/few-shot-prompting/
- **Topics:** [LLM Fundamentals](https://getaimath.com/dictionary/category/llm-fundamentals/)
- **Last updated:** 2026-11-25

## What is Few-shot Prompting?

**In one sentence:** Few-shot prompting is giving an AI a handful of examples in the prompt before asking it to do the task.

The examples act like a mini lesson inside the prompt. The model notices the pattern and continues it. It is very useful for custom formats, labels or styles, and it requires no extra training.

![How ChatGPT & Claude Talk: Super-Powered Autocomplete — Simple cartoon diagram showing a sentence chopped into Lego word blocks (tokens), an AI brain weighing the odds of the next word ("mat" 75%, "couch" 18%, "roof" 5%), and snapping "mat" onto the end of the sentence.](https://getaimath.com/diagrams/llm-fundamentals.png)
*Napkin Diagram (LLM Fundamentals): Language models don’t plan whole essays at once—they play a super-smart game of "guess the very next word" over and over.*

## What is an example of Few-shot Prompting?

Showing three movie reviews labeled "positive" or "negative," then asking the model to label a fourth, is few-shot prompting.

## Why does Few-shot Prompting matter?

Few-shot prompting is one of the easiest ways to make a model more reliable on your specific task.

## Few-shot Prompting vs. Zero-shot Prompting

Zero-shot prompting gives instructions alone with zero examples, while few-shot prompting includes 2–5 worked input-output examples inside the prompt to demonstrate exact style or edge cases.

| Dimension | Few-shot Prompting | [Zero-shot Prompting](https://getaimath.com/dictionary/zero-shot-prompting/) |
| --- | --- | --- |
| Examples in prompt | Typically 2–5 input → output pairs | 0 (instructions only) |
| Prompt token cost | Higher (examples repeat on every call) | Minimal |
| When to use | Strict formatting, nuanced tone, tricky edge cases | Clear everyday tasks on strong models |

## Related Concepts

- [One-shot Prompting](https://getaimath.com/dictionary/one-shot-prompting/): One-shot prompting is asking an AI to do a task after showing it exactly one example.
- [Chain of Thought (CoT)](https://getaimath.com/dictionary/chain-of-thought-cot/): Chain of Thought is when an AI works through a problem step by step in writing before giving its final answer.
- [Zero-shot Prompting](https://getaimath.com/dictionary/zero-shot-prompting/): Zero-shot prompting is asking an AI to do a task without giving it any examples first.
- [Temperature](https://getaimath.com/dictionary/temperature/): Temperature is a setting that controls how random or creative a model's answers are.
- [Prompt Engineering](https://getaimath.com/dictionary/prompt-engineering/): Prompt engineering is the skill of writing and arranging instructions so an AI model gives the best possible answers.
- [Top-K Sampling](https://getaimath.com/dictionary/top-k-sampling/): Top-K sampling means the model only chooses the next token from its K most likely options.

---
Source: The AI Math Dictionary (https://getaimath.com/dictionary/few-shot-prompting/)
