← Lessons

quiz vs the machine

Silver1120

Machine Learning

The Few Shot Example Selection

Choosing which demonstrations to show so the model copies the right pattern.

5 min read · intro · beat Silver to climb

Examples teach by showing

In few shot prompting you place a handful of solved examples before the real input. The model infers the task from the pattern. Which examples you pick changes the answer more than people expect.

What makes a good set

Strong demonstration sets are:

  • Representative of the real distribution of inputs you will see.
  • Diverse so the model does not overfit to one narrow style.
  • Correct since the model copies mistakes as readily as good behavior.
  • Balanced across labels so it does not learn a majority bias.

Similarity helps

Retrieving examples that resemble the current input often beats a fixed set. If the live question is about refunds, showing refund examples gives a closer template than random ones.

Order effects

Models are sensitive to example order. The last example and the label distribution can bias predictions, so shuffle and test rather than trusting one arrangement.

Key idea

Few shot quality depends on choosing representative, diverse, correct, and balanced examples, often retrieved to match the input, since the model copies whatever pattern the demonstrations carry.

Check yourself

Answer to earn rating on the learn ladder.

1. Why does retrieving similar examples often help?

2. What risk comes from incorrect demonstrations?

3. Why shuffle and test example order?