Zero-shot: instruction only. Works for common tasks the model has seen many times.
Few-shot: 2–5 input→output examples before the real task. The model learns your exact pattern — format, vocabulary, edge cases — without any code. Often the highest-leverage technique available without engineering.
02 Weak vs. Strong
EX 01Support ticket classifier
Classify each support ticket. Return only the label — one word, lowercase.
Categories: bug, feature_request, question, billing
Examples:
Ticket: "When I click Save on the profile page, nothing happens — old data stays."
Label: bug
Ticket: "Could you add the ability to export to Excel? I only see CSV."
Label: feature_request
Ticket: "What's the difference between the Pro plan and the Team plan?"
Label: question
Ticket: "I cancelled my subscription but I'm still being charged monthly."
Label: billing
Ticket: "The CSV export doesn't include the date column even though it's visible in the table."
Label:
→ Why it works
Four examples cover all four categories including the ambiguous edge case (missing column = bug, not feature request).
EX 02Extracting job posting data into JSON
Extract structured data from job postings. Return only valid JSON — no markdown, no explanation.
Example 1:
Input: "Stripe hiring Senior Backend Engineer, remote-first, $180-220k. 5+ years Go required. Payments experience a plus."
Output: {"company":"Stripe","title":"Senior Backend Engineer","remote":true,"salary_min":180000,"salary_max":220000,"currency":"USD","required":["5+ years Go"],"nice_to_have":["payments experience"]}
Example 2:
Input: "Shopify needs Product Designer, Toronto hybrid, CAD 110-140k. Figma + user research required. Motion design a nice-to-have."
Output: {"company":"Shopify","title":"Product Designer","remote":false,"location":"Toronto","salary_min":110000,"salary_max":140000,"currency":"CAD","required":["Figma","user research"],"nice_to_have":["motion design"]}
Now extract:
Input: "Anthropic hiring ML Research Engineer, SF or remote. $200-280k. PhD or 3+ yrs research required. LLM fine-tuning strongly preferred."
→ Why it works
Two examples define the complete schema including optional fields, currency handling, and remote/hybrid variations.
03 Key Points
01Zero-shot: fast, sufficient for standard well-defined tasks
02One-shot: one example locks in format — often enough
03Few-shot: 3–5 examples — best for unusual schemas, tone, or edge cases
04Include edge cases in examples, not just easy ones
05Bad examples teach bad patterns — curate carefully
04 Model-Specific Notes
Claude handles XML-wrapped few-shot: <example><input>...</input><output>...</output></example>. Very reliable for structured extraction.
05 For Your Role
Show, don't tell. Instead of describing what you want, paste 2–3 examples. The AI copies the pattern exactly.