How an LLM thinks: Qwen3's thinking mode, measured in Ollama

What “reasoning” means for a language model, how Qwen3 learned to think, and what we measured on 12 problems, with and without thinking, in Ollama.

A thought bubble labeled think inside a hexagon, with the label QWEN3 · THINKING, a box with the direct answer 9.11 greater than 9.9 crossed out in red and one with the thought-through answer 9.9 checked in green, and the title How an LLM thinks

In short

An LLM's reasoning is text generated before the answer: intermediate tokens that become context for the next ones, and so more compute spent on the same question. Models learned to write it through reinforcement learning, rewarded only for correct final answers to verifiable problems. On 12 math, logic and code problems, Qwen3-8B without thinking answered correctly in 30 of 36 runs, and with thinking in 36 of 36, but it needed 3.3 times more tokens and 4 times more time.

Every presentation of a frontier model, meaning one of the few models that outperform everything else available at a given moment, contains the same sentence: “advanced reasoning capabilities, solves complex problems in math, programming, science and logic”. The sentence is accurate, but it says nothing about what the model actually does. And for anyone running a local model on a company computer, the practical question is a different one: does the model on my PC have this capability, what does it cost, and when is it worth turning on?

The short answer: a language model's reasoning is text. It is tokens generated before the answer, which the model learned to write because it was rewarded whenever the final answer came out right. There is no separate logic module. There is a model that, instead of answering straight away, writes a page of calculations, checks and corrections, and then answers. Every line on that page costs as much as a line of the answer.

In the first article we followed a token through the 36 layers of Qwen3-8B, and in the second we swapped the MLP for experts. Here we stay with the same models and the same PC, but make them think: 12 math, logic and code problems, each run three times with thinking and three times without, with the answers graded automatically. The explanations come from the paper that introduced chain-of-thought, the DeepSeek-R1 report published in Nature, the Qwen3 technical report and an Anthropic study on how honest the visible thinking is.

What “reasoning” means for a language model

In the anatomy article we saw that every generated token passes through exactly the same layers, with the same matrices. The compute per token is fixed. When you ask “which is larger, 9.11 or 9.9?” and the model answers “9.11” directly, it had three passes through the network to work with, one for each token of the answer, and all three worked on text statistics, in which “11” is usually larger than “9”.

The same question, 9.11 or 9.9, answered directly in three red tokens, wrongly, and answered after a string of orange thinking tokens, followed by the correct answer 9.9 in green
The only way the model can compute more for a question is to write more tokens.

The model cannot “sit and think”. It has no inner loop it can run several times for a hard question. Its only freedom is the length of the text: if it writes “9.11 means 9 and 11 hundredths, 9.9 means 9 and 90 hundredths”, those tokens become context for the following tokens, and the comparison turns into one between 11 and 90, which text statistics handle well. An intermediate token is a unit of extra compute, not an explanation for a human.

The observation was published in 2022 by Jason Wei and colleagues at Google, under the name chain-of-thought prompting. If you put a few step-by-step worked examples in the prompt, the model imitates the format and correctly solves problems it got wrong when answering directly. With eight such examples, PaLM, a 540-billion-parameter model, scored better on GSM8K, a set of grade-school arithmetic problems, than a GPT-3 fine-tuned specifically for the task with a verifier. The model had not changed. Only what it wrote before the answer had.

Two years later, a paper from Berkeley and Google DeepMind turned the question around: with a fixed compute budget, do you spend it on a larger model or on more tokens from the same model? The answer depends on how hard the question is, but on problems the small model can solve at least some of the time, extra compute at inference beat a model 14 times larger. This is where the idea of “test-time compute”, compute at the moment of use, comes from, and it underlies every reasoning model today.

How the model learned to think: rewards only for the right answer

