A prompting technique where you include a small number of input-output examples in the prompt to demonstrate the desired task format and behavior to the model.
Few-shot prompting means including 2-10 examples of a task in the prompt before asking the model to perform it on a new input. These examples serve as demonstrations, they show the model exactly what output format, style, and reasoning process you want, without requiring any model training or fine-tuning.
GPT-3's strong few-shot learning was a landmark demonstration of in-context learning at scale. By showing the model a few examples of translating English to French, or classifying news articles by topic, it could generalize to new instances immediately. This capability scales with model size, larger models exhibit stronger few-shot learning.
Few-shot prompting is most useful when the task has a specific output format (e.g., structured JSON extraction), when zero-shot prompting produces inconsistent results, or when the desired style differs from the model's defaults. The examples you choose matter: diverse, representative examples lead to better generalization than repetitive or unrepresentative ones.
How large language models adapt to new tasks from examples in the prompt, without gradient updates or fine-tuning, and what this capability means for AI flexibility.
Zero-shot prompting asks an LLM to perform a task with no examples, relying entirely on the model's pretrained knowledge and instruction-following ability.
Master the art and science of writing effective prompts, from basic techniques to advanced methods like chain-of-thought, few-shot learning, and structured output generation.