Prompting & In-Context Learning

few-shot prompting

Few-shot prompting means showing the model a handful of finished examples before asking it to handle a new case. You might paste three reviews each labelled positive or negative, then add a fourth unlabelled review and stop. The model reads the pattern in your examples and continues it, classifying the new review the same way. You taught it the task purely by demonstration, inside the prompt, without touching its weights.

Examples carry information that instructions struggle to express: the exact output format, the tone, the edge cases you care about, the labels you want used. Two or three good demonstrations often beat a long paragraph of rules. The cost is length, since every example eats into the context window and adds to the bill, and quality matters more than quantity: confusing or unrepresentative examples can teach the wrong pattern. This ability to learn from in-prompt examples is called in-context learning, and few-shot prompting is its most common form.

Also called
few-shotin-context examples