Pebellslearn by building
0%
RoadmapsMatrixCoursesSandboxSign in
Core Prompting Techniques  ›  Lesson

One-Shot and Few-Shot Prompting

One-Shot / Few-Shot Prompting 14 minShowing a few worked input-output examples teaches the model the pattern, format and edge cases faster than describing them.

One-Shot and Few-Shot Prompting

Spoke & Chain now wants more than a label: for each email, a small record with the category, the bike part mentioned and how urgent it is. Describing the exact layout in words took a paragraph and still produced three different formats. Showing two finished examples fixed it in minutes.

The rule

Show, don't tell: the model copies the examples you give.

A one-shot prompt includes one worked example of input and output; a few-shot prompt includes several, often two to five. The model spots the pattern and continues it for the new input. Examples teach things that are hard to describe:

  • the exact format, down to spacing and punctuation;
  • the judgement on borderline cases;
  • the tone and length of a written answer.
Extract a record from each email.

Email: My rear brake squeals and I ride to work tomorrow.
Record: category=repair; part=brake; urgency=high

Email: Could you tell me when the blue bottle cage is back in stock?
Record: category=order; part=bottle cage; urgency=low

Email: The chain I bought last week snapped. I'd like my money back.
Record:

The model answers in exactly the layout it was shown, for example category=refund; part=chain; urgency=medium. No paragraph of format rules was needed.

That power cuts both ways. The model copies everything about the examples, including accidents: if all your examples are short, answers get short; if most are labelled repair, it leans toward repair; if the last example is order, that label gets a small extra pull.

The shortcut

Choose examples like a mini test set: cover each output, include one hard case, keep one format, mix the order.

Picking four shots for triageStep 1 of 4
  1. Cover the labels

    One email each for repair, order, refund and other, so no label dominates.

Keep examples realistic. Invented, overly tidy examples teach the model a world that does not match your inbox. Real emails, lightly anonymised, work best. Also watch the cost: every example is sent on every call, so four short examples usually beat twelve long ones. Add examples only while the test set keeps improving.

Drills

Answer fast — trust the rule.

quick drill

What is a one-shot prompt?

quick drill

Which is few-shot prompting best at teaching?

quick drill

Five of six examples are labelled repair. What is the likely effect?

quick drill

Which set of examples is best for the triage prompt?

Remember

  • Show, don't tell: the model copies the examples you give.
  • Shortcut: cover each output, include a hard case, one format, mixed order.
  • Trap: accidental patterns in examples — imbalance, odd order, unrealistic tidiness.

Practice — level up

0/1 solved

Write your answer, then compare it with a rubric and a model answer.

ExplainChoose your shots

You will give the triage prompt four examples. Describe which four emails you would pick and how you would format and order them, and explain why.