What Is Few-Shot Prompting? A Practical Guide With Real Examples
19 min read
If you use AI on a regular basis, you'll be all too familiar with this problem. You type in a request, only to receive a response in a completely different style, the wrong tone, and often nothing like the response to a similar request the day before.
Usually this will be down to a poorly worded or under-specified prompt.
You can overcome many of these issues by using few-shot prompting. Simply include 1, 2 or 3 sample responses, demonstrating the style and format you require, ahead of your question, and the LLM will follow suit.
You get the right tone and the right format, every time.
Below we explain more about few-shot prompting, the differences from zero-shot prompting, and give a number of examples applicable to a variety of situations.
Prefer to have an appropriate few-shot prompt written for whatever you want to ask the AI? Try our free AI Prompt Generator to create one in a few clicks. 👇
What is Few-Shot Prompting?
As the name suggests, you provide 2 or 3 "shots" (samples) of the type of response you'd like, ahead of your question.
This can dramatically improve the quality of responses returned, and is an extremely useful technique to have in your arsenal. Few-shot prompting doesn't require any special configuration or training of the model.
So a "one-shot" prompt would include one sample response, a "two-shot" prompt would include two, and so on.
Once the model has reviewed your samples in a few-shot prompt, it will aim to return a similar response to your question.
Telling the model what you want it to do, versus showing it with a few shots, is the key difference. Telling it leaves the style up to the model.
With a normal (zero-shot) prompt you instruct the model to perform a task. How it goes about that task, what style, format, length, and so on, is entirely up to it. So you have no idea what form the answer will take, and it will vary each time. All too often you end up spending as much time amending the response as it would have taken to write it yourself, if not more!
With a few-shot prompt, you include 2 or 3 samples of a "good" response. The model will then aim to produce an answer in line with those, matching style, format, length, and so on. So you can be confident that you'll get a response in line with your requirements, in your style, each time.
To quote Tim Law (Research Director, AI and Automation, IDC) on the benefits: "few-shot prompting provides enough context for the model to understand the task's requirements and desired output style, reducing ambiguity and errors, while still allowing the model to generate creative responses".
All of this happens as part of the model's normal processing of your request. The samples form part of the input to the model, and influence the generated output. There is no training involved.
So all you need to do is find 2 or 3 good examples of the sort of answer you'd like, and include them ahead of your question.
According to OpenAI Developers, adding just five few-shot examples to a GPT-4o prompt boosted classification accuracy from 84.5% to 91.5%, a 7-point jump over zero-shot alone. A significant improvement. Similar benefits can be seen in other areas, for example a study in the International Journal of Medical Informatics found that few-shot prompting raised GPT-4o's diagnostic accuracy on real-world clinical cases from 82.4% to 85.9%.
Zero-shot, One-shot and Few-shot
So as we've seen, the main difference is the number of sample responses you include. The more you include, the greater the likelihood the model will match them; but of course the trade-off is the time it takes to find suitable samples.
So it's a case of judging the level of control required over the format of the output.
As a rule of thumb you would use zero-shot prompting if no particular style or format was required, one-shot for a simple format, and few-shot where you need to closely match an existing style.
Here's how each technique stacks up, with pros and cons:
Technique | Best For | When It Fails |
Zero-shot | Simple, generic tasks; fast, no preparation required | Needs specific tone, format, or style |
One-shot | Tasks needing light guidance; quick to prepare | Complex or nuanced outputs |
Few-shot | Consistency, tone-matching, format replication; very close match to samples provided | Too many tokens used, context window limits |
As mentioned, zero-shot prompting requires no preparation. You simply ask the model to complete a task.
Given the vast quantity and variety of information used to train LLMs, it will be able to complete a wide variety of basic tasks satisfactorily.
So if you want to ask a simple question, or request a short summary of some text, you'll generally be fine. However, if you want the response to conform to a particular style, you're leaving that to chance.
One-shot is useful where you'd like to nudge the model towards a particular style or format, but don't want to spend time creating multiple samples. Don't underestimate the impact a single good sample can have.
It can also be useful if you have limited space available in the context window.
Few-shot is ideal where you need a very close match to a particular style. Think of it as providing some guidelines to a new member of staff before asking them to complete a task. You can then be confident of getting a very similar output each time.
By providing 2-5 samples you can be sure the model will match the general style, format, length, and so on. So this should be used whenever it's important to you that the output matches a particular style.
You may also want to consider using chain of thought prompting samples. Here you would show the model one or more examples of the steps you'd like it to follow to arrive at an answer.
So in addition to, or instead of, providing examples of good final answers, you show it how you'd approach arriving at that answer. This can be very beneficial where a degree of reasoning or decision making is required.
Few-shot prompting is a very powerful technique, and one to experiment with. There are a number of good articles comparing the effectiveness of various techniques on different models. We'd recommend looking at some for Gemini as well as ChatGPT and Claude.
Create an appropriate few-shot prompt for your requirement 👇
###
How many samples should you include?
You'll generally find 2 or 3 is sufficient. More than that starts to use up a lot of your available space with little additional benefit.
So as a guide:
Include 2 good samples
Add a 3rd if required to get the desired result
Don't include more than about 5. At some point you'll start to detract from the result as there will be more variation between the samples
This is also a token efficiency point. Extra samples take up more space, which adds cost and slows things down, and you won't generally see any real improvement in quality.
So for most applications 2 good samples will give you a better result than 6 so-so ones. As always, it's better to focus on getting the quality right.
Quality of samples
As the model will be basing its answer on the samples you provide, it's important that they are of a high standard.
If you provide a mixture of styles, formats, lengths, and so on, don't expect it to "average out" and return something in between. More likely you'll get a "mush" that doesn't really match any of them.
So as with anything you ask the AI to do, "garbage in, garbage out". 2 good, well-structured samples will give a far better result than 5 of varying quality.
Each sample essentially "votes" for the type of answer you'd like.
Mechanics of Few-Shot Prompting

