Kolkata ·  
AI engineering
foundations
deep · 6 min

Chain-of-thought prompting

Asking the model to reason step by step before it answers, and when that helps.

updated 23 Sept 2026

Here's a word problem that a big model got wrong in 2022:

The cafeteria had 23 apples. If they used 20 to make lunch and bought 6 more, how many apples do they have?

It said 27. The answer is 9.

Now let's change one thing. Before the question, we show the model a solved example, and this time the example shows its working. Same model, same question. Now it writes "23 - 20 = 3. 3 + 6 = 9" and gets it right.

That's chain-of-thought prompting: getting the model to write out its reasoning before it answers. It's a strange trick when you first see it. We didn't make the model bigger or teach it anything new. So why would writing more text make it get the answer right?

Two prompts, one change

A normal few-shot prompt (see few-shot prompting) shows the model a solved example, then the new question. Here's the example from the paper that named the trick:

Roger has 5 tennis balls. He buys 2 more cans of tennis balls. Each can has 3 tennis balls. How many tennis balls does he have now?

The answer is 11.

The chain-of-thought version keeps the question and changes only the answer:

Roger started with 5 balls. 2 cans of 3 tennis balls each is 6 tennis balls. 5 + 6 = 11. The answer is 11.

The model copies whatever pattern it's shown. Show it a bare answer and it gives a bare answer. Show it working and it writes working.

Why writing it out helps

Remember how a model writes: one token at a time, each predicted from everything written so far (next-token prediction). Every token gets one pass through the network, and one pass is a fixed amount of work.

So when the model has to jump straight to "9", all the arithmetic has to happen inside the single pass that produces that token. That's a lot to ask of one pass.

When it writes the steps first, each step turns into text it can read on the next pass. Once "23 - 20 = 3" is sitting there, the next step only has to add 3 and 6. The working is scratch paper. And a harder problem gets more steps, so more passes, so more work spent on it.

You might think the trick is just more tokens, whatever they say. That got tested: the model wrote a row of dots, as long as its working would have been, and then answered. It did no better than answering straight away. So the steps have to actually say something.

What about writing the working after the answer? No help either. Which makes sense once you think about it: by the time the working shows up, the answer is already out.

You don't even need the example

Later in 2022 it turned out you can skip the worked example. Put "Let's think step by step" before the answer and the model starts writing working on its own. On one set of arithmetic problems that took accuracy from about 18% to about 79%. Worked examples still did a bit better, but one sentence got most of the way.

The exact words matter less than you'd guess. "Let's think about this logically" worked almost as well. What fails is anything that doesn't get the model writing steps. "Abrakadabra!" scored about the same as saying nothing at all.

There was one catch back then. It only worked on big models, around 100 billion parameters and up. Smaller ones wrote working that sounded fine but didn't add up, and did worse than when they just answered. (Worth keeping in mind if you run a small open model.)

So should every prompt say it?

That's the obvious next thought. If it helps this much, why not put it everywhere?

Look at what the trick actually gives the model: room to do steps. If the task has no steps, the scratch paper has nothing to hold. And that's what shows up when you look across lots of tasks. Nearly all the gain is in math, logic and puzzles where you move symbols around. On everything else, accuracy went from about 56% to about 57%. That's nothing, and you still paid for every extra token it wrote.

A rough test you can use: is there an equals sign somewhere in the problem? On a big general-knowledge quiz, nearly all the gain came from questions like that.

Even for math it isn't the best tool. Having the model write the problem down formally and handing it to a real solver beat working it out in prose.

Newer models changed things

All of that was on models from 2022. Newer models (2025) often reason a little without being asked. For them, "think step by step" makes little difference, and it sometimes trips up a question the model would have gotten right anyway. Reasoning models are built to do this, so asking them gains almost nothing.

The cost stays, though. On regular models, step-by-step answers took anywhere from a third longer to seven times as long.

There's a trap going the other way, too. Say you want a clean answer to parse, so you tell a regular model "reply with only the answer". You might be taking away working it was doing on its own, and accuracy can drop. If you need something machine-readable, give the reasoning somewhere to go first and put the answer at the end. Same lesson as the working-after-the-answer test: the working only helps if it comes first.

Can you read the working to see why it answered?

This is the part people get wrong most. The model writes out its reasoning, so it feels like you're watching it think. Are you?

Here's a test that says probably not. Take a few-shot prompt where the right answer in every example happens to be "(A)". The model picks up on the pattern and leans towards (A), even when (A) is wrong. Then it writes a perfectly reasonable explanation for its wrong answer and never mentions the pattern. Out of 426 of these explanations that were checked, one mentioned it.

Reasoning models own up more often, but not by much. Give one a hint, like a note saying someone thinks the answer is (A). When it uses the hint, its reasoning admits that only some of the time: about a quarter of the time for one model, about two in five for another. Oddly, the explanations that hide the hint tend to be longer, not shorter. And they get less honest as the questions get harder.

So use the working as scratch paper. Don't use it as a record of why the model answered what it did. It can still be wrong, and when it's wrong it now looks well argued.

Back to the cafeteria. Writing "23 - 20 = 3" helped the model land on 9; that much was measured. Whether that line is how the model actually got there is a different question, and as far as anyone can tell there's no reliable way to check yet.

Further reading