Why Qwen3.8-27B Overthinks in Coding Tasks and How to Mitigate That

By Pekka Enberg — November 2026

Qwen3.8-27B is a powerful model that you can run even on your laptop, but if you have tried it as a coding agent, you have probably noticed it going in circles, thinking at length and unable to make progress a lot of the time. You are not the only one: the Hugging Face discussions have threads where the thinking eats the whole context window and where it falls apart on long agent tasks.

The root cause for Qwen3.8-27B running in circles is in its thinking phase. Qwen3.8-27B is a reasoning model, which means that to respond to a prompt, the model generates a chain of thought before making the final response. The more the model thinks, the better it can reason about hard problems. However, in Qwen, the model overthinks so badly with the default settings that Simon Willison, for example, suggests using low or even no reasoning.

I hit the same wall building dwim, my coding agent, which bundles a model and a harness to run a coding agent locally by default. After a lot of head-scratching, it turns out the harness can do a lot. With harness-level tweaks, dwim resolves 64% of issues versus OpenCode's 52% on 50 SWE-bench issues with the same model, in a third of the time.

What Is Overthinking?

Overthinking is a failure case for a reasoning model when it stalls because it thinks too much. As an example, the first version of dwim ran Bonsai, PrismML's ternary build of Qwen3.8-27B. The coding agent would find the bug quickly, often even working out the correct fix, and then go into a long thought and never make the change. PrismML's own known issues for that build say it "tends to reason at length, which costs time and tokens even when the answer is correct" and recommend a thinking budget.

When I analyzed those long thoughts, the model was rarely reasoning about code it had actually read or tool output it had in its context. Instead, it was recalling from memory how the code works and going back and forth over it by constantly doubting itself with "I think", "I recall", and "wait" phrases, when all the model had to do was to re-read the code. In one run I looked at closely, the model found the bug in a function it had just read, then read the same function again and thought it all through a second time, for example.

Cuadron et al. call this the reasoning-action dilemma. In a task, a reasoning model has to choose between thinking further and acting on the environment, and it often thinks when it should act. They describe three patterns: analysis paralysis (long reasoning instead of acting), rogue actions (several actions at once without waiting for their results), and premature disengagement (deciding it's done without checking). Cuadron et al. discovered that more overthinking correlates with lower success on SWE-bench, and that reasoning models overthink more than non-reasoning ones.

Mitigation

The first mitigation for overthinking is to limit thinking to a certain number of tokens. In dwim, I ended up picking 2048 tokens as the hard limit based on what I empirically saw in SWE-bench thinking traces. Of course, the thinking limit may be too aggressive for harder tasks, but so far I did not see better results from Qwen3.8-27B with more thinking; quite the opposite.

The second mitigation, and the one I think matters most, is what the model is told when its thinking is forced to end at the limit. When Qwen3's own thinking budget runs out, it appends the following sentence and ends the thinking, as described in the Qwen3 technical report:

Considering the limited time by the user, I have to give the solution based on the thinking directly now.

In a coding agent, that makes the model answer from what it recalled. dwim instead ends the thought with a sentence, in the model's own voice, that pushes it to act. If the model hasn't called a tool yet in this turn, it is told to check:

I am not certain of this from memory, so I will check it in the code now with a tool, and decide from what it shows.

If it has, it is told to decide:

I have thought about this enough, and what I need is in the output above. I will go with what I have worked out rather than go over it again: if there is a change to make, I make it now with edit, and otherwise I reply with it.

With a hosted model, dwim can't write into the thought, so it stops the reply at the limit and asks again with the thought and the closing sentence, this time with reasoning turned off. Without that, the model keeps thinking.

The third mitigation is to tell the model in the system prompt to notice when it is recalling instead of reading:

While you think, notice when you are recalling how code works rather than reading it: "I think", "I recall", "I believe", "probably". [...] Stop the thought there, and read or run that code instead. The same goes for going back and forth: when you have written "wait" or "actually" about the same question twice, stop and find out with a tool. One read or one run settles what more thinking will not.

Finally, there are smaller nudges:

Evaluation

Methodology

To measure the impact of the harness mitigations, I ran dwim (commit a8aa882) and OpenCode 1.19.6 over SWE-bench Verified Mini, 50 GitHub issues from Django and Sphinx, both with Qwen3.8-27B through Vercel's AI Gateway. Each issue gets 10 minutes, shell commands run in the issue's SWE-bench Docker image with no network, and the patch is graded by the official SWE-bench harness. One run each.

Both agents ran with their default settings. What differs is the reasoning effort each asks for, how each one limits thinking, and how it samples. dwim's settings are what the transcript of each of its 50 sessions says it was started with, and OpenCode's are from the OpenCode source:

dwimOpenCode
Reasoning effortlowNot sent (no --variant), so the gateway's default
Thinking limit2,048 tokens. dwim cuts the thought and asks again with reasoning offNone
Max output tokens32,76832,000
Temperature0.6Not sent (the provider's default)
Top-p0.95Not sent (the provider's default)
Context131,072 tokens, then compaction262,144 tokens

To reproduce the runs from a dwim checkout, run the following steps:

> evals/swebench/run.py --pull
> evals/swebench/run.py -- --provider vercel
> evals/swebench/run.py --agent opencode

Results

As Table 1 shows, dwim resolved 64% of the issues against OpenCode's 52%, while thinking about a quarter as much and taking a third of the time on the median issue.

Table 1: SWE-bench Verified Mini results for dwim and OpenCode.
AgentResolvedMade a patchThinking tokens (median run)Time (median)
dwim64% (32 of 50)98% (49 of 50)6,27055 s
OpenCode52% (26 of 50)72% (36 of 50)22,610169 s

dwim resolved 9 issues that OpenCode didn't, and OpenCode 3 that dwim didn't. With one run each, that leans towards dwim but isn't conclusive.

Most of the gap in resolved issues comes from OpenCode stopping early. In 8 of its 14 issues without a patch, the model announced its next step, like "Let me reproduce the bug first", without calling a tool, and opencode run took that as the end of the task. This is the failure the "go on" nudge from the mitigations above is for: dwim tells the model to carry on, and it made a patch for 49 of 50 issues against OpenCode's 36.

Summary

Qwen3.8-27B overthinks in coding tasks because it reasons from memory about code it could simply read. You don't have to turn reasoning off completely to fix that. Instead, the harness can keep the thinking short and push the model to act. With the mitigations in this post, dwim resolved 64% of 50 SWE-bench issues against OpenCode's 52% with the same model, in a third of the time.

You can find the dwim source code at github.com/dwim-sh/dwim.