The 2022 chain-of-thought depended on the examples in the prompt. The reasoning models of 2024 and 2025 no longer need them: they think on their own, at length, with checks and corrections, because they were trained to. OpenAI announced the first such model, o1, in September 2024: on AIME 2024, a math competition for high-school students, GPT-4o solved 12% of the problems and o1 solved 74% on a single attempt. The recipe stayed secret.

The public recipe came from DeepSeek in January 2025, and in September 2025, with its publication in Nature, DeepSeek-R1 became the first large language model to go through peer review. The central experiment is called DeepSeek-R1-Zero, and it is surprisingly simple:

  1. Start from a base model, trained only to complete text, with no instruction tuning.
  2. Give it problems with known answers: math, programming with tests, logic.
  3. For each problem, the model writes several answers in a required format: the thinking between the <think> and </think> tags, then the answer.
  4. A rule-based verifier, not a human and not another model, gives a reward of 1 if the final answer is correct and 0 otherwise, plus a small reward for following the format.
  5. The model's weights are adjusted so that rewarded answers become more likely. The algorithm is called GRPO, and it compares each answer with the average of its group, without a second model to estimate value.
The training loop: a problem with a known answer, the model writes four answers with thinking, a rule-based verifier gives plus one to the correct ones and zero to the rest, and the rewarded chains become more likely; below, a curve of answer length rising from hundreds to thousands of tokens over training
Nobody shows the model how to think. It is rewarded only for the final answer.

What happened during training is the interesting part. Nobody showed the model examples of thinking. Even so, its answers grew from hundreds to thousands of tokens, and in them corrections (“wait”), checks of earlier steps and attempts to solve the problem another way appeared on their own. The authors call the moment when the frequency of “wait” jumped the “aha moment”. The explanation is statistical, not psychological: long chains with checks lead to the right answer more often, so they are rewarded more often, so they become more likely. On AIME 2024, the model climbed from 15.6% to 77.9% correct on a single attempt, and to 86.7% with majority voting over several attempts.

R1-Zero had two flaws: its thinking was hard to read, and it mixed English and Chinese in the same sentence. The final model, DeepSeek-R1, got a few thousand examples of clean thinking before reinforcement learning, an extra reward for language consistency and two final stages for general tasks. The paper also mentions a limitation we will see in our own runs: the model is optimized for Chinese and English and, for questions in other languages, “might use English for reasoning and responses”.

How Qwen3, the model in Ollama, was trained

The Qwen3 technical report, published in May 2025, describes a four-stage recipe for the family's large models, Qwen3-235B-A22B and Qwen3-32B.

Four chained stages: cold start with long thinking examples, reasoning RL on 3,995 problems with a verifier, mode fusion through SFT with think and no_think, general RL on over 20 tasks; then off-policy and on-policy distillation from the large models into Qwen3-0.6B through 30B-A3B
The small models in Ollama learned to think from the large ones, through distillation, not through reinforcement learning.
Stage What happens Detail from the report
1. Cold start supervised training on long, verified thinking examples questions the model solves correctly without thinking are removed; so are guessed answers, answers with repetitions or with mixed languages
2. Reasoning RL reinforcement learning with a verifier, as at DeepSeek 3,995 problems; AIME 2024 for the 235B rises from 70.1 to 85.1 in 170 steps
3. Mode fusion supervised training with answers with and without thinking, marked /think and /no_think answers without thinking keep an empty <think></think> block
4. General RL reinforcement learning on over 20 task types rule-based rewards for format, model-based rewards for quality; obeying /no_think is one of the tasks

Two details from stage 3 matter in practice. First: turning thinking off is not a switch inside the model, but an empty <think></think> block that the chat template writes before the answer. The model sees that it “has finished thinking” and answers directly. Second: the thinking budget. When the thinking reaches the length set by the application, generation stops and the sentence “Considering the limited time by the user, I have to give the solution based on the thinking directly now” is inserted, followed by the closing tag. The model answers with whatever it managed to think through. The report says this ability was not trained explicitly; it emerged from the mode fusion.

