Furkan Kadir YılmazWriting

with thinking mode on, the model copies itself

why did mit's model get stuck so much more often than mine? with thinking mode on, 95 of 100 answers fell into a loop that copies the same lines. cutting the loop from the outside took correct answers from 10 to 35. i couldn't find a direction inside the model that breaks it.

Translated from the Turkish original

type
experiment
model
qwen3.5-0.8b
data
math-500 · 100 questions
setup
greedy and sampling · 4096 tokens · thinking on/off
gpu
colab t4
code
github
series
opening up the model · part 3
reading
15 min
lang
en · tr
status
ongoing

in the previous post i found a "finish" direction inside the model. pushing it made the model get stuck less, but the number of correct answers didn't budge. mit had taken the same model's score from 7.9% to 48.1%. i ended that post with two suspicions. in this one i tested them one by one.

my first suspicion was that the direction i found might not be the same thing as mit's. my direction looked at "will this answer get stuck". mit might have looked at the moments where the model repeats itself. my second suspicion was thinking mode. mit ran the model with thinking mode on, and i had kept it off from the start.

the repetition direction #

first i pulled out a direction that could be closer to mit's. i went through the 200 answers from the previous post token by token. at each token i checked whether the 8-token piece ending there had already appeared earlier in the answer. if it had, i counted that moment as "repeat", otherwise as "new". that gave 126,111 repeat moments and 185,213 new ones. the difference between the averages of these two groups inside the model became the repetition direction.1

this direction came out almost perpendicular to the finish direction. the cosine similarity between them is 0.14 (1 would mean the same direction, 0 completely unrelated). so the model keeps these two apart inside. honestly, that gave me some hope. then i tried the three edits closest to what mit did, again on 100 questions the model had never seen.

