Zero-shot vs few-shot, and the order trap
The fake model picks the label of the example with the most words in common, and falls back to the last example when nothing matches.
Showing the model two or three solved examples often works better than explaining the rule in words. Zero-shot has none, one-shot has one, few-shot has several. Which examples you pick, and their order, change the answer.
Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.
Ready for more? This phase has 6 hands-on exercises with automatic checks.
Practice questions
Write the code in the editor, run it, then open the model answer to compare.
Write build_shots(examples) that turns a list of (text, label) pairs into a list of chat messages, alternating user and assistant.
Write label_counts(examples) that returns a dictionary of how many examples have each label, to check whether the examples are balanced.
Explain it without notes
What is few-shot prompting, and when is it better than writing instructions?
What are recency bias and majority label bias, and how do you reduce them?
Why must the test set be different from the examples in the prompt?
Expected output
"my parcel is late": zero-shot=Hard to say, maybe billing. | few-shot=shipping | reversed order=shipping
"charged me twice": zero-shot=Hard to say, maybe billing. | few-shot=billing | reversed order=billing
"hello there": zero-shot=Hard to say, maybe billing. | few-shot=other | reversed order=shipping