So as described above, once the model has reviewed your samples it will note the general style, format, length, and any other features, and aim to produce an answer along those lines to your question.
There is no "memory" of the samples once the conversation is completed.
So you are effectively using the available context window space to instruct the model how to behave, as opposed to re-training it. This is in-context learning in action.
It's analogous to providing someone with some guidelines on how you'd like a task completed. The difference is that the AI will generally adhere to them quite strictly!
So as you can appreciate, if you don't provide any samples, you're giving the model a huge amount of latitude as to how it responds. It will decide each time what it thinks is an appropriate answer. Hence you get varying results each time, which is what few-shot prompting avoids.
Including samples removes much of that uncertainty, ensuring your AI-generated responses stay consistent.
A September 2025 study published on arXiv found that LLM performance peaks with the optimal number of few-shot examples, then declines if overloaded. So providing a reasonable number of good samples is beneficial. Google's Vertex AI documentation states that including examples helps "narrow the model's focus and generate more accurate results".
Any differences between models?
You can use few-shot prompting with all of the leading models, and a few-shot prompt works much the same way on each.
Fundamentally they will all operate in a similar fashion, learning from the samples provided.
However, there are subtle differences between them which can affect the results achieved. So it pays to understand the characteristics of each model you're using.
ChatGPT (GPT-6.2) will generally give very good results. Provide the samples at the beginning of the prompt, so it's primed with them before reading the question. Ensure the rest of the prompt is well constructed (see our article on strong ChatGPT prompts) and you should get excellent results.
Claude will also give good results from samples. It places more emphasis on all of the information provided, so it's best to follow the general rule of providing all "data" first, then your instruction at the end. There are a number of good articles on writing better prompts for Claude which are worth reading.
Gemini can be a little more "opinionated" as to the format it returns information in. So in addition to samples you may want to be more explicit about the desired format, for example "Return as a series of bullets" or "Return as JSON".
So regardless of model, the basic principle of few-shot prompting remains the same. Show it some good examples, then ask it to return a similar response.
Or of course leave it to Phrasly's AI Prompt Generator to create an optimal prompt (for ChatGPT, Claude, Gemini, or whichever model you want to use) with the appropriate structure.
Few-Shot Prompt Examples (By Use Case)
Below are a number of examples of weak and improved (few-shot) prompts for various common situations.
Match existing writing style
As described above, one of the biggest benefits is being able to get the AI to write in a similar style to you.
People will often try to describe their desired style, for example "informative, but friendly". But the model will still interpret that as it sees fit.
Providing 2 samples of writing you're happy with will be far more effective.
This is particularly valuable if you write regularly (blog posts, social media, newsletters, and so on) and don't want to have to spend time re-writing everything the AI produces to make it sound more natural.
So simply provide 2 samples of writing you're happy with.
You may want the AI to produce writing similar to your company's general style.
Prompt:
"Write a LinkedIn post about our new product launch."
The AI will return something, but probably not in line with your style.
Improved prompt:
Example 1: “We at Genyteq Inc are thrilled to launch our latest AI-powered SEO tool. It simplifies content strategy..."
This gives a good indication of the general style you'd like.
Example 2: “Exciting news! Genyteq just released a brand-new analytics dashboard. Our team designed it to help…”
Reinforces the previous sample.
Instruction: “Now write a LinkedIn post about our new product launch in the same tone and style.”
You should then get a very similar style of response, requiring little or no editing.
Writing emails
It's important that emails to customers and other external parties are worded appropriately. You don't want to come across as too casual, nor too stilted.
So it can take time to word them appropriately.
By providing 2 samples of good emails, you can ensure the AI writes subsequent ones in line with them.
You want to email a customer re an appointment.
Prompt:
"Email a client about a meeting this Friday."
The AI may well return an acceptable response, but it could be too formal, too casual, have an inappropriate subject line, and so on.
Improved prompt:
Example 1: "Subject: Meeting Confirmation for Friday at 2 PM | Hi Alex, Thank you for coordinating. I'm confirming that Friday at 2 PM works for us..."
Appropriate level of formality, good specific subject heading.
Example 2: "Subject: Follow-Up on Friday's Appointment | Hello Maria, I'm writing to confirm our meeting on Friday, June 12 at 10 AM. Let me know if anything changes..."
Similar to first sample.
Instruction: "Now write an email confirming a meeting this Friday with the same professionalism and structure. Under 100 words. No bullet points. Include an offer to reschedule if needed."
You should then get a very good email, with appropriate heading, wording, sign-off, and so on.
Marketing Copy and Ad Creative
The AI will return all sorts of formats and lengths of "ad copy" if left to its own devices. So again, providing 2 good samples of existing ads will ensure it returns something similar.
You want an ad to promote a new product.
Prompt:
"Write an ad copy for our new app."
The AI will return something, but with no indication of length, format, style, and so on.
Improved prompt:
Example 1: “Headline: Save Time with AutoSync | Subheadline: Automatically sync all your devices with one click | CTA: Get AutoSync Today"
Indicates a title, description and call to action, all reasonably short.
Example 2: “Headline: Boost Your SEO Effortlessly | Subheadline: Proven AI tools to rank on page one | CTA: Try It Now"
Similar format and style.
Instruction: “Now create a Headline, Subheadline, and CTA for our new app launch in the same format. Keep each element under 10 words. Action-oriented CTA."
You can then be confident of getting a suitable ad, ready to pass to your graphic designer.
Summarizing information
If you receive a number of documents to review, you may want them all summarized in a consistent manner.
Otherwise you may get one with key points, another as a long paragraph, key information buried in the middle of the response, and so on. All of which makes them harder and slower to read.
So by providing 2 samples of good summaries you can ensure they all follow the same format.
You receive various reports and want them all summarized in the same format.
Prompt:
"Summarize this report."
You have no idea what form the summary will take.
Improved prompt:
Example 1: “Key Finding: Sales grew 15% in Q1 | Why It Matters: Strong market demand post-launch | Recommended Action: Increase inventory and marketing spend."
Shows desired format of 3 sections.
Example 2: “Key Finding: User engagement increased 20% | Why It Matters: Indicates product-market fit | Recommended Action: Allocate more budget to successful features."
Confirms format and level of detail required.
Instruction: “Now summarize the following report using the same Key Finding, Why It Matters, Recommended Action format. One sentence per section. Business language only, no technical jargon."
So you can be confident of getting a good consistent format, easy for others on your team to read quickly.
Academic and Student Use
Students often find it difficult to structure their answers to produce a logical sequence of arguments.
So the AI will generally return a series of "logical" paragraphs, but not necessarily in the format the student is used to producing.
You want the AI to suggest a series of arguments supporting a point.
Prompt:
"Write an essay on climate change."
You'll probably get a number of reasonable paragraphs, but with no structure.
Improved prompt:
Example 1: “Thesis: Electric vehicles reduce carbon emissions | Arguments: EVs emit less CO2; government incentives promote adoption; technology is improving | Conclusion: Widespread EV use is key to reducing pollution."
Shows desired format.
Example 2: “Thesis: Online education improves access to learning | Arguments: Flexibility for students; lower cost; diverse resources | Conclusion: Online platforms democratize education."
Reinforces format.
Instruction: “Now outline an essay on climate change using the same Thesis, Arguments, Conclusion structure. Three arguments minimum. Academic tone. No filler sentences."
You should then get a good structured set of points each time.
So as you can see, few-shot prompting is a very simple technique, but it can greatly improve the quality of responses. Is it better than fine-tuning for students and everyday users? For most people, yes. Fine-tuning is built for teams with technical resources, large datasets, and a specific production use case, and it takes technical expertise, a curated dataset, and real cost. Few-shot works instantly, on any model, for free, with results that are just as consistent for everyday tasks.
Want to try it out? Generate an appropriate prompt for your requirements. 👇
Creating a good few-shot prompt

