Few-Shot Prompting
Definition pending
We've cataloged "Few-Shot Prompting" but haven't written a full definition yet. Definitions are hand-curated rather than auto-generated, so it takes time to cover every term.
Want this one prioritized? Email us and we'll bump it.
Practical example
Few-shot prompting is giving the model 3-5 examples in the prompt before asking it to do the task. Each example costs context-window space. With a 128K window that seems free, but attention is O(n²) — 5 shots of 200 tokens each = 1,000 extra tokens, adding ~10% to your per-request compute. Use few-shot sparingly and cache the shot prefix server-side.
Workflow example
Implement few-shot efficiently: (1) pre-compute shot embeddings and store in KV cache prefix (vLLM supports prefix caching), (2) for each request, prepend the cached prefix (zero additional compute for the shot tokens), (3) budget: max 3 shots for latency-sensitive endpoints (<500ms SLO), up to 10 shots for batch/offline. Monitor tokens_per_request; shots should be <20% of total prompt tokens.