The small models, from 0.6B to 14B, plus the 30B-A3B MoE, did not go through the four stages. They were distilled from the large ones: first they learn from the teacher's answers in both modes, then they write on their own and the teacher corrects their distribution for every token. The report gives a direct comparison for the 8B: distillation reached 74.4 on AIME 2024 in 1,800 GPU hours, while reinforcement learning applied directly to the 8B reached 67.6 in 17,920 GPU hours. The 8B model in Ollama thinks because it imitates the thinking of a 235B model, not because it was rewarded itself.

What the think block actually is

In May 2025, Ollama added the think parameter to its API and the --think and --think=false options to its command line. With think: true, the API response comes with two separate fields, message.thinking and message.content. The thinking does not go into the answer and is not sent back to the model with the next question in the conversation.

The exact text the model sees: with think true, the question about the letter r in strawberry is followed by a think block that spells the word and checks it, then the answer 3; with think false, the template writes an empty think block and the model answers directly; the thinking budget inserts the sentence Considering the limited time by the user and the closing tag
Everything you see here is text. Thinking is a section marked by two tags.

Here is the start of Qwen3-8B's actual thinking on one of our problems, about two trains leaving 30 minutes apart, at 60 and 90 km/h:

Okay, let's see. There's a train leaving from station A to B at 60 km/h.
After 30 minutes, another train leaves from A on the same route at 90 km/h.
The question is, after how much time from the departure of the second train
will it catch up to the first one?

Hmm, so first, I need to figure out how far the first train has traveled
in those 30 minutes before the second train even starts. Since the first
train is going at 60 km/h, in 0.5 hours (which is 30 minutes), it would
have covered 60 * 0.5 = 30 km. So, when the second train starts, the first
train is already 30 km ahead.

The question was in Romanian, the thinking is in English, and the final answer came back in Romanian. This is exactly the limitation DeepSeek mentions: the reasoning training data is overwhelmingly in English and Chinese, and the model thinks in the language it learned to think in. For the result, it makes no difference. For someone who wants to read the thinking, it does.

What we measured: 12 problems, with and without thinking

The test machine is the one from the MoE article: an Intel i5-6600K, 32 GB of DDR4, an RTX 3060 Ti with 8 GB, Ollama 0.40.5. We used three models from the Ollama library because, as we showed in the previous article, qwen3:30b is the Thinking-2507 variant, which always thinks, and its non-thinking counterpart is qwen3:30b-instruct.

Condition Ollama model What it is Thinking
8B without qwen3:8b hybrid Qwen3-8B, Q4_K_M, 5.2 GB think: false
8B with qwen3:8b the same file think: true
30B without qwen3:30b-instruct Qwen3-30B-A3B-Instruct-2507, 19 GB never thinks
30B with qwen3:30b Qwen3-30B-A3B-Thinking-2507, 19 GB always thinks

The 12 problems have a single, verifiable answer. The prompts are in Romanian, and each one ends by asking for a line “Răspuns final: …” (“Final answer: …”), which a script compares with the expected answer. The script and the problems are in think-bench.mjs, and all 144 runs, with the full thinking, are in results.jsonl.

Problem Category Correct answer
After how many minutes the second train catches up with the first math 60
A price of 250 lei, 20% discount, then 19% VAT math 238
The last digit of 7 to the power 2026 math 9
The sum of the numbers from 1 to 100 divisible by 3 or 5 math 2,418
How many groups of 3 people can be formed from 8 math 56
A 1,200-liter tank, two taps and a drain math 24 minutes
The equation x² − 5x + 6 = 0 math 2 and 3
Knights and knaves: A says “we are both knaves” logic A knave, B knight
Which is larger, 9,11 or 9,9 (Romanian decimal commas) logic 9,9
How many times “r” appears in “strawberry” logic 3
What a Python program with recursive Fibonacci prints code 88
What print("abcdef"[::-2]) prints code fdb

