AI engineering

Stage 2 · Lesson 4 of 9

Few-shot examples

Prompting and model APIs

are two to five sample inputs, each with its ideal output, placed in the prompt. They are often the fastest way to fix format and tone, because an example is harder to misread than a description. Choose them on purpose.

Cover the common case, an , and a case where the right answer is a refusal or "unknown". Mark them clearly as examples, for instance inside <example> tags, so the model does not treat them as real input. Watch out for copying.

Models imitate surface details, so if all three examples start the same way or all have three items, the outputs will too. Vary them. And never reuse your questions as examples, or your tests only check what you already showed the model.

A question to check yourself, an AI practice session and 1 cheat sheet entry come with the full roadmap. Unlock

Resources for this stage

Start with· follow one of these

Practise

  • Run open models locally to test prompts and sampling settings at zero API cost

Keep handy

Also worth your time

Mark this stage as not done?