arrow_backAll articles
Chain of Thought Prompting: How to Make AI Reason Step by Step
Token Optimization

Chain of Thought Prompting: How to Make AI Reason Step by Step

Javier Echeverria··4 min read

There's a specific type of mistake that AI models make that's different from just being wrong about a fact. It's when the model jumps straight to a conclusion without working through the problem, and the conclusion is wrong not because the model lacks knowledge but because it skipped the reasoning steps that would have led it to the right answer.

Chain of thought prompting is the technique that fixes this. It's one of the most well-researched and consistently effective things you can do to improve the quality of AI responses on any task that involves reasoning, math, logic, or multi-step problems. And it's simpler to use than it sounds.

What chain of thought prompting actually is

Chain of thought prompting is the practice of asking the model to show its reasoning before giving its final answer, rather than jumping straight to the conclusion. Instead of asking "what is the answer to this problem," you ask the model to think through the problem step by step and explain each step before reaching the answer.

The reason this works is tied to how these models generate text. They produce one token at a time, and each token is influenced by everything that came before it in the response. When a model writes out its reasoning step by step, those intermediate steps become part of the context that the next step is generated from. The model is essentially using its own output as working memory, which allows it to handle more complex reasoning than it could if it had to produce the answer all at once.

This is different from just getting a longer response. The reasoning steps are doing actual work, not just filling space. Studies from Google DeepMind and other research groups have shown that chain of thought prompting can dramatically improve performance on math, logic, and multi-step reasoning tasks compared to prompting for a direct answer.

How to actually use it

The simplest version is to add a phrase like "think through this step by step" or "walk me through your reasoning before giving your answer" to your prompt. That's often enough to trigger the behavior on most capable models.

A slightly more explicit version is to structure your prompt so the model knows you expect reasoning first and a conclusion at the end. Something like "before you give me your answer, explain how you're thinking about this problem, then give your final recommendation at the end." This makes it clear that the reasoning isn't optional and that the conclusion should come after the thinking, not before it.

For tasks where you have a specific reasoning structure in mind, you can scaffold it even further by telling the model what steps to go through. "First, identify the key constraints. Second, consider what options are available given those constraints. Third, evaluate each option against the constraints. Finally, recommend the best option and explain why." This kind of structured chain of thought is particularly effective for decision-making tasks where you want the reasoning to follow a specific logical framework.

According to research published on arXiv by Google Brain researchers, chain of thought prompting significantly improves performance on complex reasoning benchmarks, with larger models showing more pronounced improvements than smaller ones.

When chain of thought helps most

Chain of thought prompting makes the biggest difference on tasks that involve multiple steps, where getting the right answer requires correctly completing earlier steps first. Math problems are the classic example because the model has to work through calculations in order. But the same principle applies to a wide range of tasks.

Logic puzzles and constraint satisfaction problems benefit a lot from chain of thought because the model needs to track multiple conditions simultaneously. Breaking that down into explicit steps prevents it from losing track of constraints partway through.

Planning and decision-making tasks are another strong use case. If you're asking the model to recommend a course of action, having it reason through the options and tradeoffs before giving a recommendation produces much more thoughtful and defensible outputs than asking for a direct recommendation.

Code debugging is one where chain of thought is underused. Instead of asking the model to fix a bug, ask it to first explain what it thinks the code is doing, then identify where that diverges from what you want, then propose a fix. The diagnostic step often leads to better fixes than going straight to a solution.

When it doesn't help as much

Chain of thought is less valuable for tasks that don't actually involve multi-step reasoning. If you're asking for a simple factual answer, a translation, or a creative piece where the quality comes from language and ideas rather than logical correctness, adding chain of thought steps just makes the response longer without improving it.

It also adds tokens to your response, which means higher costs per request. For production applications where you're running high volumes of a simple task, the token overhead of chain of thought reasoning might not be worth it if the task doesn't actually benefit from it. It's worth testing whether it improves your specific outputs before adding it to every prompt by default.

The sweet spot is tasks that feel like they require thinking rather than just knowing, where the right answer depends on working through something rather than recalling it. For those tasks, chain of thought is one of the most reliable improvements you can make to your prompts.

Try the tools