The sampling parameters are the ones Ollama ships for qwen3, temperature 0.6, top-p 0.95, top-k 20, identical in every condition. The context window is 8,192 tokens, with thinking capped at 7,168 tokens; we chose this value because at 16,384 the 8B model no longer fit in the 8 GB of VRAM and dropped from 72 to 18 tokens per second. The model card recommends 32,768 tokens for thinking, but our cap was never reached: the longest thinking ran to 4,244 tokens. Each combination was run three times, because sampling is random.

Bars with correct answers out of 36 runs: Qwen3-8B without thinking 30, with thinking 36, 30B-A3B Instruct without thinking 33, 30B-A3B Thinking with thinking 36, with the median of generated tokens under each bar
With thinking, both models answered correctly in all 36 runs.
Condition Correct of 36 Tokens per answer, median Seconds per answer, median Generation speed Total time, 36 runs
8B without thinking 30 225 3.1 72 tokens/s 2 min 10 s
8B with thinking 36 752 10.7 70 tokens/s 8 min 27 s
30B Instruct, without 33 203 13.3 15 tokens/s 10 min 26 s
30B Thinking, with 36 1,055 76.4 14.6 tokens/s 52 min 44 s

The time is generation only, without loading the model and without reading the prompt. Problem by problem, the results look like this:

Problem 8B without 8B with 30B Instruct 30B Thinking
Trains 3/3 3/3 3/3 3/3
Discount and VAT 3/3 3/3 3/3 3/3
Last digit of 7²⁰²⁶ 3/3 3/3 3/3 3/3
Sum of numbers divisible by 3 or 5 3/3 3/3 3/3 3/3
Combinations 3/3 3/3 3/3 3/3
Tank 3/3 3/3 3/3 3/3
Quadratic equation 3/3 3/3 3/3 3/3
Knights and knaves 3/3 3/3 3/3 3/3
9,11 or 9,9 0/3 3/3 3/3 3/3
“r” in “strawberry” 0/3 3/3 3/3 3/3
Fibonacci in Python 3/3 3/3 3/3 3/3
"abcdef"[::-2] 3/3 3/3 0/3 3/3
Bars with the median generated tokens and seconds per answer: 225 tokens and 3.1 seconds for Qwen3-8B without thinking, 752 and 10.7 with thinking, 203 and 13.3 for 30B-A3B Instruct, 1,055 and 76.4 for 30B-A3B Thinking
Thinking multiplies the tokens, and therefore the time. On the model split between the GPU and RAM, every token is even more expensive.

What the numbers tell us

  1. Every mistake was a short answer. Qwen3-8B without thinking answered “9,11” in 26 tokens and “2” for the letter “r” in 9 tokens, three times out of three. No intermediate step, just text statistics, in which “11” is larger than “9”, and “strawberry” is, to the model, a few multi-letter tokens rather than ten letters to count. Instruct-2507 answered “fed”, “edb”, “edb” to the Python slice in 8-9 tokens. In all the other 135 runs, the model wrote at least a few lines of working before the answer, and the answer was right.
  2. “Without thinking” does not mean without reasoning. In 30 of the 36 runs without thinking, Qwen3-8B wrote out the steps in its answer anyway, for example for the equation or the trains, and answered correctly. Instruct-2507 solved “9,11 or 9,9” and “strawberry” the same way, writing “9,9 = 9,90” and spelling out the word in its visible answer. The difference from thinking mode is who decides: without thinking, the model chooses whether to write steps, and on the trick questions it chooses wrong; with thinking, the steps are mandatory.
  3. The cost is 3 to 5 times more tokens. On the 8B, the median rose from 225 to 752 tokens, and the total time for the 36 runs from 2 to 8 minutes. On the 30B-A3B, Thinking generated 5 times more tokens than Instruct, in 53 minutes against 10. The most expensive problem was the sum of numbers divisible by 3 or 5: 4,244 tokens on the 8B, 63 seconds, and 2,724 on the 30B, 187 seconds, for a four-digit answer.
  4. 30B Thinking was no better than 8B with thinking. Both scored 36 of 36. The problems are too easy to separate them; the difference between the two shows up in Qwen's AIME reports, not in our test. On our machine, the 30B took more than 6 times as long for the same result.
  5. All the thinking was in English, in all 72 runs with thinking, for questions asked in Romanian. On the knights problem, the 8B wrote “A=spion, B=knight” in its final answer, three times out of three, mixing the Romanian word for knave with the English word for knight. We counted the answer as correct, but it shows how the English of the thinking leaks into the answer.
  6. No loops this time. In the MoE article, Thinking-2507 had fallen into endless repetition on a request with a length limit. Here, without such a constraint, no run reached the 7,168-token cap. That is not a guarantee, just an observation over 72 runs.
  7. The split model's speed dropped from 19.4 tokens per second, measured in the MoE article with a 4,096-token context, to 14.6 here, with an 8,192-token context and answers of about a thousand tokens. The likely explanation: the larger window leaves fewer layers on the GPU, and every new token reads all the context before it. We did not measure the two effects separately.

