Few-shot prompting is a technique where you provide AI with a few examples of the desired input-output pattern before asking it to perform a task. By showing examples, you teach the AI your specific requirements, formatting preferences, and expected behavior without fine-tuning the model.
Few-shot prompting is one of the most effective techniques for getting consistent, correctly-formatted output from AI. Instead of describing what you want, you show it.
Zero-shot (no examples): "Write a commit message for adding dark mode"
Few-shot (with examples): "Here's how I write commit messages:
Now write one for: Added dark mode toggle"
Few-shot prompting is quick and flexible — no training required. Fine-tuning is more powerful but requires data and compute. Start with few-shot; fine-tune only if needed.