Reasoning
Story · 7 cards
There's a way to stop AI making mistakes in simple math. And it isn't retraining the model.
It's one example in your prompt that shows the reasoning. Once the model sees how you reach an answer, it does the same.
Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsFrom the paperStory 1/7
A problem for a child. The AI failed it.
"The cafeteria had 23 apples. If they used 20 to make lunch and bought 6 more, how many apples do they have?" The model replied confidently: 27. Not because it can't count. Because its example showed only a bare answer.
Source: Fig. 1
Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsFrom the paperStory 2/7
Same model. One change to the example.
Instead of "The answer is 11" the authors wrote: "Roger started with 5 balls. 2 cans of 3 tennis balls each is 6 tennis balls. 5 + 6 = 11." The model picked up the pattern: 23 − 20 = 3, 3 + 6 = 9. The answer is 9. Correct.
Source: Fig. 1
Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsFrom the paperStory 3/7
A record fell without a single hour of training.
On a math word-problem test the score jumped from 17.9% to 56.9%. The previous record, 55%, required finetuning a model. Here, eight examples with reasoning were enough. The authors stress it: no model was finetuned.
Source: Table 1, abstract, discussion
Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsFrom the paperStory 4/7
This trick has a catch. It doesn't work on small models.
The gains appear only around 100B parameters. Smaller models write fluently but make no sense — and do worse than without the trick. If you run a small model locally, "think step by step" can hurt you.
Source: Sec. 3.2, appendix
Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsFrom the paperStory 5/7
Giving the model more time isn't enough. Order is what matters.
The authors tested substitutes. An equation alone — didn't help. Dots instead of thinking — nothing. A justification written after the answer — nothing either. Only one thing works: reasoning first, answer second.
Source: Sec. 3.3, Fig. 5
Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsFrom the paperStory 6/7
It beat a sports fan. On their home turf.
Does a sentence about sports make sense? The model with reasoning got it right 95.4% of the time. An unaided sports enthusiast — 84%. The same method also set a record on questions that need a strategy: 75.6% vs 69.4%.
Source: Sec. 4
Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsImagineStory 7/7
You don't need perfect examples. You need to show the way.
Imagine asking an AI about your household budget. Before your question, paste one example worked out step by step. The style doesn't matter: three of the authors wrote examples their own way and every version clearly beat the standard prompt.
Source: Based on Sec. 3.4
Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsStrategy
Applying Chain-of-Thought (CoT)
This strategy consists of using a suitably constructed prompt to make the model generate a whole sequence of logical steps before giving the final answer. It imitates the human way of systematically analyzing complicated "System 2" problems.
"Task: If I have 5 apples and I eat 2, and then buy 3 more, how many do I have? Describe your decision process step by step before finally stating the result (e.g. 'At first: 5. After eating 2: 5-2=3. After buying 3: 3+3=6')."
Strategy
Learning from a few examples with reasoning (Few-Shot CoT)
Instead of providing only pairs of questions and answers (Q&A), the query itself supplies the model with full examples of reasoning processes. The AI then learns to copy the format of the "path to the goal".
"Question: John has 3 cats. He buys 2 more. How many cats does he have? Reasoning: John started with 3 cats. Adding 2, he has 3+2=5. Answer: 5. Question: Anna has 10 dogs. She gave away 3. How many dogs does she have left? Reasoning:"
Strategy
Allocating computing power in tokens
By getting the model to generate intermediate computational steps, we in practice force it to devote more resources (generated "tokens") to untangling a given problem. As a result, the model copes better with math and logic.
"Solve this company's complex financial equation. Don't give the final result right away. Write out each stage of your mathematical calculations on a separate line of text."
Good practice
Using the largest available models
The CoT technique gives excellent, even striking results, but it depends mainly on the scale of the model. These abilities become very pronounced in huge LLM networks (e.g. above 100 billion parameters).
Choose the most powerful paid base models for hard engineering tasks instead of smaller free alternatives, if you care about using CoT reasoning.
Good practice
Preserving the interpretability of the path (Debugging AI)
Generating intermediate steps gives insight into why the model gave exactly that answer. Use this practice as a tool for auditing results and making quick corrections.
Writing out every analytical step in a legal process. If the conclusion is wrong, reading the prompt makes it easy to point to the legal article where the AI made an interpretation error.
Good practice
Substantive consistency of examples inside the prompt
Tasks used as demonstrations (in the few-shot method) must match the type of the target problem. For a logic task show logic, for arithmetic – arithmetic equations.
If you ask the model to solve a complicated sorting algorithm, put in the prompt an example of solving a different algorithm step by step, and not, say, an example from analytical chemistry.
Avoid
Using CoT in small, basic language models
When told to "think step by step", smaller models more often produce very smooth and convincing, yet completely logically incorrect reasoning, which further lowers the correctness of the results.
Firing off an elaborate prompt demanding in-depth analysis on a very lean model running locally on a phone.
Avoid
Using "Standard Prompting" for complex problems
Never expect the model to give, right away and in the first line of text, a flawless result of a difficult multi-step calculation while skipping the path of computation.
"Sum up the revenues from all quarters, subtract the 19% tax and labor costs and give me here only the final payout amount, immediately."
Avoid
Jumping into expensive model fine-tuning (Fine-Tuning)
Before incurring the cost of preparing thousands of training examples for a task, always avoid skipping the test phase, in which you check whether adding just 8 "chain-of-thought" examples to the prompt wouldn't solve the problem just as well.
Sending data to an expensive fine-tuning process, when a plain chat message: "Solve a similar task based on these 5 described steps of the procedure" would have delivered 90% accuracy at no extra cost.
Strategy
Zero-Shot Chain of Thought (Zero-Shot-CoT)
A strategy showing that the model does not need ready-made examples of how to solve a task (few-shot). To activate logical reasoning and avoid mistakes in complex tasks, it is enough to encourage the model to break the process into steps using a so-called trigger phrase.
"Calculate how many apples Tom has if he started with 15, ate 3, and then bought twice as many as he had left. Let's think about it step by step."
Strategy
Two-Stage Prompting
A process that logically separates the thinking stage from the stage of producing the result. In the first stage the model generates an analysis, and in the second the system makes it extract just the answer, which is crucial for automating tasks.
"Given the reasoning above, the final answer (written in digits only) is:"
Strategy
Latent Knowledge Extraction
The report shows that giant language models have deep knowledge and reasoning abilities. The strategy is to test unlocking them with zero-shot mode before a developer resorts to costly "retraining" of the model (fine-tuning).
"Before you give me the solution, break this problem down into smaller parts and explain your thought process step by step."
Good practice
Use a single, universal template (Single Prompt Template)
The report shows that using one general trigger phrase, "Let's think step by step," for different types of tasks (math, logic, word games) gives great results without having to tailor the prompt to a specific problem.
"Task: [any description of a hard engineering problem]. Let's think step by step."
Good practice
Build a simple baseline (Minimal Baseline)
Always start testing a model's performance with the Zero-Shot-CoT technique. It often gives very strong, satisfying results, so you avoid unnecessary, manual crafting of many examples in the prompt.
"Is the statement 'Every triangle is a square' true? Let's first analyze it step by step."
Good practice
Separate the line of reasoning from the answer
Always make the model show its path of deduction. This not only improves the correctness of the model's answer, but also makes debugging easier and helps you pinpoint where the AI went wrong.
"Think step by step out loud. At the very end, on a separate line, write 'RESULT: [your final answer]'."
Avoid
Forcing direct answers to complex problems (Direct Answer Prompting)
Avoid giving hard tasks while demanding the result immediately. Without a built-in thinking process, the model often produces wrong guesses.
"Solve this task: 42 * 13 / 2 and give me only the final result immediately."
Avoid
Relying too quickly on "Few-Shot Prompting"
Avoid investing time in crafting special examples inside prompts before you have tried Zero-Shot-CoT mode. Research shows that models do worse with a few poorly chosen examples than with a single "step by step" instruction.
Manually adding 3 different logic tasks with solutions to the prompt, when simply this would work: "Think step by step."
Avoid
Overloading the instructions that trigger reasoning
Overly detailed instructions about how the model should think can make the AI get lost in following them instead of actually solving the task.
"Generate a chain of thought that contains at least 5 paragraphs of deduction, each describing one variable and then leading to a verdict."
Strategy
Self-Consistency
The model generates many different paths leading to a solution and picks the final result by voting for the most frequent answer. This draws on the human intuition that many correct lines of thought should lead to the same conclusion. Explanation or prompt"Generate 5 different ways to solve this math problem, and then give as the final result the one that appears most often."
Self-Consistency Improves Chain of Thought Reasoning in LLMsStrategy
Greedy Decoding Replacement
Instead of always choosing the "most probable" next word (which promotes formulaic output), the model samples different paths and produces unique analyses of the same problem.
Setting a somewhat higher temperature value in the API and giving the instruction: "Analyze the delivery problem in three completely different ways, generating alternative calculation scenarios."
Strategy
Path Marginalization
A strategy of separating the "thinking process" from the final answer in order to count statistical agreement. The model ignores differences in how it arrived at the result and focuses only on whether the number or fact at the end converges.
"For each of the 3 paths you generated, extract only the final amount to be paid, and then point out the sum that repeats most often."
Good practice
Combining with Chain-of-Thought (CoT Synergy)
The self-consistency method was designed to amplify the power of "step by step" prompting. Always combine the two techniques for the best results. Explanation or prompt"Think about this task step by step. Generate 3 separate step-by-step lines of reasoning for this problem, and at the end choose the common answer by majority vote."
Self-Consistency Improves Chain of Thought Reasoning in LLMsGood practice
Using it for tasks with one specific answer (Fixed-answer tasks)
The technique works best in areas where the final result can be unambiguously extracted and mathematically counted (e.g. math, advanced logic, closed true/false questions). Explanation or promptUsing the instruction "calculate this 5 ways and vote" for a task such as "Calculate the annual VAT for the invoice below", where the answer is a specific number.
Self-Consistency Improves Chain of Thought Reasoning in LLMsGood practice
Scaling the sampling for harder tasks (Scaling samples)
Research shows that the harder and more complex the problem, the more paths you should have the model generate. Generating a dozen or so variants increases the chance of filtering out hallucinations.
"This is a very hard algorithmic problem. Analyze it in 10 independent ways and write out the paths before you finally pick the one correct solution."
Avoid
Excessive use of computational resources (Overcomputing)
Do not ask the model to generate a dozen lines of thought for simple, trivial factual questions. It needlessly burns tokens and your time (and budget).
"Write me 10 different deductive analyses of which country Paris is the capital of, and then choose the answer by vote." (A waste of time for an obvious answer.)
Avoid
Using the technique for open-ended text generation (Open-ended tasks)
Avoid forcing self-consistency on creative writing, generating poems or essays, because there is no consistent, closed solution there for the model to clearly "vote" on.
"Write 5 sci-fi stories, and then pick the one that appears most often as the best." (The task makes no logical sense for this mechanism.)
Avoid
Blind trust in a single path (Single-path reliance)
If the task has a large margin of error inside the AI, avoid relying on the first and only answer the model generates. Greedy algorithms can easily "get stuck" in a bad line of thought.
Asking the model to carry out a multi-step accounting audit with the plain instruction "Solve this task", with a naive belief that an instant, single analysis will be flawless.
Strategy
Tree of Thoughts architecture (Tree of Thoughts)
Instead of a single, linear path to an answer, the model branches its reasoning into a web of different variants (a tree). It generates several possible next steps from one point, creating alternative scenarios for solving the problem. Explanation or prompt"Propose 3 different concepts for solving this algorithmic problem. For each of these concepts, then add 2 further steps showing how it could be developed, and then choose the one with the greatest potential."
Tree of Thoughts: Deliberate Problem Solving with Large Language ModelsStrategy
Built-in self-evaluation of states (Self-Evaluation)
A key mechanism in which the artificial intelligence itself checks, at every step, whether its assumptions so far make sense. It rates the generated "thoughts" as promising, doubtful or wrong before spending resources on continuing them. Explanation or prompt"Analyze the paragraph of text you just generated and rate on a scale of 1 to 10 how well it fulfills the main logical assumptions of my prompt. If it received a score lower than 7, ignore it completely."
Tree of Thoughts: Deliberate Problem Solving with Large Language ModelsStrategy
Graph search and backtracking (Search Algorithms & Backtracking)
A technique of applying search algorithms known from computer science (breadth-first or depth-first). When the model runs into a contradiction or decides a branch is wrong, it stops that line of thought and "backtracks" to an earlier correct decision point to explore a different branch.
"Start solving this puzzle step by step. If at any stage your reasoning leads to a contradiction with the rules of the puzzle, write 'ERROR', go back to the previous stage and propose a different way of calculating."
Good practice
Defining the right scale of a "Thought"
A reasoning step for the model should be big enough to be substantively meaningful for evaluating the final solution, but small enough that many precise variants of it can be generated.
When generating code, the "thought" and the evaluation point should be coming up with an idea for a single class in the architecture, rather than asking to evaluate every generated line separately.
Good practice
Varying the voting methods (Flexible Evaluation Methods)
The choice of self-evaluation method should depend on the task. For analytical tasks (math, programming) it is better to flatly reject contradictions; for creative ones, continuous evaluation (e.g. assigning points/stars to individual ideas).
"Create 4 variants of a book title, then give them points from 0 to 5 for emotional resonance. Pass only the variant with the highest score on to the next step."
Good practice
Strategic lookahead (Lookahead)
When a problem is complex, it is worth asking the model, before it makes a final decision about the path, to briefly simulate where a given path would ultimately lead it and what obstacles may arise.
"Before you start writing the full script with this particular storyline, list the 2 biggest plot holes that may appear if we use this solution."
Avoid
A linear approach to tasks with difficult planning (Left-to-Right Limits)
Avoid forcing the model to solve games and complicated multi-step problems with traditional methods that generate the result straight ahead with no option to correct, so that a single mistake cascades and ruins everything else.
"Solve this hard Sudoku puzzle step by step from the left side of the grid downward and don't change the digits you've already set."
Avoid
Blindly pushing on into hallucinations with no pauses for evaluation
What we avoid is relying on a continuous stream of generation in which we give the artificial intelligence no clear checkpoint for reflection: "does what I just wrote make sense?".
"Write a non-stop 3,000 words of an intricate geopolitical plan and give me the finished text right away." (Instead of asking it to come up with 3 theses, verify them, and only then develop them.)
Avoid
Overusing ToT on trivial tasks
The Tree of Thoughts framework uses a very large number of tokens and significantly lengthens the time needed to generate an answer. You shouldn't use complex branching instructions for trivial informational requests.
"Design a three-level tree of thoughts, with 3 branches at each level, and rate each branch on a 10-point scale to determine what the formula for the area of a square is."
Strategy
Step-Back Prompting (Abstraction before reasoning)
A technique in which you get the model to "take a step back" and generate a broader, more general question from a detailed problem, in order to recall physical or historical principles or high-level concepts (first principles).
"Instead of answering the question 'What was the pressure of a gas at a temperature of 50 degrees and a volume of 20 liters?' right away, first ask: 'What universal physical law links the temperature, volume and pressure of a gas?'"
Strategy
Two-step process (Abstraction-and-Reasoning)
A strategy that splits the problem-solving process into two distinct stages: first the model generates an abstract concept, time frame or principle for the given task, and only in the second step does it use this recalled background knowledge to carry out the final deduction.
"Step 1: List the general principles of Newton's laws of motion. Step 2: Using the principles you listed, calculate the force with which the two specific vehicles from the task collided."
Strategy
Grounding reasoning in fundamental laws
Forcing the model to explicitly state and explain definitions, laws or formulas before attempting any mathematical or logical calculation, to guard against errors in the intermediate steps (so-called Math/Reasoning Errors).
"Define exactly what operating profit is and what elements it consists of according to accounting standards, and then, based on that clean definition, calculate it for company X from the data below."
Good practice
Using "step back" helper questions in QA
For questions about a very specific time frame or a narrow historical context, it is worth first asking the model to generate a general biography or outline of the history, from which the model itself can then safely pull the details you want.
"Problem: 'Which school did Estella attend in August 1954?'. Instead of asking directly, use the prompt: 'Write a general education history of Estella, and then, on that broad basis, determine exactly where she was in August 1954.'"
Good practice
Combining abstraction with In-Context Learning (Few-Shot)
Models do best with the Step-Back technique when the prompt shows them a few reference examples of how to correctly extract "high-level principles" from various, random tasks, before you ask them to solve the target.
"Example 1: If the question is about a car's speed, the right abstraction is the formula V=s/t. Example 2: If the question is about fuel combustion, the abstraction is the law of conservation of mass. Now look at my question about a rocket flight, give the right abstraction and only then solve the problem based on it."
Good practice
Using abstraction to improve RAG (Retrieval-Augmented Generation)
"Step back" questions work great for searching external databases. Broader, abstract queries often return more relevant and context-rich source documents than highly detailed questions.
"Before you tell the model to search the company's document base for the answer to the very narrow query 'What was the second installment of John Smith's mortgage in March 2021?', tell it to search for 'John Smith's loan agreement and full repayment schedule'."
Avoid
Hitting highly detailed problems head-on (Direct Prompting for constraints)
Trying to get a direct answer from the model to questions tightly constrained by specific conditions (e.g. a particular month and fraction of a second in history) often results in made-up facts (hallucinations), because the model loses the broader picture of the situation.
"Tell me exactly what the president was doing on March 14, 2005 at 3:00 p.m., without laying out a broader timeline of his presidency around that date."
Avoid
Solving STEM tasks without recalling the theory
Requiring the model to immediately perform multi-step physics or chemistry calculations, without first defining the laws governing the given phenomenon. This almost always leads to errors in assigning variables and in the final result.
"Solve this long thermodynamics problem with many variables and give me just the final result, without wasting time writing out the laws of physics and formulas."
Avoid
Blind trust in invisible thought processes
Avoid letting the model hide the step where it creates definitions. If the model defines the base principle wrongly (a so-called Principle Error), all of the reasoning that follows will be useless. Always force the definitions to be written out in the text so you can verify them.
"Apply a physical principle hidden in the background and give me the answer to my problem right away, without showing me in the text which principle you assumed in your first step."
Strategy
The Re2 Method (Re-Reading)
It consists of giving the language model the same question (or problem) twice within a single prompt. This allows deeper processing of the information and imitates the human process of reading a difficult instruction several times before starting to solve it.
"Question: What is 25 * 48? Read the question again: What is 25 * 48? Answer:"
Strategy
Strengthening "Bidirectional" Encoding (Bidirectional Encoding)
Because most LLMs generate text in only one direction (left to right), they don't see the whole context at once at the planning stage. Repeating the question means that on the second read the model already has the general outline of the entire task encoded in its "memory", which improves its performance in the later stages of generating text.
Doubling the question about the key data so that at the end of the query the model has the freshest access to the numbers and conditions it is supposed to refer to in its calculations.
Strategy
Optimal Number of Repetitions (Optimal Repetitions)
The research in the paper indicates that the best results are achieved by reading the problem twice, or three times at most.
Using a block structure in prompts: [Context] -> [Question] -> "Let's read it once more" -> [Question] -> [Generating the solution].
Good practice
Synergy with Chain-of-Thought (CoT Synergy)
The Re2 technique focuses on the input (better understanding of the problem), while CoT focuses on the output (better reasoning). The question-repetition method works excellently when combined with the phrase "think step by step", reinforcing the process at both ends.
"Q: [Difficult engineering task]. Read the question again. Q: [Difficult engineering task]. Let's think step by step."
Good practice
Universality Without Touching the Model (Model-Agnostic)
Because this is pure prompt engineering, you should apply Re2 on every available language model as a quick optimization, without needing costly fine-tuning or updating of the weights.
Implementing the double pasting of the instruction as a standard system template in the code of your own application built on the OpenAI API.
Good practice
Use in Math and Logic Tasks
The technique brings the greatest gains in specific tasks where a precise understanding of the conditions and mathematical symbols decides ultimate success or failure.
Copying and repeating in the prompt a complicated logic puzzle, an intricate description of an IT system, or an equation with many variables.
Avoid
Over-repetition
Avoid pasting the same question four or more times in one query. Research shows this leads to a drop in quality, because the model focuses on the repetition instead of on solving the task, and it also uses up the context window excessively.
"Question: X. Question: X. Question: X. Question: X. Question: X. Give the result." (A mistaken waste of resources that adds noise to the input).
Avoid
Spending tokens on very simple tasks
Since this technique lengthens the prompt and the input cost, avoid using it on trivial questions based on basic knowledge, which the model answers flawlessly the first time.
"What is the fastest land animal? Read again: What is the fastest land animal?" (An unnecessary use of tokens for a very obvious answer).
Avoid
Isolating the technique from other optimizations
Avoid relying solely on the Re-Reading method when solving the hardest problems, forgetting about output formatting. Re2 on its own is only an optimization of the initial understanding of the task, not a comprehensive solution.
Repeating a math question twice in the input, but forcing the model to give an immediate answer containing only a bare number, with no chance for a thought process.
Done!
You went through 55 takeaways.
Keep reading
LLMs Corrupt Your Documents When You DelegateSometimes the best example is no example at all
A Systematic Survey of Prompt Engineering in Large Language Models: Techniques and ApplicationsNo answer key? Then another AI becomes the judge.
Towards Provably Unbiased LLM Judges via Bias-Bounded Evaluation