The visible thinking is not all that mattered

So far, thinking has been a tool: tokens that buy compute. It is tempting to also read it as an explanation, a log of how the model reached its answer. An Anthropic study from April 2025 shows that this reading is risky.

The experiment's flow: a multiple-choice question with a slipped-in hint, the model changes its answer toward the hint, and the chain of thought mentions the hint in 25% of cases for Claude 3.7 Sonnet and 39% for DeepSeek R1
The models used the hint in their answer, but rarely mentioned it in their thinking.

The experiment: multiple-choice questions with a hint slipped in, for example “a Stanford professor indicates the answer is C”, or fake metadata containing the answer. The researchers first check that the model changes its answer toward the hint, so it used it. Then they read the thinking: does it mention the hint? Claude 3.7 Sonnet mentioned it in 25% of cases, DeepSeek R1 in 39%. On harder questions, the percentage drops. The chains that left out the hint were, on average, longer than those that mentioned it, so it is not a matter of brevity. In a second experiment, models trained to exploit wrong hints that were rewarded did so in over 99% of cases and said so in their thinking in under 2%.

The practical consequence: the visible thinking is useful for checking the calculation, not as proof of the reason. If a model tells you it chose supplier X “because it has the lowest price”, that sentence is generated text, with the same statistical faithfulness as any other text. Check the price, not the explanation.

How to check on your own computer

  1. Run ollama run qwen3:8b --think=false and ask “Which number is larger: 9.11 or 9.9?”. Then ollama run qwen3:8b --think with the same question. The first run includes loading the model.
  2. In an open session, /set think and /set nothink switch the mode without reloading the model. --hidethinking hides the thinking and shows only the answer, which is useful in scripts.
  3. From the API, send "think": true in the body of a request to /api/chat and read message.thinking separately from message.content:
curl http://localhost:11434/api/chat -d '{
  "model": "qwen3:8b", "stream": false, "think": true,
  "messages": [{"role": "user", "content": "Which number is larger: 9.11 or 9.9?"}]
}'
  1. Compare eval_count in the response, the number of generated tokens, between the two modes. The difference is the cost of thinking, in tokens; divided by eval_duration, in seconds.
  2. If the thinking will not stop, cap it with num_predict in the options and set presence_penalty between 1 and 2, as the model card recommends. Do not use temperature 0: the card warns explicitly that deterministic decoding produces endless repetitions.
  3. To repeat our test, download the script above and run node think-bench.mjs --host http://IP:11434 --out results.jsonl; it needs only Node 20 or later. The script writes every run, with the full thinking, to the given file, and --summary results.jsonl prints the table.

