The Arithmetic of Examples
When crafting prompts for large language models (LLMs), the inclusion of examples, often referred to as few-shot prompting, is a common strategy to guide the model's output. However, the question of 'how many examples is enough?' is deceptively simple. It involves two distinct considerations: the calculable cost and the less tangible benefit. The cost is straightforward: each example consumes input tokens, which directly translates to API call expenses. The benefit, however, is more nuanced and hinges on the underlying assumptions about why examples work and the empirical evidence supporting their efficacy.
Consider a classification prompt where each example, including the input, label, and surrounding delimiters, occupies approximately 180 tokens. The cost of adding examples scales linearly with their number. For instance, a prompt with zero shots requires 420 tokens. Adding one shot increases this to 600 tokens, three shots to 960, and ten shots to 2220 tokens. At a hypothetical rate of $3 per million tokens, zero shots cost $0.00126 per call, while ten shots cost $0.00666 per call. This difference, while seemingly small per call, can escalate rapidly with high-volume usage. A service making 200,000 calls per month could see costs jump from $252 per month for zero shots to $1332 per month for ten shots, a nearly fivefold increase.
This arithmetic is precise. The benefit, however, is not. The effectiveness of few-shot examples depends heavily on what one believes these examples are achieving. Are they merely demonstrating a pattern, or are they fundamentally shaping the model's understanding of the task? The published evidence suggests that the assumed benefits of more examples are not always realized, leading to a situation where costs are guaranteed to rise, but performance gains are not.

The Uncertain Benefit of More Examples
The core of the few-shot prompting debate lies in understanding the model's internal mechanisms. LLMs are trained on vast datasets, acquiring a broad understanding of language and various tasks. When we provide examples in a prompt, we are essentially providing in-context learning signals. The model uses these signals to condition its response for the current query. The assumption is that more examples provide a clearer, more robust signal, leading to better performance.
However, research and practical experience reveal that this is not always the case. The impact of additional examples can plateau, or even diminish, after a certain point. This phenomenon can be attributed to several factors. Firstly, the model might already grasp the task from a few well-chosen examples, and further examples offer diminishing returns. Secondly, the quality and representativeness of the examples are paramount. Poorly chosen or conflicting examples can confuse the model more than they help. Thirdly, the sheer length of the prompt, including numerous examples, can sometimes lead to context window limitations or a dilution of focus, a phenomenon sometimes referred to as 'lost in the middle,' where information presented in the middle of a very long prompt is less likely to be utilized by the model.
The published evidence on the efficacy of few-shot prompting is surprisingly varied. While some studies demonstrate clear improvements with more examples, others show that a small number of high-quality examples can be as effective, if not more so, than a larger, less curated set. This suggests that the optimal number of examples is task-dependent and highly sensitive to the quality of the examples themselves. Developers must therefore move beyond a simple heuristic of 'more is better' and instead focus on selecting diverse, representative, and accurate examples.
Optimizing for Cost and Performance
Given the trade-off between cost and performance, developers must adopt a strategic approach to few-shot prompting. The first step is rigorous experimentation. Instead of blindly adding examples, test different numbers of shots for your specific task and model. Start with zero or one shot and incrementally add examples, measuring both performance metrics (accuracy, relevance, etc.) and API costs.
Consider the nature of the task. For simple, well-defined tasks like basic sentiment analysis or entity extraction, a few examples might suffice. For more complex, nuanced, or creative tasks, more examples might be necessary, but always with an eye on diminishing returns. The quality of the examples is as critical as their quantity. Ensure your examples cover a range of edge cases and variations that you expect the model to handle. Poorly formatted, ambiguous, or incorrect examples will actively degrade performance.
Furthermore, explore prompt engineering techniques that go beyond simply adding more examples. Techniques like chain-of-thought prompting, where the model is encouraged to explain its reasoning step-by-step, can often improve performance without significantly increasing the number of input tokens. Providing clear instructions, defining the desired output format precisely, and using negative constraints can also enhance results. The goal is to provide the model with the clearest possible signal with the fewest necessary tokens.
The surprising detail here is not the linear increase in cost with each added example, but the non-linear, often plateauing, return on performance. It is common to assume that adding more data, in this case, examples, will always yield proportional improvements. However, with LLMs, this relationship is far more complex. The model's existing knowledge and its ability to generalize from limited context mean that beyond a certain point, the marginal utility of additional examples drops off significantly, while the cost continues to climb. This disconnect between assumed benefit and actual outcome is where many developers overspend.
What Happens Next?
The ongoing evolution of LLM prompting strategies will likely see a greater emphasis on efficiency and effectiveness. As API costs remain a significant factor for widespread adoption, techniques that minimize token usage while maximizing performance will be crucial. This includes not only optimizing the number and quality of few-shot examples but also exploring more advanced prompt engineering methods and potentially fine-tuning smaller, task-specific models where appropriate.
For developers building applications on top of LLMs, a data-driven, iterative approach to prompt design is essential. Treat prompt engineering not as an art, but as a science. Continuously monitor performance, track costs, and experiment with different strategies. The 'right' number of examples is not a universal constant; it is a dynamic target specific to your application, your chosen model, and your budget. What nobody has addressed yet is how best to automate the discovery of optimal prompt configurations, balancing cost, latency, and accuracy across diverse tasks and models.
