The original GPT-3 paper (Brown et al., 2020) demonstrated that large language models could perform tasks they were never explicitly trained on, simply by being shown a few examples in the prompt. A model trained only to predict text could suddenly do translation, arithmetic, and classification with just 3–5 examples. This was the finding that launched the modern era of prompt engineering.
The optimal number of examples depends on the task complexity and the model. For simple formatting tasks (convert name to "Last, First"), 2–3 examples usually suffice. For nuanced classification with edge cases, 5–10 examples may be needed. Beyond ~10 examples, you're often better off fine-tuning. More examples also consume context window, so there's a practical trade-off between example quality and available space for the actual input.
The examples you choose affect performance dramatically. Diverse examples that cover edge cases outperform repetitive ones. Examples that are similar to the target input outperform generic ones. The order of examples can matter too — models sometimes show recency bias, paying more attention to the last example. When building few-shot systems in production, dynamically selecting the most relevant examples for each input (using embedding similarity) outperforms static example sets.