Where it does not fit

  • Office tasks. Summarizing an email, answering from a document or filling in a form has no “correct answer” for thinking to find. The token cost is the same, the gain is zero. For the office assistant, use no-thinking mode or the Instruct variant.
  • Machines split between GPU and CPU. On the 30B-A3B, split between 8 GB of VRAM and RAM, every thinking token costs almost five times more than on the 8B. The minutes of waiting add up.
  • Explanations for audits. The thinking is not a faithful log of the computation, as the Anthropic study shows. A report that cites “the model's reasoning” as justification documents nothing verifiable.
  • Our test. 12 problems and 3 runs are enough to see the effect, not to rank models. The problems are far below AIME level, so they do not separate the models from each other, and automatic grading on the “Răspuns final” line can miss a correct answer written differently. We measured no frontier model; the conclusions about them come from the cited reports, not from our tests.

How we do it

In Brio Argus, the AI assistant connected to a company's internal documents, questions about documents run without thinking: the answer comes from the passages that were found and cited, not from a calculation the model could check by itself. The platform has a benchmark between models, which we run on the client's hardware with the client's questions, exactly like the test above: the same set of questions, with and without thinking, on the local models available. The decision to turn thinking on is made on the numbers, for the types of questions where it changes the answer, not as a global setting.

If you have a local model and do not know whether it is worth turning on thinking for what you use it for, send us five typical questions from your company and your computer's configuration. We will tell you, with measured tokens and seconds, what you gain and what it costs you.

Frequently asked questions

Is a model that thinks smarter than one that does not?

Not in the sense of a different mechanism. The same weights file, Qwen3-8B, answers with or without thinking depending on a block of text in the template. With thinking, the model writes intermediate tokens that become context for the next tokens, so it spends more compute on the same question. On problems with a verifiable answer, the extra compute shows in accuracy; on an email summary, it does not.

Can I turn thinking off in Ollama?

Yes, for hybrid models like qwen3:8b: --think=false on the command line, /set nothink in a session or "think": false in the API. For qwen3:30b, which is the Thinking-2507 variant, the option has no effect, because the model was trained only with thinking; its non-thinking counterpart is qwen3:30b-instruct. Check which variant you are running with ollama show.

Why does the model think in English when I ask in another language?

Because the data it learned to think from is almost entirely in English and Chinese, as the DeepSeek-R1 report states explicitly. The model thinks in the language of its thinking examples and answers in the language of the question. The result does not suffer; the readability of the thinking does. If you want the thinking in your own language, you can ask for it in the prompt, but small models do not always follow the request.

Is it worth turning on thinking for my company's AI assistant?

For questions about documents, summaries and drafting, no: the answer has no solution for thinking to check, and the cost is many times more tokens, so many times more time. It is worth it for calculations, numerical checks, logic and code, where a wrong answer shows and costs something. The safest approach is to measure on your own questions, as we did: the same set, with and without thinking.

Can I trust the explanation the model shows?

As a check on the calculation steps, yes, because each step is text you can verify. As proof of why the model chose an answer, no. The 2025 Anthropic study showed that models use hints in the question that they do not mention in their thinking, in three cases out of four for Claude 3.7 Sonnet. The thinking is generated text, with the same faithfulness as the rest of the text.

Ollama on five computers: which model fits and how fast it runs

The same AI models run through Ollama on a PC with an RTX 3060 Ti, a laptop, a Mac mini M2, a mini PC and a server: what fits, how fast, which settings matter.

Read the article

Which local AI model writes code that works: 132 PowerShell scripts

Ten local AI model variants, 12 logic problems and 132 PowerShell scripts actually run: which ones write code that works and how the others fail.

Read the article

MoE models: how a 30B LLM runs on a PC with 8 GB of VRAM

What a Mixture of Experts model is, how Qwen3-30B-A3B is built from 128 experts per layer, and the speed we measured on a PC with an RTX 3060 Ti and 32 GB of RAM.

Read the article

Want to talk about your company’s IT?

Tell us what you are dealing with and we will reply with a concrete recommendation, with no obligation.