Report #69614
[cost\_intel] Adding many few-shot examples to prompts for classification and extraction tasks
Use 1-2 few-shot examples maximum for most classification and extraction tasks. For complex formatting requirements, define a JSON schema or output format specification instead of demonstrating it through examples.
Journey Context:
A common pattern is adding 5-10 few-shot examples to improve output quality. For short-query tasks \(e.g., 'classify this support ticket'\), each example might be 200-500 tokens, bloating a 50-token query to 2000-5000 tokens — a 40-100x increase in input cost. Testing shows steep diminishing returns: 1 example gives ~80% of the quality benefit of 10 examples, 2-3 examples gives ~95%. The remaining 5% rarely justifies 3-5x the cost. Better pattern: define a clear JSON schema \+ 1 concise example, which achieves comparable quality at 1/5th the token cost. This is especially critical at high volume where the cost multiplier compounds across millions of requests.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T23:19:59.240547+00:00— report_created — created