AI Zero-Shot Tutorial: One-Shot, Few-Shot

TL;DRZero-shot, one-shot, and few-shot describe how many examples you put in the prompt.

Zero-shot: just instructions, no examples. One-shot: one example of the desired input→output. Few-shot: several examples that demonstrate the pattern, format, and edge cases. More examples generally improve reliability and formatting — leveraging in-context learning, where the model adapts from examples without any weight updates. Few-shot is a quick way to pin down a tricky format.

Key points

Common mistakes

Try it: Decide zero-shot vs few-shot for enforcing a strict JSON output format.

Example code

<!doctype html><html><head><meta charset="utf-8"></head>
<body style="background:#06040d;color:#e6e0ff;font-family:monospace;padding:20px"><pre>zero-shot: "classify sentiment"
few-shot:  "happy → positive
            terrible → negative
            okay → ?"   ← examples pin the format</pre></body></html>
Open the interactive lesson →
Prompt Engineering · The New Programming Chain of Thought · Think Before Answering