Few-shot prompting
Also written: few-shot learning, Few-shot learners
Showing a language model a few examples to guide its generation of new outputs for a specific task.
Few-shot prompting means you give an AI model a few examples of what you want it to do before you ask it to do the real task. It's like showing a student a few solved math problems before giving them a new one to solve.
For example, if you want an AI to turn informal sentences into formal ones, you might show it: 'Informal: Hey, what's up? Formal: Greetings, how are you?' Then, when you give it 'Informal: Gotta go!', it will know to respond with 'Formal: I must depart.' This helps the AI understand the pattern or style you're looking for without needing extensive retraining.
Few-shot prompting is an inference-time technique where a language model is provided with a small number of input-output examples (demonstrations) within the prompt itself. These examples illustrate the desired task or format, guiding the model to produce similar outputs for a new, unseen input. This method leverages the model's in-context learning capabilities, allowing it to adapt its behavior without requiring gradient updates or fine-tuning.
Few-shot prompting is crucial for adapting large language models to specific tasks efficiently. Recent applications show its use in complex domains like election risk mitigation and personalized job matching, demonstrating its versatility in guiding AI behavior for practical, real-world applications.
- Teaching Gemini to spot exploding stars with just a few examplesGoogle · Google Research Blog ·
- Testing and mitigating elections-related risksAnthropic · Anthropic News ·
- Delivering contextual job matching for millions with OpenAIOpenAI · OpenAI News ·
- Customizing GPT-3 for your applicationOpenAI · OpenAI News ·
- Language models are few-shot learnersOpenAI · OpenAI News ·
- Anthropic Claude
- Anthropic's work on testing and mitigating election risks likely involves few-shot prompting to guide models in identifying and handling sensitive content.
- OpenAI ChatGPT
- OpenAI's GPT models are frequently used with few-shot prompting, as seen in Indeed's application for contextual job matching where examples guide personalized recommendations.
- Zero-shot prompting
- This involves asking the model to perform a task without an
- One-shot prompting
- This is a specific case of few-shot prompting where only one
- Fine-tuning
- This is a training process that updates the model's weights based o
The concept of in-context learning, which enables few-shot prompting, was significantly popularized by the GPT-3 paper from OpenAI in 2020. Source ↗
Open a chat with a model like ChatGPT or Claude. First, give it a few examples of a task, like translating English words to French. Then, give it a new English word and see if it translates it correctly to French based on your examples.
The Playbook: reusable how-tos, prompts, configs and tips pulled out of the news.
- PromptRole-play a student struggling with math for AI tutor simulationSimulate a student's math struggles and uncertainty for AI tutor evaluation. · 5 min
- TemplateReusable workflow templates for healthcare teamsTeams can create and share templates for common workflows like documentation or prior authorizations. · 15 min
- TemplateTemplate for building an AI tool tailored to your workA structured approach to defining and building a custom AI tool for specific business needs. · 15 min
- TemplateEvals CSV prompt list for agent skillsA CSV file template for listing prompts used in evaluating agent skills. · 20 min
- HeuristicDouble coding agent task completion with docs linksProviding coding agents with a documentation link significantly increases their task completion rate. · 2 min
Questions people ask
- How many examples are 'few'?
- Typically, 'few' refers to a small number, usually between 2 and 5 examples. More than that might start to be considered 'many-shot' or could be part of a fine-tuning dataset.
- Does few-shot prompting change the AI model?
- No, few-shot prompting does not change the underlying AI model. It only influences the model's output for the current conversation or request by providing context.
First seen on Subvolts May 28, 2020. Updated Oct 5, 2026. Written by an AI model from the items above and reviewed against them weekly; report an error.

