Few-Shot Prompting
Few-shot prompting shows a model a handful of input-output examples in the prompt so it infers the pattern before answering a new case.
Few-shot prompting is a technique where a prompt includes a small number of worked input-output examples — typically two to five — before the actual question, so the model infers the desired pattern from demonstration rather than from description alone.
Telling a model what you want in words has a ceiling: format, tone, and edge-case judgment are often easier to show than to specify precisely. Few-shot prompting exploits a model's in-context learning ability — its capacity to pick up a task pattern purely from what is in the prompt — by giving it worked examples to pattern-match against instead of, or in addition to, instructions.
How it works
A few-shot prompt is built from three parts: a brief instruction, a small set of example input-output pairs, and the new input to solve. The examples do real work beyond restating the instruction — they pin down output format exactly (JSON keys, bullet count, label vocabulary), demonstrate edge-case handling, and calibrate tone and length far more precisely than an adjective like "concise" ever could.
Example selection and order both matter. Examples that are diverse and representative of the real input distribution transfer better than near-duplicates of each other; examples placed last in the prompt tend to influence output more than ones placed first, since they sit closer to where generation begins. Most practitioners settle on three to five examples — enough to fix the pattern, few enough to leave the context budget for everything else.
Why it matters
Few-shot prompting is often the fastest way to fix a model that is technically following instructions but getting the format or judgment wrong in a way that is hard to describe precisely. It costs no training and no infrastructure — just a few well-chosen examples embedded directly in the prompt — which makes it one of the cheapest levers available before reaching for fine-tuning.
A worked example
Zero-shot instruction: "Classify the ticket's urgency as Low, Medium, or High." Given "My export button is grayed out sometimes," a model might reasonably guess Medium, Low, or even High depending on phrasing — there is no anchor for where the line sits.
Few-shot version, same instruction plus three examples:
"App crashes every time I open it" -> High
"Export button is grayed out sometimes" -> Low
"Would love a dark mode option" -> Low
Now the new ticket — "Dashboard takes 30 seconds to load after the update" — has two calibration points to sit between: clearly more disruptive than a cosmetic wish, clearly less catastrophic than a full crash. The model lands on Medium consistently across reruns, where the zero-shot version bounced between all three labels depending on phrasing. The examples did not explain the rule; they demonstrated it, and demonstration transferred more reliably than description.
How Miatz teaches it
The prompting module pairs every zero-shot exercise with a few-shot rewrite of the same task, scored against the same held-out eval set, so learners see the accuracy and consistency gap directly rather than taking it on faith. Choosing which examples to include, and which near-miss examples to deliberately add to fix a specific failure mode, is drilled as its own skill in the daily training loop.