Periagoge
Concept
3 min readself knowledge

Few-Shot Prompting: Training AI With Examples Instead of Explanations

Instead of explaining the rule, demonstrate it through 2-3 worked examples and AI will infer the pattern and apply it to new cases; this bypasses the need for perfect written instruction and works for style, tone, and reasoning patterns. Examples often communicate what you actually want far better than any description.

Hypatia
Why It Matters

Few-shot prompting is showing an AI model 2-5 examples of what you want it to do, then asking it to do the same for your actual input. Instead of explaining a pattern with words, you demonstrate it. "Here are three customer support responses I like—now respond to this new customer ticket in that style" is few-shot. The model learns from the examples rather than from instructions.

Few-shot works because language models are pattern-recognition engines. They can infer the underlying pattern from examples faster than they can follow abstract verbal descriptions. This is particularly powerful when the pattern is subtle, stylistic, or format-specific—things hard to describe but easy to show.

Zero-Shot vs. Few-Shot vs. Fine-Tuning

Zero-shot is asking the model to do something with no examples: "Classify this sentiment." The model uses its general training knowledge. It often works but is less reliable, especially for domain-specific or unusual tasks.

Few-shot is providing 2-5 examples first: "Here are four customer reviews with correct sentiment labels. Now classify this new one." The model learns from examples and adapts its behavior to match. Few-shot is more reliable than zero-shot and requires no model retraining.

Fine-tuning is retraining the actual model on hundreds or thousands of examples. It's expensive, time-consuming, and mostly unnecessary for ad-hoc tasks. Few-shot handles 90% of use cases where zero-shot falls short and fine-tuning seems appealing.

Designing Effective Few-Shot Examples

First, keep examples simple and representative. Choose 2-4 examples that represent the full range of patterns you want the model to learn. If you want sentiment classification across very positive, neutral, and negative reviews, show examples of each. Don't overwhelm with edge cases—use clear, typical cases.

Second, be consistent in format. If you show three examples as "Input: [text] | Output: [classification]," maintain that exact format in your actual query. Models are sensitive to formatting. Inconsistency confuses them.

Third, include challenging examples when possible. If all examples are obvious, the model might miss subtlety. If one example is ambiguous or requires real judgment, the model learns to handle trickier cases.

Fourth, put examples before your instruction. The optimal structure is: examples first, then "Now do the same with this:" followed by your actual input. Some research suggests this ordering matters more than you'd expect.

When Few-Shot Shines

Few-shot excels for: tone and style replication (show it three emails you like, it writes similar emails), classification tasks (show examples of categories, it classifies new items), format consistency (show output structure, it follows it), and domain adaptation (show domain-specific language, it adopts it).

Few-shot struggles with: factual knowledge gaps (examples can't teach facts the model doesn't know), fundamental reasoning tasks (examples don't teach true logical reasoning), and novel patterns unlike anything in its training data (the model has no foundation to build on).

Interaction With Other Techniques

Few-shot combines powerfully with chain-of-thought. Show a few examples where the model works through reasoning step-by-step, then ask your query with that same step-by-step approach. This produces dramatically better results for reasoning tasks.

Few-shot also works with temperature adjustments. Low temperature with few-shot examples produces consistent, example-following outputs. High temperature with examples generates variations on the pattern—useful for brainstorming based on a style you defined through examples.

Few-shot examples consume tokens. Three substantial examples can consume 500+ tokens before your actual query. This is worth it for precision but watch token budgets on large-scale workflows.

Common Pitfalls

Using too many examples confuses the model—3-4 is usually optimal; 10+ is overkill and wastes tokens. Using unrepresentative examples teaches the model wrong patterns. Using overly simple examples doesn't push the model to handle real complexity. Using inconsistent formatting between examples and the actual query breaks the pattern.

Try this: Pick a writing task (email response, social media post, summary style). Write three examples of what you want, then ask ChatGPT to generate new content in that style using the few-shot format: "Here are examples of my writing style: [example 1] [example 2] [example 3]. Now write [your actual request] in this same style." Compare against asking the same request without examples. You'll see the example-based version matching your style far more closely.

Helpful guides
Hypatia
Daily Life & Decisions
Related Concepts
Peri
Questions about Few-Shot Prompting: Training AI With Examples Instead of Explanations?

Peri can explain this concept, give practical examples, help you decide whether it applies to your situation, or recommend a journey if appropriate.

Ready to work on Few-Shot Prompting: Training AI With Examples Instead of Explanations?

Explore related journeys or tell Peri what you're working through.