← Level 2
Level 2· Lektion 8 von 9

Few-shot prompting — giving the AI good examples

Why one good example in the prompt often beats three paragraphs of explanation. When you need examples, how many, and how to build them.

The pattern behind the word

You've surely experienced explaining something to the AI, it gets it almost right, and then you spend three rounds correcting it. Most of the time that's not because your explanation was bad. It's because you explained instead of showing.

Few-shot prompting simply means: you hand the AI a few finished examples before you set your actual task. "Few" means a small number, "shot" here is something like an attempt or a pass. Two to five examples almost always do the job. The model looks at how your examples look and does the new task in the same style.

The opposite is called zero-shot. That's what most people do all the time without knowing the name: you set a task with no example at all and hope the AI already knows what you mean. For simple things that's enough. For anything where a specific format, a specific tone or a specific structure matters, it's the worse choice.

Why examples work stronger than explanations

Language models are trained to continue patterns. That's literally their basic mechanism. If you show three examples that all have the same pattern, the fourth one will very likely have that pattern too. You don't even have to put into words what the pattern is. The model reads it off your examples.

A concrete case. You want a short summary with a fixed structure out of customer emails. With an explanation you'd have to write: "Summarize, first state the issue in one sentence, then the urgency on a scale, then whether a reply is needed." That works halfway. The AI still varies, sometimes it writes the urgency as a word, sometimes as a number, sometimes it forgets the third point.

With a single example the problem disappears. You show one example email and the perfect output for it, in exactly the form you want. The AI copies the form. No more room for interpretation.

How a few-shot prompt is built

The structure is always the same and you can picture it like a table. Input, then output. Input, then output. A few times. And at the end a new input without an output, which the AI then fills in.

For the customer-email task it looks like this:

Email: "Hi, my invoice from last month is wrong,
there's 40 euros too much on it. Please sort this out quickly."
Summary:
- Issue: Wrong invoice, 40 euros too much
- Urgency: 4 of 5
- Reply needed: yes

Email: "Thanks for the great service last week, just wanted
to reach out. All good."
Summary:
- Issue: Positive feedback, no concrete problem
- Urgency: 1 of 5
- Reply needed: no

Email: "When exactly is my order coming? It's said shipped
for three days but nothing's here."
Summary:

The AI now fills in the third summary in the exact same format. Three lines, same order, urgency as a number from 1 to 5. You never explained that the scale goes from 1 to 5. The AI learned it from the two examples.

How many examples really

More is not automatically better. I'd start with two and only add more if the result still wobbles. Rule of thumb from practice:

For format and structure, one to two examples are often enough. The model only needs to see what the box should look like.

For tone and style, so when it should sound more casual or more formal, take three to four. Tone is harder to read off a single example.

For tricky sortings and categories where there are edge cases, four to six examples are worth it, and deliberately ones that cover the edge cases. If you have a category "unclear", show an example that falls into that category too, otherwise the AI never guesses it.

From about eight examples on, each additional one barely adds anything and you're just burning context needlessly, that is space and money. If eight examples aren't enough, usually the task itself is unclear, not the quantity too small.

The most common mistake

Examples that don't match. If your first example writes the urgency as a number and your second as a word ("high"), then you've shown the AI two contradictory patterns and it picks one at random. Your examples have to be consistent with each other down to the decimal point. That's half the battle.

The second common mistake is examples that are too similar. If all three of your examples are complaints, the AI gets unsure with a praise email because it never saw one. Spread your examples so they cover the range that actually occurs. One complaint, one piece of praise, one neutral question. Then the model is prepared for anything.

Few-shot and chain-of-thought together

In the chain-of-thought chapter you learned to let the AI think out loud before it answers. That can be combined with few-shot and then gets really powerful. You then show not only input and output, but in each example also the train of thought in between.

If, for example, you want the AI to check invoices, show the calculation path in each example: "Line items added, 340 euros. VAT 19 percent, 64.60 euros. Total should be 404.60, the invoice says 410, so 5.40 too much." If you demonstrate that in two examples, the AI calculates the third case step by step in the same way, instead of just guessing a number. The error rate drops significantly.

Where few-shot shows up in real work

Almost anywhere you've repeated a task. Categorizing support emails. Generating product descriptions in a fixed schema. Pulling appointments out of messy text messages. Sorting reviews into positive, neutral, negative. Whenever you notice you're setting the same kind of task for the tenth time and the AI answers differently each time, few-shot is the solution.

And a point that often gets missed: once you've built your examples cleanly, you can put them into an automation. The prompt with the examples always stays the same, only the new input changes. That's exactly the bridge to Level 3, where you build such prompts into n8n or Zapier and run them automatically a thousand times over. A good few-shot prompt is the ingredient that turns a nice chat toy into a reliable machine.

What you can try now

Take a task you've given an AI several times recently where the answer was sometimes good, sometimes off. Build two to three examples with perfect output. Make sure the examples are identical in format and cover the range. Attach a new input and see what happens. You'll notice that suddenly you no longer have to make corrections.

Once you've done that a few times, save your best example sets. That's exactly what the playbook on building your own prompt library is about, where you collect your proven prompts instead of building them anew each time.

You're reading without an account. Login saves your progress so you can pick up where you left off. Log in →