AI from scratch

12. Teaching it to think

The model cannot think in the way you think. It can emit tokens that look like thinking, and those tokens change what it emits next. That turns out to be enough to get much better answers.

This is not a new module. It is a habit, trained into the same next-token machine.

The scratchpad trick

If you ask a model a hard question and make it answer immediately, it has to land the answer in the first few tokens. Those tokens are a guess. If you instead make it write a long, messy working-out first, the answer tokens get to attend to that working-out. The model is using the only memory it has — the sequence — as a notepad.

People call this chain of thought. The product name is thinking mode.

Qwen3 made this a first-class behavior. One model, two styles:

<think>
...scratch work...
</think>

the actual answer

or, with thinking off, an empty scratch block and then the answer.

They trained this on purpose. First they taught the model to produce long solutions to math and code, then they reinforced the ones that got the right answer, then they fused in the "just answer" style so you could switch. A nice side effect showed up without being directly trained: if you cut the scratchpad off early and say "time's up, answer now," the model can still produce something. That is a thinking budget.

Qwen3.8 keeps the habit and gives you a knob called reasoning_effort:

There is a second knob, preserve_thinking. On by default. It means earlier turns' scratchpads stay in the prompt, so the model can reuse them instead of starting from zero every time. That is helpful and it is also how a conversation quietly eats a 262k thinking budget.

The open checkpoint is stricter than the product

This is the distinction that will trip you if you only read headlines.

Qwen3.8-2.4T-A95B, the thing on Hugging Face, is text-only. Thinking cannot be turned off. The chat template will error if you try. Every reply starts with a <think> block.

qwen3.8-max, the hosted API, is the product built on top of that backbone. It accepts images and video. It can run with thinking disabled. It defaults to a 1 million token window and ships with official tools.

Same family. Not the same artifact. Qwen said this plainly on the model card: Max is "based on" the 2.4T-A95B weights, with more features.

Why this works at all

Go back to chapter 3. The only move is next token.

If the trained habit is "write a plan, criticize it, try a command, read the error, revise," then those tokens become the context for the next command. From the outside this looks like an agent working through a problem. From the inside it is still autocomplete, with a very particular kind of text_so_far.

That is also why it fails in characteristic ways. It will write a confident plan that is wrong, then obediently execute the wrong plan, because the plan is now in the prompt and the next tokens want to be consistent with it. It will spend a thousand tokens restating the question. It will hide a bad assumption in the scratchpad and then treat that assumption as given.

Thinking tokens are not a conscience. They are more context.

What "the model is reasoning" should mean

When a lab says a model is a reasoning model, they mean some mix of:

  1. It was trained to emit long intermediate tokens.
  2. Those intermediates were graded, at least sometimes, by whether the final answer was checkable.
  3. You, the user, can spend more tokens to buy a better chance at a hard problem.

They do not mean a separate reasoning engine woke up. They mean the next-token distribution was shoved, hard, toward "show your work, then answer," and that this correlates with getting more problems right.

Qwen3.8 is sold as a coworker that can run for days. That claim lives or dies on the agent loop around the model — tools, tests, files, a harness that puts results back into the prompt — as much as on the weights. The weights make the next action plausible. The loop makes the next action real.