What Is Chain-of-Thought Prompting and How Does It Work?
.png)
Ask a model a hard multi-step question and demand an immediate answer, and it often commits to the first path that comes to mind, which is frequently wrong. Ask it to work through the problem first, and accuracy jumps. That simple change, prompting the model to reason before answering, is chain-of-thought prompting.
It turns out that models, like people, do better on hard problems when they show their work. Generating intermediate steps gives the model room to break a problem down, keep track of parts, and catch its own mistakes before committing to a final answer.
This guide explains what chain-of-thought prompting is, how it works, how it relates to reasoning models, and when to use it.
What is chain-of-thought prompting?
Chain-of-thought prompting is a technique that asks a language model to generate a series of intermediate reasoning steps before producing its final answer. Instead of mapping a question straight to a response, the model writes out the steps it takes to get there, which improves its performance on problems that require reasoning.

Think of solving a math problem in your head versus on paper. In your head it is easy to lose track and slip up. On paper, each step is written down, checked, and built on, so the final answer is far more likely to be right. Chain-of-thought gives the model that paper to work on.
The key insight is that reasoning takes space. By letting the model use tokens to think, you give it the room to work through a problem rather than guess at the answer.
How does chain-of-thought prompting work?
The technique is often as simple as adding a cue that invites step-by-step reasoning.

- Pose the problem. A question that needs several steps is given to the model.
- Prompt for reasoning. A cue such as let's think step by step invites the model to reason first.
- Work through the steps. The model generates intermediate reasoning, breaking the problem into parts.
- Check along the way. Writing out steps lets the model catch and correct errors mid-reasoning.
- Give the final answer. After the reasoning, the model states its answer, now more likely to be correct.
A related variant, few-shot chain-of-thought, includes worked examples in the prompt that show the reasoning for similar problems, which teaches the model the pattern to follow. Either way, the gain comes from generating the steps, not just the answer.
Chain-of-thought vs. direct prompting and reasoning models

These sit on a spectrum of how much a model thinks. Direct prompting asks for the answer immediately, which is fast and fine for simple tasks but weak on multi-step problems. Chain-of-thought prompting adds explicit reasoning through the prompt, improving accuracy for a few extra tokens. Reasoning models take this further: they are trained to reason by default, spending significant inference compute on thinking, which pushes accuracy higher still at the cost of latency and tokens.
In practice, chain-of-thought prompting is a cheap way to get much of the benefit of reasoning from a standard model. Dedicated reasoning models are worth it when a problem is hard enough to justify the extra cost.
What are the benefits of chain-of-thought prompting?
- Higher accuracy. Step-by-step reasoning lifts performance on math, logic, and multi-step tasks.
- Self-correction. Writing out steps lets the model catch mistakes before the final answer.
- Transparency. The visible reasoning shows how the model reached its conclusion.
- Cheap to apply. It often needs only a short cue added to the prompt, with no training.
- Better structure. Reasoning tends to produce more organized, consistent answers.
What are the limits?
- More tokens. Generating reasoning costs extra tokens and a little more latency.
- Overkill for easy tasks. On simple questions the reasoning adds cost without improving the answer.
- Not a guarantee. Reasoning reduces errors but can still reach a wrong conclusion.
- Exposed reasoning. If shown to users, the reasoning may reveal more than you intend.
When should you use chain-of-thought prompting?
Use it whenever a task needs multiple steps or careful reasoning: math, logic puzzles, planning, code debugging, or any question where the answer depends on a chain of deductions. In these cases the accuracy gain easily justifies the extra tokens.
Skip it for simple lookups, classifications, or short factual answers, where reasoning adds cost without benefit. Many teams apply chain-of-thought selectively, triggering it only for the requests that are hard enough to need it.
Best practices for chain-of-thought prompting
- Use a clear cue like think step by step to trigger reasoning on hard problems.
- Provide worked examples for complex tasks so the model learns the reasoning pattern.
- Reserve it for problems that genuinely need multiple steps, not every request.
- Hide the reasoning from end users when only the final answer should be shown.
- Budget for the extra tokens the reasoning generates in cost and latency estimates.
- Route hard requests to chain-of-thought or a reasoning model through a gateway.
Conclusion
Chain-of-thought prompting improves a model's accuracy by asking it to reason step by step before answering. Generating intermediate steps lets the model break down hard problems, catch its own errors, and reach better answers, all for the cost of a few extra tokens. It is one of the simplest and most effective prompting techniques for tasks that require real reasoning.
TrueFoundry's AI Gateway lets teams route reasoning-heavy requests to the right model and track the token cost of techniques like chain-of-thought, alongside caching and observability in one layer. For any workload that involves multi-step reasoning, prompting the model to think is a small change with a large payoff.

Gouvernez, déployez et suivez l'IA dans votre propre infrastructure

GenAI infra- simple, plus rapide et moins cher
Les meilleures équipes lui font confiance pour faire évoluer GenAI















