AI & LLMs

What is few-shot prompting?

Few-shot prompting is a technique that gives an AI model several examples of the input and output you want before making the real request, so the model matches the pattern instead of guessing at it.

New to Bolt? Sign up free.

Technical definition

Few-shot prompting supplies a small number of demonstration pairs inside the prompt, each showing an input and its correct output, followed by the new input to process. The model infers the mapping from the examples and applies it, without any change to its weights.

The related variants differ by example count. Zero-shot prompting gives an instruction with no examples. One-shot prompting gives exactly one. Few-shot typically gives two to five.

In plain terms

Show, then ask. Rather than describing the format you want, give two or three finished examples and let the AI copy the pattern.

This works because a demonstration is unambiguous in a way a description is not. "Keep it short and friendly" means something different to everyone. Three sample outputs mean one thing.

Why it matters

Few-shot prompting is the fastest fix for output that is right in substance and wrong in shape. Wrong tone, wrong length, wrong structure, inconsistent formatting across items: all of these respond better to examples than to more adjectives.

For a business owner, the practical version is: paste in two things that look the way you want, then ask for the third.

The cost is context. Examples take up room in the context window and spend tokens on every request that carries them, so use the fewest that pin the pattern down.