runstuckcorrectavg. tokens
unedited33411945
remove the repetition direction33381966
remove it with a factor of 1.5 (mit's formula)35361912
remove it only from the 64 columns that write it most30391948

none of them break the model, and none of them fix it either. stuck answers move between 30 and 35, correct answers between 36 and 41. looking at the answers one by one doesn't change the picture. removing the repetition direction unsticks 13 stuck answers, but this time 13 answers that used to finish get stuck. on 100 questions you can't tell differences this small apart from noise.2

thinking mode #

the second suspicion was the one i was really curious about. in thinking mode, before answering, the model thinks and checks to itself in a block that opens with a <think> tag. then it closes the block with </think> and writes the answer. i asked the same 100 questions with this mode on and left every other setting alone.

the result was even more extreme than i expected. all 100 answers hit the 4096-token limit and only 10 were correct. what really surprised me was what the answers looked like. with thinking mode off, the stuck answers circled around a doubt in different sentences. with thinking mode on, the model copies the same lines word for word.

my favorite example is the first question. 4 daps equal 7 yaps, 5 yaps equal 3 baps, how many daps equal 42 baps? the answer is 40. the model finds 40 already in the middle of its thinking:

$42 / 1.05 = 40 / 1 = 40$.

Let's re-verify the calculation.

then it starts checking and writes these three lines over and over until the limit:

Wait, $4 \text{ daps} = 7 \text{ yaps}$.

$5 \text{ yaps} = 3 \text{ baps}$.

So, 1 dap = $4.2 / 4 = 1.05$ baps.

to put a number on this, i slid a 200-word window over each answer. if at least 90% of the window was made of pieces that had appeared earlier in the answer, i counted the answer as falling into an exact loop there.

settinghits the limitexact loopcorrect
thinking off331241
thinking on1009510

in thinking mode 95 of 100 answers fall into an exact loop, and the loop usually starts around word 520. this is most likely what mit means by "93% of answers hit the limit". the reason i got 33% is that i kept thinking mode off.3

this could also explain mit's big gain. in thinking mode the model gets stuck on almost every question, and on some of them it gets stuck after it has already found the answer. if the loop is broken, the score could go up a lot. mit also writes that 576 of the 579 answers it rescued originally hit the limit, so they say the gain comes from stuck answers too. with thinking off the model already finishes most questions, so there are few loops to break. i measured how much breaking the loop gains at the end of the post.

do the directions break this loop #

since the loop is here, i tried both of my directions in thinking mode.

run (thinking on)exact loopword where the loop startscorrect
unedited9552410
light push toward the finish direction9157411
remove the repetition direction with a factor of 1.59536111

none of them worked. pushing toward the finish direction delays the loop a little, but the number of answers in a loop only drops from 95 to 91. of the 9 answers that stay out of a loop, only 1 finishes. removing the repetition direction makes the loop start earlier, which is the exact opposite of what i expected.

honestly, this was a bit of a letdown. my first thought was this. i had pulled out both directions from answers with thinking mode off. the loop in thinking mode happens inside the model's own thinking block, and the inside of the model could be in a different state there.

to test this, i pulled out the repetition direction again from scratch, this time from answers with thinking mode on. to keep it apart from the test questions, i had the model solve questions 0-99 in thinking mode and applied the same method.4 in these answers there are 297,038 repeat moments against only 61,362 new ones. so four fifths of the thinking text repeats something already written.

run (thinking on)exact loopword where the loop startscorrect
unedited9552410
remove the new repetition direction9845114
remove it with a factor of 1.5993986

this didn't work either. the number of answers in a loop goes up instead of down, and the loop starts earlier. removing it with a factor of 1.5 drops correct answers to 6. 14 correct looks like a gain at first glance, but on 100 questions the gap between 10 and 14 is at the edge of noise. on top of that, every answer still hits the limit.

it caught my attention that the same thing happened with two separate repetition directions. in both, removing the direction pulls the loop earlier instead of breaking it. i have a guess but haven't tested it yet. this direction might carry the information "i'm repeating myself", and the model might use it to brake the repetition. remove the direction and the brake goes with it.

breaking the loop from the outside #

when the directions didn't work, i tried breaking the loop in a cruder way. while the model was writing, i gave a small penalty to tokens it had already written (repetition penalty 1.1). this doesn't touch the inside of the model, it just makes it harder for the model to pick the same words again.

setting (thinking on)exact loopword where the loop startscorrect
no penalty9552410
repetition penalty 1.162108316

the penalty seems to work. exact loops drop from 95 to 62, the place where they start doubles, and correct answers go from 10 to 16. even so, 97 of the 100 answers hit the limit, and only 3 manage to close the thinking block. the answers show why. since the model can no longer copy the same lines, it writes the same doubt in other words. on the first question it finds 40 again, then asks:

Wait, why did I get 40 earlier?

then it does the same calculation again from the start. the word-for-word copy is only the part of the loop you can see from outside. underneath, the model just can't stop checking.

a longer limit #

there was one more objection. mit had used 32,768 tokens, i used 4096. maybe with a bit more room the model gets out of the loop on its own. i tried this on the first 25 questions with 16,384 tokens, four times the room.

nothing changed. none of the 25 answers managed to close the thinking block. 23 fell into an exact loop, most of them at exactly the same word. correct answers were 3 at both limits. with greedy decoding, once the model starts writing the same lines, giving it more room just means it writes the same lines more.

is greedy to blame #

so far i did everything with greedy, and that opens the door to a fair objection. greedy picks the most likely word at every step, so a model that falls into a repetition once might not be able to get out. maybe i'm the one producing the loop. qwen recommends two sampling settings for thinking mode on its model card, one for coding tasks and one for text tasks. in both, the model picks each word with a bit of a dice roll. i asked the same 100 questions with both settings. the code setting uses the same temperature mit used.5

thinking onhits the limitexact loopword where the loop startscorrect
greedy1009552410
code setting10061112311
text setting, with repetition penalty990-8

the code setting reduces and delays the word-for-word copying, but the model still can't finish a single question. only one of the 100 answers closes the thinking block.

the text setting also has a repetition penalty (presence_penalty 1.5). this penalty ends the word-for-word copying completely, none of the 100 answers falls into an exact loop. even so, 99 answers hit the limit and correct answers drop to 8. looking at the answers, the model keeps doing the same checking, just in other words on every round. on the first question, right before the limit, it writes this:

$1 \text{ D} = \frac{4}{7} \text{ Y}$. Correct.

Okay, this seems consistent.

since 4 daps equal 7 yaps, 1 dap equals 7/4 yaps. so while checking, the model calls a wrong equation "correct".

in short, greedy doesn't create the loop, and the repetition penalty doesn't break it. both only change what the same endless checking looks like. with greedy it's a word-for-word copy, with the penalty the same doubt comes back in other words on every round.

what happens when you cut the loop #

so far i kept saying "if the loop is broken, the score goes up" without ever measuring it. i measured it in the crudest way. i cut every answer at the word where its loop starts, added the </think> tag that closes the thinking block, and let the model write its final answer. i didn't touch the inside of the model at all.6

thinking on, same 100 questionscorrect
doing nothing10
cutting where the loop starts35
cutting at the end of 4096 tokens33
for comparison: thinking off41

cutting the loop takes correct answers from 10 to 35. not a single question that was correct in the baseline turns wrong after the cut, and 25 questions go from wrong to right. in some of them the model had already found the answer inside its thinking and just couldn't say "done". in the rest, the right answer shows up in the final answer it writes after the thinking closes.7 this fits mit's finding that the gain comes from stuck answers.

still, the two results can't be compared one to one. mit gives the median length of the edited model's correct answers as 9,172 tokens and uses it as evidence that the model wasn't just forced to stop early. that is well above my 4,096-token limit, so in my setup even a successful edit could have looked stuck. what my cut shows is how much of that gain comes back without touching the inside of the model at all.

two more things caught my attention. cutting where the loop starts and cutting at the end of 4096 tokens give almost the same result, 35 and 33. so the part spent in the loop adds nothing to the answer, it just takes up room. second, even with the loop broken there are 35 correct, while with thinking mode off there are 41. with my settings, a model this size gains nothing from thinking mode. thinking mode only puts it into checking it can't finish.

where i ended up #

for three posts now i've been looking inside the same model, and here's what i'm left with.

  • if the model is going to get stuck, it already shows inside the model in the first paragraph of the answer.
  • this signal works like a finish axis. pushing one way makes the model get stuck more, pushing the other way less. the number of correct answers doesn't go up.
  • with mit's settings the model falls into a loop that copies itself word for word on almost every question. cutting the loop from the outside takes correct answers from 10 to 35. as mit also says, most of the gain seems to come from stuck answers.
  • the three directions i found by hand, including the one i pulled from thinking mode, couldn't break this loop. a repetition penalty from the outside reduces the word-for-word copying, and qwen's recommended setting ends it completely. the model still keeps the same doubt going in other words, and correct answers don't go up. a longer limit changes nothing either.
  • mit's astra either found something inside the model that i couldn't, or it did something else along with the edit. i couldn't tell these two apart.

i had wanted to look myself instead of leaving the job to astra. i found where the loop is and what you gain when it breaks. i didn't find the knob inside the model that breaks it. i wanted to write down the part i didn't find here, as it is.

has someone done this before #

after finishing the post i looked at how much of what i used had been tried before. most of it had. pipis and colleagues showed that small and distilled models loop at low temperature and with greedy, and that raising the temperature is only a stopgap. duan and colleagues caught loops from inside the model before they start, and xie and colleagues cut looping answers and had them rewritten.

the closest work is nguyen and colleagues on pruned models. they also showed that the right answer is often already written in answers that never finish, and that there is a direction that pushes the model to finish. in their case that direction raises correct answers too, while my finish direction didn't raise them at all. i don't know where that difference comes from. thinkedit removed a direction that controls thinking length from the weights, and arditi and colleagues removed a direction from the weights with W − αu(uᵀW) earlier, for refusal.

what i did was put these pieces side by side on the same model mit edited and check which one actually carries the score.

in the next post i move on to a different question. does a model that speaks turkish think in english in its head?

the code and raw answers are on github.

Footnotes

  1. since the inside of the model is different at the start and end of an answer, i took both groups only from positions after token 512. the direction is from floor 15. i made the edits on floors 8 to 22 by applying W − αu(uᵀW) to the weights. the "64 columns" run is limited to the 64 columns in the mlp of floors 15 and 19 that write the direction most. ↩

  2. i first ran these runs on november 8. the colab session reset and the raw answers were gone, so i reran all of them, including the unedited baseline, in the same session. the repetition direction came out exactly the same (the same 126,111 and 185,213 moments, the same 0.14 similarity with the finish direction). the numbers differ from the first run by a few questions. the biggest difference is in removing with a factor of 1.5, 35 stuck instead of 41. in the first run the baseline came from an earlier session, this time everything ran on the same library version. ↩

  3. mit used a 32,768-token limit, i used 4096. that's why my count of answers that "hit the limit" in thinking mode comes out high in every case. the exact loop, on the other hand, doesn't depend on the limit. further down i reran 25 questions with 16,384 tokens, and the result didn't change. ↩

  4. thinking mode on, questions 0-99, the same 8-token definition of repetition, again positions after token 512 and floor 15. the new direction's similarity with the finish direction is 0.09. the edit was W − αu(uᵀW) on floors 8-22. since the colab session reset before these runs, i reran the unedited baseline in the same session too. the numbers came out exactly the same as the first run (10 correct, 95 loops, word 524). ↩

  5. the code setting is temperature 0.6, top_p 0.95, top_k 20. the text setting is temperature 1.0, top_p 0.95, top_k 20, plus presence_penalty 1.5 to reduce endless repetition. both use seed 0 and a single sample. the library i used (transformers) has no presence_penalty, and its repetition_penalty works in a different way. so i wrote the penalty myself. i followed vllm's order, the penalty first, then temperature, top_k and top_p. the penalty only applies to tokens the model wrote in this answer, not to the question itself. repeating with a few seeds could move the numbers by a few questions, but it's unlikely to change the result that 99-100 out of 100 hit the limit. mit used temperature 0.6 together with presence_penalty 1.5. i didn't try those two together. ↩

  6. in the literature this is called "budget forcing", and the idea comes from the s1 paper. i added </think> to the cut answer, had the model write at most 1024 more tokens with greedy, and scored only this new part. within 1024 tokens 40 of the answers finished, and in the rest the model ran out of room while writing its final answer. so 35 is a lower bound. compared with the baseline, 25 questions went from wrong to right and none the other way (mcnemar p < 0.0001). for the 5 answers that never fell into a loop, the two conditions are the same. ↩

  7. i also repeated the same cut token by token instead of word by word (34 correct) and scored the thinking at the moment of the cut separately. in 14 questions the right answer was already written inside the thinking. ↩

opening up the model

  1. 1 the model knows but can't decide
  2. 2 the model has a finish button
  3. 3 with thinking mode on, the model copies itself
  4. 4 does a turkish-speaking model think in english?