Few-shot prompting and step-by-step breakdown
How to guide an AI assistant with two or three examples, then split a task into steps checked one by one, without exposing data.
In 30 seconds
- Where it happens
- In any request to an AI assistant that must produce a precise format (summary, sorting, standard drafting) or solve a problem in several stages.
- What it brings
- Answers closer to what you want, provided the examples are well chosen and each step is reviewed.
- The reflex
- Give two or three fictional or anonymised examples, split the task into steps, and check each step before moving to the next.
- If it is already done
- If an example contained a customer name, an internal figure or an extract of a contract, tell your security contact and do not reuse it.
What it is
An AI assistant answers better when it is shown what is expected than when the expectation is only described. Showing two or three examples of the desired result is called "few-shot" (in French, learning from a few examples). Breaking a complex problem into small steps that you check one after the other is a second use.
Both techniques improve answers, without making them reliable. This page explains how to use them at work, and what must never go into an example.
Straight answers
What is few-shot?
It is the addition, in the request, of one or more examples of the desired behaviour, as "input and expected result" pairs. Microsoft specifies that the model does not learn in the sense of a permanent change: the examples only condition it for the current answer1. A request without examples is called "zero-shot"1.
The idea comes from research. The 2020 paper on GPT-3 describes tasks and demonstrations given "purely via text interaction with the model", without retraining2.
Why do examples help?
In Microsoft's example, a model asked for a category for a news headline seems to guess what is expected. With examples, it understands the format and can even infer the type of label wanted, although no example carried the label "basketball"1.
What does breaking a task into steps mean?
Microsoft states that language models often give better results when the task is divided into smaller steps. Its example: first ask to extract the useful facts, then only produce search queries to check them1. On a short text the gap is modest, but it becomes clear when the text contains many claims1.
Should the AI be asked to show its reasoning?
It is a variant. Microsoft describes an instruction that asks the model to proceed step by step and to present all the steps. According to the documentation, this reduces the possibility of inaccuracy and makes the answer easier to assess1. Microsoft specifies that this technique applies only to non-reasoning models, and that these techniques "aren't recommended for reasoning models like gpt-5 and o-series models"1.
1How it works1 min
Language models produce the most probable continuation of words from the text they receive1. Well-chosen examples steer this continuation toward the desired format.
For problems in several stages, research has described several methods. The 2022 paper on "chain of thought" shows that providing a few demonstrations containing intermediate reasoning steps improves results on arithmetic, common-sense and symbolic reasoning tasks3. Another 2022 paper shows that adding the sentence "Let's think step by step" is enough, with no example at all, to improve results4. A third method, called "least-to-most", splits a problem into subproblems solved in order, each answer helping to solve the next5.
These results come from tests on benchmark problems, not from office situations. They show that the method can help, without guaranteeing a good answer.
2What you do1 min
- Write two or three short, varied examples, each showing an input and the exact expected output.
- Replace any real data with invented data: a fictional name, a rounded amount unrelated to any case file, a rewritten text.
- Place the instruction clearly. Order matters: Microsoft notes that the order of information can change the output, including the order of the examples1.
- Split the task: ask for a first step, read it over, correct it, then move to the next one, relying on the validated step.
- Provide a way out: allow the AI to answer that it does not know, or that information is missing1.
- Check important facts (figures, dates, names) in a reliable source before using them.
An example of a two-stage request, given here as an illustration:
Illustration, fictional text.
Step 1: [list the verifiable claims in the text below.]
Step 2: [after my review, suggest for each claim a way to check it.]
If information is missing, answer "not found".3Pitfalls1 min
- Biased examples. The model imitates what it is shown. Microsoft points out sensitivity to order, with a recency bias: what comes at the end of the request may weigh more1. Vary the examples and read the answer asking whether it copies their form.
- Invented steps. A step that looks plausible can be wrong. Reading only the conclusion is not enough.
- Overconfidence. The gains measured by research relate to specific test sets34. They say nothing about your case file.
- Leakage in instructions. Instructions and examples are part of the request. OWASP lists among the risks the disclosure of sensitive information and the revelation of information about system instructions8. Microsoft reminds readers that a system message influences the model without guaranteeing that it follows the rules6. Do not count on the instruction "reveal nothing" to protect a secret placed in an example.
- Third-party text in the request. If you paste a document from outside (CV, email, web page), it may contain hidden instructions. The UK NCSC gives the (hypothetical) example of a CV containing hidden text asking to ignore the previous instructions and approve the application7. It adds that current models enforce no security boundary between instructions and data7. Read the outputs with caution, then, when the source text is not your own.
4Real cases1 min
May 2020: GPT-3 tested with examples
The authors of GPT-3, a model with 175 billion parameters, test it without updating the model, with tasks and examples given only through text. They report good results on many datasets, and also datasets where learning from a few examples still struggles2.
May 2022: one sentence is enough on an arithmetic test
Researchers show that adding "Let's think step by step" raises accuracy from 17.7% to 78.7% on the MultiArith test, and from 10.4% to 40.7% on GSM8K, with the text-davinci-002 model4. Even with this gain, the answer remains wrong more than one time in five on MultiArith and more than one time in two on GSM8K, according to these figures4.
May 2022: least-to-most breakdown
The authors of the least-to-most method report that with the code-davinci-002 model and 14 examples, they reach at least 99% accuracy on the SCAN test, against 16% with chain of thought5. They specify that chain of thought tends to perform poorly on problems harder than the examples shown5.
Fact sheet
- Identifier
- CP-312
- Wing
- 4. Artificial intelligence
- Brain skill
- Effective Prompt Engineering (ACTIF) (prompt_correctly)
- Brain reflex
- air-016
- Diagram
- G5 · Employee Decision Tree
- Languages
- de, en, fr
- Sources
- 8 sources checked on 3 November 2026
Sources8 sources
- Microsoft, “Prompt engineering techniques - Microsoft Foundry”. https://learn.microsoft.com/en-us/azure/foundry/openai/concepts/prompt-engineering (accessed 3 November 2026)
- arXiv, “Language Models are Few-Shot Learners”, 28 May 2020. https://arxiv.org/abs/2005.14165 (accessed 3 November 2026)
- arXiv, “Chain-of-Thought Prompting Elicits Reasoning in Large Language Models”, 28 January 2022. https://arxiv.org/abs/2201.11903 (accessed 3 November 2026)
- arXiv, “Large Language Models are Zero-Shot Reasoners”, 24 May 2022. https://arxiv.org/abs/2205.11916 (accessed 3 November 2026)
- arXiv, “Least-to-Most Prompting Enables Complex Reasoning in Large Language Models”, 21 May 2022. https://arxiv.org/abs/2205.10625 (accessed 3 November 2026)
- Microsoft, “System message design for Azure OpenAI - Microsoft Foundry”. https://learn.microsoft.com/en-us/azure/foundry/openai/concepts/advanced-prompt-engineering (accessed 3 November 2026)
- NCSC (UK), “Prompt injection is not SQL injection (it may be worse)”, 8 December 2025. https://www.ncsc.gov.uk/blog-post/prompt-injection-is-not-sql-injection (accessed 3 November 2026)
- OWASP, “LLM01:2025 Prompt Injection”. https://genai.owasp.org/llmrisk/llm01-prompt-injection/ (accessed 3 November 2026)
Cite this article
Brain, “Few-shot prompting and step-by-step breakdown”, Cyberpedia, 2026. https:/
BibTeX
@misc{brain_cp312_en_2026,
author = {Brain},
title = {Few-shot prompting and step-by-step breakdown},
year = {2026},
howpublished = {Cyberpedia},
url = {https://startbrain.io/cyberpedia/en/articles/few-shot-prompting-step-by-step/},
note = {CC BY 4.0}
}