So having seen some few-shot prompting examples, how do you go about creating your own few-shot prompt?
Broadly you would follow these steps:
Decide what type of response you require. An email, a summary, a caption, an analysis? Be as specific as possible, because vague goals lead to vague outputs.
Find 2 or 3 good examples. Presumably you'll have some existing material you can use. Try to choose a few good examples, as the AI will base its response on them.
Include those samples at the start of the prompt, followed by your instruction and any new information. So the general format would be: Sample 1, Sample 2, Question.
Include any other information to constrain the response as appropriate. For example length (100 words or 300), whether to use bullets, level of formality, and so on. This will further ensure you get the type of response you're looking for.
So a general template would be:
"Example 1: [your best existing output] Example 2: [another strong example] Now [task instruction] for [new input] in the same tone, format, and length."
Which you can then adapt as required for each situation, as few-shot prompting is flexible.
Should you always use it?
As with anything, there are pros and cons. Use few-shot prompting when:
You need consistent output across multiple pieces of content
Tone-matching is critical and the model keeps drifting
The task requires a specific format the model doesn't default to on its own
Skip few-shot prompting when:
You're brainstorming or ideating, zero-shot gives you more creative range
The task is simple and generic, and any reasonable answer works
You're working with limited context window space, examples eat tokens, so save them for when consistency actually matters
So use your judgment. Token efficiency is worth thinking about here too: few-shot prompting is a precision tool, not an all-purpose one. Use it when output quality and consistency matter, and skip it when you just need a quick answer. But few-shot prompting is definitely a useful technique to know about, and use when appropriate.
Pitfalls to avoid
There are a few things to be careful of to get good results from few-shot prompting.
Ensure all samples are broadly similar. If one is very formal and another quite casual, you can expect a reasonably "average" response, which may not be what you want. Same applies to length, format, and so on.
Don't over-do the number of samples. Apart from using up valuable space, you risk confusing the model with too much variation. 2-3 should generally be sufficient.
Be clear about any other aspects of the answer you want controlled. Length, format (bullets, paragraph), and so on. Don't assume the samples will convey all of that.
Choose good samples! You don't want the AI basing its answer on poor examples.
So in summary, for few-shot prompting provide 2-3 good samples of the type of answer you'd like, ask your question, and include any other information to constrain the answer as required.
As you can see from the few-shot prompting examples above, they all follow that general pattern. A number of samples showing "good" answers, followed by your question and any other information.
So you can see that most of the pitfalls above relate to failing to provide sufficient information, leaving too much to chance. The more information you can provide to guide the model, the more likely you are to get a good answer.
Automatically generate good few-shot prompts
Of course the above assumes you have a number of good examples to hand to provide as samples. And that you know how best to structure the prompt.
So finding appropriate samples, deciding how best to word the question, adding any other information, and so on can all take time.
For example, if you wanted the AI to write an email to a prospective customer:
You may ask the AI to:
Write a follow-up email to a client who hasn't responded to our proposal.
The AI will then write an email along those lines.
However, using Phrasly to generate a prompt for that requirement would return:
"Compose a professional and courteous follow-up email to a client who has not yet responded to our proposal, emphasizing the value of our offering and inviting them to share any questions or concerns they may have."
So as well as instructing it what to write about, it also tells it the general tone, and what to close with.
So as you can see it can make a big difference to the quality of the response.
Our AI Prompt Generator will create a good quality prompt for whatever requirement you enter, ensuring it's structured appropriately. It works across ChatGPT, Claude and Gemini.
So save yourself the time of trying to work out the best way to phrase things.
Try it now for free 👇
Frequently Asked Questions
What is few-shot learning in machine learning?
It's a way of getting an AI model to perform a task using only a small number of examples, instead of the thousands of training samples usually required.
Traditionally a very large number of examples were required to train a model to give reliable answers to a particular type of question. It was originally developed to solve one of the biggest limitations of traditional machine learning, the need for massive labeled datasets just to get reliable results. Few-shot learning changed that by teaching models to generalize from far less data.
So when applying this principle to prompting an LLM, you provide a small number (usually 2-5) of examples in the prompt itself.
Will it minimize "hallucinations"?
To some extent yes. As you're providing samples and other information to constrain the type of answer, you remove much of the "creation" element.
So the model will spend more effort trying to match the samples, rather than coming up with an answer. So you should see fewer instances of it making things up. Although of course it's still possible.
Is the order of the samples important?
Probably best to have your best one last, as generally more weight is placed on information towards the end of the prompt. But more important is that they are all similar.
Should it be used with models such as ChatGPT o1?
Not always. These models are designed to "think" through the question before answering, and they can actually perform worse with few-shot examples added. So providing samples may detract from that process. You'll generally find a well-worded zero-shot prompt gives good results.
It's a bit like trying to tell someone how to get to a location they already know well!
Can it be used in conjunction with Chain of Thought?
Yes. So instead of, or as well as, samples of good final answers, you provide some showing how you would work through the problem.
So you're providing sample "thinking" as well as answers. This can be very useful for complex, multi-step tasks like analysis, debugging, or logical problem-solving. It's the difference between handing someone an answer key and walking them through the reasoning behind it.
Are there any downsides?
Mainly that the samples use up space in the context window, which leaves less room for your actual input. And as mentioned above, you need to ensure the samples are all of similar quality. Otherwise you risk the model returning a similar quality answer!

Written by
Obaid Ahsan
Content Lead · Pakistan
Obaid Ahsan is a Content Lead with 5+ years of experience in SEO, content strategy, and AI-focused publishing. At Phrasly, he leads content development with a focus on accurate research, search performance, and useful, trustworthy information for readers.


