Zero-Shot, One-Shot, and Few-Shot Prompting
You will understand zero-shot, one-shot, and few-shot prompting as in-context learning, and know when to escalate from no examples to several to lock in a consistent format, voice, or machine-readable output.
{"contentFormat":"slides.v1","completion":{"requireAllSlides":true,"requireQuiz":true},"slides":[{"kind":"title","eyebrow":"Module 2: Practical Prompt Engineering","title":"Zero-Shot, One-Shot, and Few-Shot Prompting","body":"Learn how providing examples inside your prompt can dramatically improve the consistency and quality of AI outputs. This lesson covers the three core techniques—zero-shot, one-shot, and few-shot—and when to use each. By the end, you'll be able to turn any modern model into a reliable tool for your specific tasks.","outcomes":["Define zero-shot, one-shot, and few-shot prompting","Explain the concept of 'shot' as an example","Choose the appropriate technique for a given task","Apply few-shot prompting with diverse, representative examples"],"narration":"Welcome to Module 2. In this lesson, we'll explore one of the most powerful techniques in prompt engineering: showing the model examples. You'll learn the difference between zero-shot, one-shot, and few-shot prompting, and how to use each to get reliable, consistent results."},{"kind":"content","heading":"What Does 'Shot' Mean?","body":"In prompt engineering, a 'shot' is simply an example. The term comes from machine learning, where 'one-shot learning' means learning from a single example. Here, it refers to how many examples you include inside your prompt to guide the model's output. This is called in-context learning—the model learns the pattern from your examples on the spot, without any retraining.\n\nAnalogy: Imagine training a new team member. Sometimes you just describe the task and trust them (zero examples). Sometimes you show one finished sample to copy (one example). Sometimes you show several samples so they grasp the full pattern, including edge cases (many examples). AI models respond to the same three approaches.","callout":{"variant":"note","title":"Context Window","text":"Every model has a limited 'context window'—the total amount of text it can process at once. Longer prompts (more examples) reduce the space available for the output. As of 2026, typical context windows range from 8,000 to 200,000 tokens. Always check your model's limit."},"narration":"Let's start with the basics. A 'shot' is an example you provide inside your prompt. This technique is called in-context learning. Think of it like training a new colleague: you can describe the task, show one example, or show several. The more examples, the clearer the pattern. But remember, each example uses up part of the model's context window, so balance is key."},{"kind":"content","heading":"Zero-Shot Prompting","body":"Zero-shot means you give the model a task with no examples—just clear instructions. Modern models are highly capable, so for common, well-understood tasks this often works beautifully.\n\nExample:\n
\nClassify the sentiment of this customer review as Positive, Negative, or Neutral.\n\nReview: \"The delivery was late but the product quality is excellent.\"\nSentiment:\n\n\n- Use it when: the task is common (translation, summarising, simple classification) and you don't have a strict output format in mind.\n- Strength: fast, short, no effort to build examples.\n- Weakness: the model guesses at your preferred style, so output can vary.","narration":"Zero-shot prompting is the simplest: you give instructions without any examples. It works well for common tasks like translation or simple classification. It's fast and requires no preparation, but the output style may vary because the model has to guess your preferences."},{"kind":"content","heading":"One-Shot Prompting","body":"One-shot means you provide exactly one example of an input paired with the ideal output, then give the real task. The example anchors the format and tone.\n\nExample:\n\nTurn product features into a customer benefit.\n\nExample:\nFeature: 5000mAh battery\nBenefit: Stays charged all day, so you never miss an important call.\n\nNow you:\nFeature: Water-resistant casing\nBenefit:\n\n\n- Use it when: you have a specific format or voice you want copied, and one clean example captures it.\n- Strength: locks in structure with minimal typing.\n- Weakness: a single example may not cover variations, so tricky inputs can still slip.","narration":"One-shot prompting adds a single example to guide the model. This is great when you have a specific format or tone in mind. It's more reliable than zero-shot, but one example might not cover all edge cases."},{"kind":"content","heading":"Few-Shot Prompting","body":"Few-shot means you provide several examples (typically two to five). More examples teach the model the pattern and the edge cases, giving you the most consistent results.\n\nExample:\n\nExtract the country and currency from each sentence. Reply only in the format shown.\n\nText: \"The shop in Nairobi accepts payment in Kenyan shillings.\"\nOutput: Country: Kenya | Currency: KES\n\nText: \"Prices in Mumbai are listed in rupees.\"\nOutput: Country: India | Currency: INR\n\nText: \"Our Berlin office invoices in euros.\"\nOutput: Country: Germany | Currency: EUR\n\nText: \"The Lagos branch charges in naira.\"\nOutput:\n\n\n- Use it when: you need reliable, machine-readable, or highly consistent output—data extraction, tagging, or a fixed template.\n- Strength: the most stable and predictable of the three.\n- Weakness: longer prompts use more context window and take more effort to build.","cards":[{"title":"Diverse Examples","text":"Include at least one tricky or edge case to teach the model how to handle outliers."},{"title":"Consistent Formatting","text":"Keep punctuation, spacing, and labels identical across all examples—the model copies literally."}],"narration":"Few-shot prompting uses multiple examples to lock in the pattern. This gives the most consistent results, especially for structured tasks like data extraction. But be mindful of the context window: more examples mean less space for output. Always include diverse examples and keep formatting consistent."},{"kind":"content","heading":"Real-World Examples","body":"Here are three examples from around the world showing how these techniques are used in practice.\n\n1. E-commerce support, Cairo (Egypt). A team classifies incoming messages into 'Refund,' 'Delivery,' or 'Complaint.' Zero-shot mislabels borderline messages. With a four-example few-shot prompt—one per category plus one ambiguous case—labelling becomes consistent enough to auto-route tickets.\n\n2. Freelance translator, Buenos Aires (Argentina). Lucía wants translations that keep a friendly, informal Latin-American Spanish tone. A one-shot prompt showing one English sentence and her preferred casual translation teaches the model her voice, so the rest of the batch matches without her editing every line.\n\n3. Agricultural co-op, Punjab (India). Field officers turn short crop notes into structured records. A few-shot prompt with three examples (Crop | Issue | Recommended action) converts messy voice-to-text notes into a clean table that feeds their spreadsheet—no manual formatting.","narration":"Let's see these techniques in action. In Cairo, a support team uses few-shot prompting to classify customer messages reliably. In Buenos Aires, a translator uses one-shot to maintain a consistent tone. And in Punjab, field officers use few-shot to turn messy notes into structured data. These examples show how a few well-chosen examples can transform AI output."},{"kind":"quiz","heading":"Check Your Understanding","questions":[{"question":"What does the term 'shot' mean in the context of prompting?","options":["A single attempt at generating a response","An example provided inside the prompt","A type of AI model","A measure of prompt length"],"questionId":"cmrf73k40000ipd2739v90xf8"},{"question":"When should you use few-shot prompting instead of zero-shot?","options":["When you want the fastest possible response","When the task is simple and common","When you need highly consistent, structured output","When you have no examples to provide"],"questionId":"cmrf73k40000jpd27939sog1i"},{"question":"Why is it important to include diverse examples in a few-shot prompt?","options":["To make the prompt longer","To teach the model how to handle edge cases","To confuse the model","To reduce the context window usage"],"questionId":"cmrf73k40000kpd27xmu6fyam"}],"narration":"Now let's test your understanding with a quick quiz. Answer these three questions to check your grasp of zero-shot, one-shot, and few-shot prompting.","quizId":"qz_cmk7lfn260005g4p8454x1yye"},{"kind":"summary","heading":"Key Takeaways","takeaways":["Zero-shot: no examples; fast but output may vary.","One-shot: one example; locks in format and tone.","Few-shot: multiple examples; most consistent, but uses more context.","Start zero-shot, escalate to one-shot if needed, then few-shot for strict templates.","Keep examples diverse and formatting identical.","Be mindful of the model's context window—longer prompts reduce output space."],"narration":"To summarize: zero-shot is quick and simple, one-shot adds a single example for guidance, and few-shot provides multiple examples for maximum consistency. Start with the simplest approach and add examples only when needed. Remember to keep your examples diverse and format them consistently. And always consider the context window limits of your model."}]}