Why a reasoning model keeps thinking after it has the answer, and how LoCo teaches it to stop
LoCo from Tencent and Xi'an Jiaotong University finds the moment a reasoning model starts going in circles, using its own traces, and teaches it with DPO to wrap up there. How it was trained and how to try it.
Ask an AI this: "If July 3, 2030 is a Wednesday, what day is July 14?" DeepSeek's 7-billion-parameter reasoning model gets there in a few steps: Sunday. Then it checks by counting the calendar day by day, and checks again with modular arithmetic. Then it tries a date formula, drops it, recounts the whole calendar and says Sunday once more. In this real example from the researchers' paper, the model writes another 986 tokens after it already has the answer; 212 tokens from the same point would have done. LoCo, published on 3 November by researchers at Tencent's WeChat AI and Xi'an Jiaotong University, teaches a model to recognise exactly that moment. The resulting LoCo-7B is on Hugging Face under the MIT licence.
According to the authors' paper, the result stands out: on five maths benchmarks the model's answers get 41.7% to 45.4% shorter while accuracy holds or improves. More interesting still, the model was trained only on maths problems, yet it also thinks 23.4% to 36.3% less when writing code, and keeps or improves accuracy on all three coding benchmarks. Below we explain what overthinking is, how LoCo tackles it, how the model was trained step by step, and how to try it on your own machine.
The problem: a model that found the answer and keeps going
Reasoning models such as DeepSeek-R1, OpenAI's o series or the thinking versions of Qwen run a long internal monologue before they answer. This is the chain of thought: the model forms hypotheses, calculates, corrects itself and checks the result. On hard problems it makes models far more capable. But every token costs compute, waiting time and memory. If an answer takes 15,000 tokens instead of 4,000, the user waits longer and the server bill grows.
Researchers have shown for a while that models keep reasoning after they reach the answer, which the literature calls overthinking. Picture a student who solves an exam question correctly, re-checks it five different ways and runs out of time. Building on earlier work, the LoCo paper makes a key observation: when a model can solve a problem, the issue is when it chooses to stop. It often finds the right answer early, then leans towards thinking on.
Existing fixes take two routes. One puts short and long correct solutions to the same problem side by side and teaches the model to prefer the short one; Kimi k1.5's Long2Short stage and O1-Pruner work this way. The other prunes redundant words or sentences from the reasoning text; TokenSkip and TokenSqueeze belong to this family. LoCo proposes a third route: teach the decision at a specific moment in the reasoning, "should I continue from here or wrap up?" Think of showing a driver which junction to turn at, instead of just saying "always take the short way".
How LoCo works: three steps
Step one: catch the overthinking moment. The researchers split the model's own reasoning text into paragraphs, or steps. They feed the text back to the model and record how much probability it gives its top guess at every token. The average over a step is that step's confidence. The second signal is volatility: how sharply confidence changes from the previous step. A step whose confidence sits in the model's bottom 25% and whose volatility sits in its top 25% becomes a candidate. Using both matters: low confidence can come from a genuinely hard sub-problem, and high volatility from a legitimate change of approach. Together they mark a model that is both uncertain and unstable. The detector only looks at text written up to that point, so it never sees the part it will cut.
Candidates then go to a larger judge model, Qwen3-30B. The judge reads the problem, the reasoning so far and the next step, and gives one of three labels: overthink if it re-deliberates on settled information, normal if it makes real progress, final if it presents the answer. The distinction matters because models end their reasoning by restating and boxing the answer, which looks repetitive but is needed to read the answer out. Only points the judge confirms as overthinking survive.
Step two: write a shorter ending from the same point. The reasoning is frozen at the chosen point and the model continues from there eight times. Among the continuations that reach the correct answer, the shortest is kept. If none is correct, or even the shortest is longer than the original, the point is dropped.
Step three: teach the preference. Now there are two endings from the same start: the short correct one is "chosen" and the model's original long continuation is "rejected". These pairs are taught with DPO (Direct Preference Optimization). Think of DPO as a writing tutor who skips building a scoring system, shows the student two versions of the same paragraph and says "prefer this one". Over time the model learns to see the chosen ending as more likely and the rejected one as less likely. What sets LoCo apart is that the comparison never spans the whole solution: because the start is shared, the model learns only "stop at this point", and keeps its ability to think longer on hard problems.
How it was trained
The base model is DeepSeek's DeepSeek-R1-Distill-Qwen-7B. All training data comes from this model's own output, with no externally written answers. The question pool is math14k, the maths-only set from the TokenSqueeze work: 14,027 questions. The model produced three solutions per question (temperature 0.6, top-p 0.95) and the shortest correct one became the source text, so each question contributes at most one trace.
Confidence and volatility thresholds were computed once from the model's own traces. To stop traces with many candidates from dominating, each trace kept at most 10 candidate points, and Qwen3-30B-A3B-Instruct-2507 served as judge. Each confirmed point got 8 fresh continuations. A pair was kept only if it saved at least 300 tokens; each question kept at most 3 pairs, picking the biggest savings. Prefixes were capped at 6,000 tokens and continuations at 12,000.
Training froze the base model and added a LoRA adapter, a cheap method that trains small extra layers instead of the whole network. The adapter has rank 256, scaling factor 512 and dropout 0.05, attached only to the q, k, v and o projections of the attention layers. Training ran for two epochs with an effective batch size of 64, a learning rate of 0.00001, a cosine schedule, 10% warm-up, the AdamW optimiser with weight decay 0.01 and gradient clipping at 1.0. The DPO temperature beta was 0.1, with the base model itself as the reference. It ran on four Nvidia H20 GPUs with sequences up to 14,336 tokens. The released LoCo-7B is that adapter merged into the base model.
What they tried and what fell short
The most instructive part of the paper is the set of experiments where the authors change one piece of the method at a time. First they removed the local structure entirely, pairing the shortest and longest correct full solutions of each question. Accuracy stayed similar, but responses got only 5.2% shorter on AMC 2023, 11.1% on AIME 2024 and 15.8% on AIME 2025, against LoCo's 41.7%, 45.4% and 45.2%. The authors' takeaway: preferring short reasoning is not enough, you also have to show where to cut.
Next, GPT-5.4 wrote the short continuations instead of the model itself, with the same points and rejected endings. This also compressed (31.8% on AIME 2024) but trailed LoCo. The authors' explanation is style: the model's own continuations sit closer to how it naturally reasons, so they give a stronger learning signal. Finally, cut points were picked at random or at even intervals instead of by the detector. Compression stayed around 40%, but accuracy fell: 48.33% on AIME 2024 with random cuts and 48.75% with even spacing, against 50.83% for the base model. The detector's points cluster in the second half of the reasoning (mean relative position 0.57), while random ones cut earlier, before the model has settled.
How good it is
Each question was answered eight times and the table shows averages. The base model is DeepSeek-R1-Distill-Qwen-7B:
| Benchmark | Accuracy: base / LoCo | Avg tokens: base / LoCo | Shorter by |
|---|---|---|---|
| MATH-500 | 91.88% / 91.80% | 4,015 / 2,243 | 44.1% |
| AMC 2023 | 90.31% / 91.56% | 6,285 / 3,663 | 41.7% |
| Olympiad | 61.33% / 62.78% | 8,972 / 4,968 | 44.6% |
| AIME 2024 | 50.83% / 54.17% | 13,493 / 7,364 | 45.4% |
| AIME 2025 | 37.92% / 40.42% | 15,134 / 8,291 | 45.2% |
| MBPP (code) | 84.05% / 84.05% | 3,403 / 2,167 | 36.3% |
| LiveCodeBench (code) | 41.77% / 42.51% | 12,319 / 9,278 | 24.7% |
| CodeContests (code) | 18.48% / 20.61% | 14,900 / 11,413 | 23.4% |
Among the other methods compared, TokenSqueeze also compresses hard but loses accuracy as problems get harder: on AIME 2024 it lands at 48.75% with 10,457 tokens. DAST can even lengthen answers on harder tests. On the three hardest maths benchmarks, LoCo posts both the highest accuracy and the highest efficiency curve (the area under accuracy across token budgets). One note: AIME has only 30 questions, so scores swing by plus or minus 4 to 6 points and small gaps sit inside that range.
How to try it
LoCo-7B shares its base model's architecture and has about 7.6 billion parameters. In bfloat16 it needs roughly 15 GB of GPU memory, so a 24 GB card runs it comfortably. With vLLM, following the model card:
pip install vllm
from vllm import LLM, SamplingParams
model = LLM(model="MuyaoYuan/LoCo-7B", max_model_len=36864, dtype="bfloat16")
tok = model.get_tokenizer()
prompt = tok.apply_chat_template(
[{"role": "user", "content": "Your question here. Please reason step by step, and put your final answer within \\boxed{}."}],
tokenize=False, add_generation_prompt=True)
output = model.generate([prompt], SamplingParams(temperature=0.6, top_p=0.95, max_tokens=32768))
print(output[0].outputs[0].text)Recommended settings are temperature 0.6 and top-p 0.95; for maths, add the sentence above so the answer comes in a box. To apply the same recipe to your own model, the GitHub repository has all the code from data generation to training and evaluation: six scripts that roll out solutions, keep the shortest correct one, detect overthinking points, re-check them with the judge, regenerate and build the DPO pairs. Qwen3-30B-A3B is suggested as judge and a four-GPU DeepSpeed setup for training. Model and code are MIT licensed, so downloading, modifying and redistributing, commercial use included, are all allowed.
The appealing part of LoCo is that it learns from the model's own reasoning traces, without leaning on a teacher model or human labels. Applied to larger reasoning models, the same idea could cut waiting time and compute costs substantially. We have also covered another study of where reasoning changes course, Goodfire's work on forking words. All results are the authors' own measurements; no independent evaluation has been published yet.
Sources: LoCo-7B model card, Paper (arXiv 2611.04814), GitHub repository, Base model