# Few-shot prompting: learning with examples

[Skip to content](#lm-inhoud)Network/[NL](/en/few-shot-prompting)EN[Hubhub.llmnet.nlCompare models on task, language, cost and license.](https://hub.llmnet.nl/en/)[Communitycommunity.llmnet.nlPrompt techniques, patterns and system prompts.](https://community.llmnet.nl/en/)[APIapi.llmnet.nlLLMs in production: rate limits, routing, structured output.](https://api.llmnet.nl/en/)[Consultancyconsultancy.llmnet.nlRolling out AI in an organization, pilot to production.](https://consultancy.llmnet.nl/en/)[Newsnieuws.llmnet.nlAI developments, explained for the Netherlands.](https://nieuws.llmnet.nl/en/)[Benchmarkbenchmark.llmnet.nlMeasure AI quality yourself, on your own tasks.](https://benchmark.llmnet.nl/en/)[Careersvacatures.llmnet.nlAI roles, salaries and career paths in the Netherlands.](https://vacatures.llmnet.nl/en/)[Learnleren.llmnet.nlAI concepts in plain language, beginner to builder.](https://leren.llmnet.nl/en/)[Guidegids.llmnet.nlRun AI privately on your own Mac, PC, NAS or home server.](https://gids.llmnet.nl/en/)[Directorydirectory.llmnet.nlMapping the AI ecosystem: tools, models, companies.](https://directory.llmnet.nl/en/)[Radarradar.llmnet.nlSignals from X, research and communities for indie developers.](https://radar.llmnet.nl/en/)[Appsapps.llmnet.nlReviews of AI apps and open-source repos, with tips for builders.](https://apps.llmnet.nl/en/)[llmnet.nl — main site](https://llmnet.nl/en/)[](https://x.com/intent/post?url=https%3A%2F%2Fcommunity.llmnet.nl%2Fen%2Ffew-shot-prompting&text=Few-shot%20prompting%3A%20learning%20with%20examples)[](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcommunity.llmnet.nl%2Fen%2Ffew-shot-prompting)[](https://www.reddit.com/submit?url=https%3A%2F%2Fcommunity.llmnet.nl%2Fen%2Ffew-shot-prompting&title=Few-shot%20prompting%3A%20learning%20with%20examples)[](#)[](https://x.com/intent/post?url=https%3A%2F%2Fcommunity.llmnet.nl%2Fen%2Ffew-shot-prompting&text=Few-shot%20prompting%3A%20learning%20with%20examples)[](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcommunity.llmnet.nl%2Fen%2Ffew-shot-prompting)[](https://www.reddit.com/submit?url=https%3A%2F%2Fcommunity.llmnet.nl%2Fen%2Ffew-shot-prompting&title=Few-shot%20prompting%3A%20learning%20with%20examples)[](#)By Ivo Donker — created with AI assistance (Claude & Gemini) · Last updated: July 27, 2026

[LLMNet // Community](https://community.llmnet.nl)
[Home](https://llmnet.nl) > [Community](https://community.llmnet.nl) > Few-shot prompting

# Few-shot prompting: learning with examples

Published by the LLMNet Developer & Prompt-Engineering Community • Reading time: approx. 5 minutes

When developing applications with Large Language Models (LLMs), you will sooner or later run into the limitations of standard zero-shot prompting. You send an instruction, but the model misses just that piece of context or specific output format that is crucial for your production environment. This is where few-shot prompting comes in: a technique where you explicitly feed the model a number of input-output examples before asking the actual question.

In this guide, we dive deep into how to optimally use few-shot prompting, what to look out for when selecting examples, how many examples you need, and which pitfalls you as a developer should avoid.

## What exactly is Few-shot Prompting?

Few-shot prompting is based on the principle of in-context learning. Instead of retraining or fine-tuning the model (which is time-consuming and expensive), you demonstrate directly in your prompt what you expect. You show the model a pattern using concrete cases.

A standard prompt only gives a task description. A few-shot prompt adds representative pairs of input and expected output to that. The model recognizes the underlying format and applies it directly to the final question.

## How do you choose high-quality examples?

The quality of your output directly depends on the quality of your examples. Random examples often backfire. Keep the following guidelines in mind:

- Cover the edge cases: Make sure you don't just include simple 'happy path' examples, but also show how the model should respond to incomplete data, spelling errors, or unusual input.

- Maintain a consistent format: Use exactly the same delimiters (such as Input: and Output:, or Markdown code blocks) in all your examples and in the final question.

- Be realistic: Use data that closely resembles the real user data your application will process later on.

Bad example (Unclear and inconsistent structure)
Context: You want to classify customer reviews as Positive, Neutral, or Negative.

Classify the sentiments:
- This product is great! -> Positive
- Meh, it's okay.
- Bad junk.
Why this goes wrong: The examples are inconsistent (some completely lack the classification) and the model does not receive clear instructions on the desired format for the edge cases.

Good example (Consistent, structured, and predictive)
Context: The same classification task, but now robustly set up.

Classify the sentiment of the product review below as [Positive, Neutral, Negative]. Return only the label.

Example 1:
Review: "The battery life is very disappointing, empty after just one day."
Label: Negative

Example 2:
Review: "Does what it's supposed to do, no fuss."
Label: Neutral

Example 3:
Review: "Fantastic customer service and super fast delivery!"
Label: Positive

Current task:
Review: "Packaging was damaged, but fortunately the device works fine."
Label:
Why this works: The structure is crystal clear, the labels are unambiguous, and the model immediately sees which expected format it needs to generate after the colon of the current task.

## How many examples do you need?

There is no holy grail, but for most LLMs, the sweet spot is 3 to 5 examples.

- 1 to 2 examples (1-shot / 2-shot): Sufficient for very simple format adjustments (e.g., "Convert this date to ISO format").

- 3 to 5 examples (Few-shot): Optimal for complex classifications, sentiment analysis, data extraction, or specific tone-of-voice styles.

- More than 10 examples: Often not recommended. You run the risk of the recency effect (where the model leans too heavily on the last example) and you waste valuable context window tokens. If you need more than 10 examples, you might want to consider fine-tuning or working with dynamic few-shot retrieval (RAG).

## Common Pitfalls

Even experienced developers sometimes fall into these classic pitfalls with few-shot prompting:

- Instruction contamination: Unclear separation of the examples and the actual question. Use clear section headers like ### Examples and ### Question.

- Overly complex examples: Examples that contain sub-explanations or exceptions themselves confuse the model. Keep each example short and atomic.

- Token waste: Including extremely long blocks of text in your examples when a concise summary would suffice. This slows down inference time and unnecessarily drives up your costs.

### Further reading on LLMNet

Want to dive deeper into optimizing your AI architecture and testing model performance? Then check out these sections within our network:

- Deepen your skills via our central [Learning & Tutorials portal](https://leren.llmnet.nl/en/) for advanced prompt architecture.

- Compare the performance of different models on our [Benchmark hub](https://benchmark.llmnet.nl/en/) to see which model responds most reliably to few-shot prompts.

© 2026 LLMNet.nl — Developer & Prompt-Engineering Community. All rights reserved.
