Few-Shot Prompting: Teaching by Example

Few-Shot

Part of: Prompt Engineering

Telling a model "classify the sentiment" works okay. Showing it three labeled examples first works a lot better. That's few-shot prompting : you give the model a handful of input-output examples right in the prompt, then ask it to handle a new case the same way. It is often the fastest jump in output quality you can make without changing the model at all. What it is Few-shot prompting means demonstrating the task with a few worked examples inside the prompt, then leaving the new input open for the model to complete. "Few" usually means two to five. The opposite is zero-shot : describing the task with no examples. - Zero-shot : you describe the task and hope the model figures out the exact format and edge cases. "Translate this to French." - Few-shot : you include examples that pin down format, tone, and edge handling. The model pattern-matches off them. How it works The crucial point: the model isn't being retrained . No weights change. It's just reading your examples as context and continuing the demonstrated pattern, the same next-token prediction loop, now strongly biased by the input - output pairs sitting right there in the prompt. This is sometimes called in-context learning

Challenge: Copy the Label From the Matching Example