SevyDevy

Module 3 · Talking to AI: prompting · Lesson 14 of 32

Show, don’t tell: examples in prompts

9 minFree GenAI course · BeginnerLesson 3.2By Saket Bhatnagar

Researched and drafted with AI, reviewed and edited by Saket Bhatnagar.

In short

  • Few-shot prompting means putting one to three worked examples inside your prompt.
  • Examples show style and format far better than a long description of them.
  • The model copies your examples closely, so pick them with care and vary them.
Soon

Video lesson · coming soon

Few-shot prompting: show, don’t tell

Lala, your AI mentor, will walk you through this lesson in a short animated video. Until then, everything is here to read and try.

  1. 01 The caption that didn’t sound like Priya
  2. 02 Nani’s roti lesson
  3. 03 Zero-shot vs few-shot
  4. 04 I spot the pattern and continue it
  5. 05 Flip from zero-shot to few-shot
  6. 06 Vary your examples
  7. 07 Your turn, then step-by-step thinking

Priya bakes cakes from her home kitchen in Kochi and sells them on Instagram. Her captions are famous among her customers: short, a little cheeky, with a Malayalam word or two. One busy week she asks an AI app to write them, and describes her style carefully.

Back comes: “Indulge in our delightful, decadent chocolate creation, crafted with love.” It is polite, correct and nothing like Priya. Then she tries something different. She pastes two of her old captions above the request. The next caption sounds so much like her that her sister asks when she wrote it.

Why is showing better than telling?

Words like “cheeky”, “short” and “warm” mean different things to different people. Priya’s idea of short is twelve words. The model’s idea might be forty. A description leaves room for guessing, and as we saw in the last lesson, guesses drift towards the generic.

An example leaves far less room. It shows the length, the rhythm, where the emoji goes and how the joke lands, all at once. That plain request with no examples has a name.

What a few-shot prompt looks like

Here is a classic use. A cloud kitchen in Delhi gets hundreds of reviews a week, many in Hinglish. The owner, Imran, wants each one labelled so he can see what is going wrong. Three examples teach the labels better than a paragraph of rules.

text
Label each customer review as Happy, Unhappy or Mixed.

Review: "Biryani was hot and on time, full paisa vasool!"
Label: Happy

Review: "Delivery partner was polite but the food was cold."
Label: Mixed

Review: "Ordered paneer, got chicken. Never again."
Label: Unhappy

Review: "Taste accha tha, but portion bahut chhota."
Label:

Look at the last line. The prompt ends with “Label:” and nothing after it. Remember next-word prediction: after that pattern repeated three times, the most likely next token is one of the three labels. Here it will almost certainly be Mixed.

How examples steer the answer

The model spots the shared pattern in your examples and continues it for the new input.

Diagram connections:

  • Instruction to Pattern spotted
  • Worked examples to Pattern spotted (show)
  • New input to Pattern spotted
  • Pattern spotted to Answer in same shape (continue)
  • Instruction: One line saying what the task is.
  • Worked examples: Two or three input and output pairs in the same layout.
  • New input: The real case you want handled, in the same layout but with…
  • Pattern spotted: The model notices the labels, length and style the examples…
  • Answer in same shape: The output follows the examples: same labels, same format,…

This is not training. In the lesson on how models are trained, learning meant nudging millions of settings. Here nothing inside the model changes. The examples sit in the context window, the model uses them, and once they are gone, so is the trick. Like Arjun next month.

Try it: zero-shot vs few-shot

Each card shows a zero-shot prompt and the kind of answer it tends to get. Flip it to see the same job with examples added, and the answer that follows.

Try it yourselfFlip it: from zero-shot to few-shotRead the zero-shot prompt and its answer, guess what an example would fix, then flip the card to check.

How do you pick good examples?

The model copies examples closely, often more closely than you expect. That is their power and their trap. If all of Priya’s sample captions mention her sister, every new caption may mention her sister too.

  • Start with two or three examples. Add more only if the answers still wander.
  • Make them different from each other in topic and length, so the model copies the style and not the content.
  • Include a tricky case, like the Mixed review, so the model knows where the line is.
  • Keep the layout identical in every example: same labels, same order, same separators.
  • Use real, correct examples. A mistake in an example gets copied faithfully.
  • End with the new input in the same layout, with the output left blank.
Zero-shot, one-shot and few-shot compared
StyleWhat you giveBest forTrade-off
Zero-shotInstructions onlyCommon tasks: summaries, explanations, quick rewritesStyle and format are left to the model
One-shotInstructions and one exampleFixing a format, like a date or a reply templateThe model may copy that one example too closely
Few-shotInstructions and two to five varied examplesYour own voice, custom labels, tricky edge casesMore tokens on every call, so a little more cost and wait

Check yourself

Check yourself

Lakshmi gives an AI three example product descriptions for her saree shop in Madurai. All three are about silk sarees. Now every new description mentions silk, even for cotton ones. What is the best fix?

Pick an answer to see why it is right or wrong.

Check yourself

After a few-shot prompt works well, what has happened inside the model?

Pick an answer to see why it is right or wrong.

Remember these three

  1. When style or format matters, show one to three examples instead of describing them.
  2. The model copies examples closely, so vary them, balance them and make them correct.
  3. Examples only help inside the prompt they sit in. Nothing about the model changes.

Questions people ask

What is the difference between zero-shot and few-shot prompting?
Zero-shot prompting gives the AI only instructions. Few-shot prompting adds a few worked examples of input and output, so the AI can copy the exact style, labels and format you want.
How many examples should a few-shot prompt have?
Two or three is a good start for most tasks. Add more if the answers still drift, but each example adds tokens to every call, so stop when the results are steady.
Does few-shot prompting train the model?
No. The model uses the examples while writing that one reply, which is called in-context learning. Its internal settings do not change, so you include the examples again each time.
Is few-shot prompting better than fine-tuning?
It is faster, cheaper and simpler to change, so it is the right first step. Fine-tuning can help when you need one fixed behaviour across a very large number of calls, which the lesson “Prompting, RAG or fine-tuning?” covers.