alphaFeedback

WorksComputer Science

When Do Repetition Loops Lock? Truncation Sampling, Bounded Penalties, and a Blind Spot in DRY

AI contributions
  • Claude
View details

Abstract

Language models sometimes repeat verbatim until the generation limit. We study the exit rather than the entrance: given that a span has already been repeated nn times, when is escape still possible? Along the loop the context is deterministic, so loop survival under any sampler can be computed exactly from one forward pass. Pure sampling leaves a positive escape probability at every step; top-pp with threshold π>1/2π>1/2 locks a position exactly when the continuation probability reaches ππ. A bounded penalty can leave a position locked; a penalty that outgrows the model's preference for the loop over unseen tokens guarantees escape under top-pp. The same analysis predicts a blind spot in the widely deployed DRY sampler: its sequence breakers cap the penalty at λbg−1−aλb^{g-1-a} for loops whose longest breaker-free run has gg tokens. On eleven open models, 66% of locked units with g=6g=6 stay locked under DRY and 1% with g=8g=8. In free generation with llama.cpp, all 109 loops that survive DRY have g≤7g\le 7. We propose DRY-C, which adds a term that grows exponentially with the number of verbatim recurrences, up to its look-back window. With it, none of 720 structured-output generations looped to the length limit, and task completion stayed close to DRY's.

Introduction

Open-weight models can repeat a line until the token budget is exhausted, including inside reasoning, JSON and tool calls. The phenomenon is old [14], and its onset has been studied from several angles: the self-reinforcing rise of repetition probability (Xu et al., 2022), properties of the transition matrix [7], training data [20], and, most recently, learning errors in reasoning models [30].

This paper asks the complementary question. Suppose a loop has started. Why can the model not get out, and which decoding-time interventions can in principle get it out?

Our starting observation is that, conditioned on staying in a loop, the context is a deterministic sequence. Every sampler, including history-dependent penalties, therefore assigns a deterministic probability to “continue the loop” at each step, and the probability that a loop survives mm more repetitions is a product of such numbers (Proposition 1). Teacher forcing supplies the logits without sampling loop trajectories.

Truncation can remove the exit. Under pure sampling every step has a positive escape probability. Under top-pp with the usual threshold π>1/2\pi> 1/2, a position is locked (the loop token is the only candidate) exactly when its raw probability qq satisfies q≥πq \ge\pi (Theorem 1). Measured reinforcement curves cross this threshold within a few repetitions. In our finite-horizon tests, 80%–100% of sampled units are locked through the last ten repetitions under top-pp 0.9, compared with none under pure sampling; the units include corpus sentences and hand-written structured spans.

Penalty growth determines the available guarantee. For an additive logit penalty dd on the loop token, locking persists whenever logit⁡(q)−d≥logit⁡(π)\operatorname{logit}(q) - d \ge\operatorname{logit}(\pi) (Theorem 2). A bounded penalty only raises the threshold at which locking sets in. Escape is guaranteed under top-pp once the penalty outgrows ln⁡(q/r∘)\ln(q/r^\circ), where r∘r^\circ is the raw mass of tokens not yet in the context and therefore unpenalized (Corollary 2). A full-context frequency penalty grows fast enough as long as r∘r^\circ stays bounded below; presence penalties and windowed frequency penalties come with no such guarantee.

DRY has a blind spot, and it can be closed. DRY [35, 37] penalizes a token exponentially in the length of the verbatim match it would extend, and is widely used in local inference. To protect formatting, matches may not cross sequence breakers (newline, colon, quote, asterisk). We show that for a loop whose longest breaker-free run has gg tokens, the penalty on the loop token is at most λbg−1−a\lambda b^{g-1-a} (Proposition 4): on such loops DRY is a bounded penalty. The prediction is borne out in a dose–response experiment, in the unmodified llama.cpp sampler, and in free generation, where every one of the 109 loops that appear with DRY enabled has g≤7g \le7. We then add a count term that penalizes how many times the same continuation has already occurred, prove that the resulting sampler, DRY-C, penalizes every loop exponentially, breakers or not, up to its look-back window (Proposition 5), and show that it eliminates run-to-the-limit loops in two model families.

This matters most for structured output: under default settings our prose prompts loop in 0%–7% of generations and structured prompts in 16%–21%, and breakers are densest there.

Related Work

Why loops start. Holtzman et al. [14] documented degenerate repetition under likelihood-maximizing decoding and introduced nucleus sampling. Fu et al. [7] analyzed repetition through a Markov model of the transition matrix. Xu et al. (2022) measured a self-reinforcement effect: the probability of repeating a sentence rises with the number of previous repetitions; our reinforcement curves extend this measurement to current instruction-tuned and reasoning models and to 200 repetitions. Li et al. [20] traced repetition to training data, Yao et al. (2025) and Mahaut and Franzon [22] to internal features and mechanisms. Pipis et al. [30] explain why reasoning models enter loops through learning errors and study the role of temperature, keeping each model’s default truncation and explicitly setting penalties aside. Lee et al. [19] separate loop entry from loop persistence in pruned models, relate persistence to the escape mass that the sampling set leaves to alternatives, and address both with fine-tuning objectives. We take the loop as given, work at decoding time, and characterize when that escape mass is exactly zero; these views are complementary.

Truncation samplers. Top-pp ([14]), min-pp ([26]), typical sampling ([23]), and related truncation rules ([12, 6, 1]) are motivated by the unreliability of the distribution’s tail. We point out a side effect: truncation turns a near-certain continuation into a certain one.

Repetition penalties. The multiplicative penalty of Keskar et al. [15], presence and frequency penalties, training-time remedies ([38] (Xu et al. 2022)), contrastive search ([33]), and penalty decoding with a forgetting window ((Zhu et al., 2023)) all discourage reuse of tokens; hard nn-gram blocking ([29, 16]) forbids it outright. Ginart et al. [10] derive a penalty from LZ77 code lengths. Wang et al. [34] compare remedies in a production setting. Grammar-constrained decoding ([39, 4]) guarantees well-formed structured output but does not stop a valid record from being repeated. DRY (Weidmann, [35]}) acts on repeated continuations rather than repeated tokens; Weidmann et al. [37] evaluate it at scale, report roughly halved loop rates, and show that removing sequence breakers damages formatting while lowering their loop metric slightly further, treating breakers as a structure-preserving benefit. We characterize the cap, the loops it can leave locked, and a count-based modification that retains breakers. Further decoding and monitoring approaches are discussed in Appendix E.

Setup

Let VV be the vocabulary. Fix a prefix and a loop unit u=(u1,…,uL)∈VLu=(u_1,\ldots,u_L)\in V^L. In state (n,l)(n,l), with n≥0n\ge0 and 1≤l≤L1\le l\le L, the context is the prefix, followed by nn complete copies of uu, followed by u1,…,ul−1u_1,\ldots,u_{l-1}; the model is about to produce the ll-th token of copy n+1n+1. Write pn,lp_{n,l} for the model’s next-token distribution in this state, and

qn,l=pn,l(ul),an,l=max⁡v≠ulpn,l(v)q_{n,l}=p_{n,l}(u_l), \qquad a_{n,l}=\max_{v\ne u_l}p_{n,l}(v)

for the raw probability of continuing the loop and of the strongest rival. We drop subscripts when no confusion arises.

A sampler SS maps the history, meaning the tokens so far together with the model’s logits at every step (which the tokens determine), to a distribution over the next token, possibly using internal randomness independent of the history. Along the loop the history is determined by (n,l)(n,l), so the probability that SS emits ulu_l is a deterministic number qn,lSq^S_{n,l}; this includes samplers with internal state such as Mirostat. Let Qn=∏l=1Lqn,lSQ_n=\prod_{l=1}^{L}q^S_{n,l} be the probability of completing one more copy. State (n,l)(n,l) is locked if qn,lS=1q^S_{n,l}=1; repetition nn is locked if Qn=1Q_n=1. Starting with kk copies in context, let Tk∈{0,1,…}∪{∞}T_k\in\{0,1,\ldots\}\cup\{\infty\} be the number of further complete copies produced before the first deviation.

Proposition 1 (Survival). For any sampler, P(Tk≥m)=∏j=kk+m−1Qj\mathbb{P}(T_k \ge m)=\prod_{j=k}^{k+m-1}Q_j and P(Tk=∞)=∏j≥kQj\mathbb{P}(T_k=\infty)=\prod_{j\ge k}Q_j.

The proof is the chain rule (Appendix § 10). Its practical content is that loop survival under any sampler is computable exactly from the logits along the repetition path. We distinguish three notions: a position is not locked (qS<1q^S<1); there is no permanent lock (no n0n_0 beyond which every repetition is locked); and the loop ends almost surely (P(Tk=∞)=0\mathbb{P}(T_k=\infty)=0).

Truncation Can Lock Loop Positions

Proposition 2 (Pure sampling). If SS only rescales temperature, no state is locked. Moreover P(Tk=∞)>0\mathbb{P}(T_k=\infty)>0 if and only if ∑j≥k(1−Qj)<∞\sum_{j\ge k}(1-Q_j)<\infty, and if Qj≤Q‾<1Q_j\le\overline{Q}<1 for all j≥kj\ge k then E[Tk]≤Q‾/(1−Q‾)\mathbb{E}[T_k]\le\overline{Q}/(1-\overline{Q}).

Truncation changes the picture qualitatively. We use the standard definitions. Top-pp with threshold π∈(1/2,1)\pi\in(1/2,1) keeps token vv iff the total probability of tokens strictly more probable than vv is below π\pi. Min-pp with ratio β∈(0,1)\beta\in(0,1) keeps vv iff p(v)≥βmax⁡wp(w)p(v)\ge\beta\max_w p(w). Greedy decoding keeps the most probable token. We assume no exact ties among the largest probabilities, which holds almost surely for real-valued logits; implementations break ties by token order.

Theorem 1 (Lock criteria). For top-pp let π∈(1/2,1)\pi\in(1/2,1); for min-pp let β∈(0,1)\beta\in(0,1). State (n,l)(n,l) is locked (a) under top-pp iff q≥πq\ge\pi; (b) under min-pp iff ln⁡q−ln⁡a>ln⁡(1/β)\ln q-\ln a>\ln(1/\beta); (c) under greedy decoding iff q>aq>a. If the condition holds at every position for all n≥n0n\ge n_0, then P(Tn0=∞)=1\mathbb{P}(T_{n_0}=\infty)=1.

Whether a position locks can therefore be read off the reinforcement curve n↦qn,ln\mapsto q_{n,l}. Top-kk applied before top-pp (the default order in llama.cpp) renormalizes over the kk retained tokens: the state is then locked iff ulu_l is retained among the top kk tokens and q/mk≥πq/m_k\ge\pi, where mkm_k is their total raw probability. For a retained loop token, this renormalization can only make locking easier.

Temperature and sampler order. Temperature τ\tau maps pp to p(τ)∝p1/τp^{(\tau)}\propto p^{1/\tau}. Its effect depends on where it sits in the chain.

Proposition 3 (Temperature). (A) If truncation precedes temperature (the default order in llama.cpp), the criteria of Theorem 1 are unchanged. (B) If temperature precedes truncation (the default in transformers) and τ≤1\tau\le1, then for top-pp

logit⁡(q)≥τlogit⁡(π)⇒locked\operatorname{logit}(q)\ge\tau\operatorname{logit}(\pi)\Rightarrow\textit{locked}
⇒ln⁡qa≥τlogit⁡(π),\Rightarrow\ln\frac{q}{a}\ge\tau\operatorname{logit}(\pi),

and for min-pp, for every τ>0\tau>0, the state is locked iff ln⁡q−ln⁡a>τln⁡(1/β)\ln q-\ln a>\tau\ln(1/\beta).

With π=0.9\pi=0.9 and τ=0.7\tau=0.7 in order (B), the sufficient threshold drops from q≥0.9q\ge0.9 to q≥0.823q\ge0.823: lowering the temperature does not merely sharpen the distribution, it lowers the bar for becoming trapped. The case τ>1\tau>1 is treated in Appendix § 10.

Penalties: Bounded versus Growing

An additive penalty subtracts d(v)≥0d(v)\ge0 from the logit of vv before truncation, where dd may depend on the history. Let d=d(ul)d=d(u_l) and let r∘r^\circ be the raw probability mass of tokens absent from the context; we assume this untouched set is nonempty, so r∘>0r^\circ>0.

Theorem 2 (Penalized continuation). Assume n≥1n\ge1, so the loop token has appeared in the context, and r∘>0r^\circ>0. After the penalty, the loop token has probability

q′=qe−dqe−d+∑v≠ulp(v)e−d(v).q'=\frac{qe^{-d}}{qe^{-d}+\sum_{v\ne u_l}p(v)e^{-d(v)}}.

with

qe−dqe−d+1−q≤q′≤qe−dqe−d+r∘.\frac{qe^{-d}}{qe^{-d}+1-q}\le q'\le\frac{qe^{-d}}{qe^{-d}+r^\circ}.

Hence, with top-pp after the penalty,

logit⁡(q)−d≥logit⁡(π)⇒locked\operatorname{logit}(q)-d\ge\operatorname{logit}(\pi)\Rightarrow\textit{locked}
⇒ln⁡qr∘−d≥logit⁡(π).\Rightarrow\ln\frac{q}{r^\circ}-d\ge\operatorname{logit}(\pi).

With min-pp after the penalty, the state is locked iff

ln⁡q−d−max⁡v≠ul(ln⁡p(v)−d(v))>ln⁡(1/β).\ln q-d-\max_{v\ne u_l}\bigl(\ln p(v)-d(v)\bigr)>\ln(1/\beta).

Corollary 1 (Bounded penalties). With top-pp (π∈(1/2,1)\pi\in(1/2,1)) after the penalty, if dn,l<Dd_{n,l}<D for all states, then every state with qn,l≥σ(logit⁡(π)+D)q_{n,l}\ge\sigma(\operatorname{logit}(\pi)+D) is locked, where σ\sigma is the logistic function.

A bounded penalty thus moves the threshold from π\pi to σ(logit⁡(π)+D)\sigma(\operatorname{logit}(\pi)+D); for π=0.9\pi=0.9 and D=1,2,3D=1,2,3 this is 0.961, 0.985, 0.9945. It cannot remove locking from a model whose reinforcement curve saturates above that level.

Corollary 2 (Growing penalties). With top-p (π∈(1/2,1)\pi\in(1/2,1)) after the penalty, if dn,l−ln⁡(qn,l/rn,l∘)→∞d_{n,l}-\ln(q_{n,l}/r^\circ_{n,l})\to\infty at some position ll, then Qn→0Q_n\to0 and the loop ends almost surely. This holds in particular if dn,l→∞d_{n,l}\to\infty and rn,l∘≥ρ>0r^\circ_{n,l}\ge\rho>0.

Table 1 classifies common penalties. Two entries deserve comment. First, the look-back window decides the class: over the full context the frequency penalty grows linearly with nn, but restricted to the last WW tokens (64 by default in llama.cpp) a token appears at most WW times; once the window lies entirely within the looping region, the sharper bound is m⌈W/L⌉m\lceil W/L\rceil, where mm is its count per unit. Every deployed penalty has such a window and is thus strictly bounded; what matters is whether the cap exceeds the lock margin for the loop lengths that occur. The frequency cap grows linearly in W/LW/L (with α=0.5\alpha=0.5 and a 20-nat margin it covers units of a single token for W=64W=64 and of about 100 tokens for W=4096W=4096); the DRY-C cap grows exponentially (§ 6). For a linear penalty d≥αnd\ge\alpha n and a finite supremum of the margin, Theorem 2 gives an explicit unlock time under top-p: no state is locked beyond n∗=sup⁡n,l(ln⁡(q/r∘)−logit⁡(π))/αn^*=\sup_{n,l}(\ln(q/r^\circ)-\operatorname{logit}(\pi))/\alpha. Second, the multiplicative penalty divides positive logits and multiplies negative ones, so its strength depends on where the model places the zero of its logits, a quantity with no meaning for the distribution; Hollows [13] measure this effect and its damage to structured output.

Penaltydd on loop tokenClass
Presence βp\beta_pβp\beta_pbounded
Frequency α\alpha, full context≥αn\ge\alpha nlinear
Frequency α\alpha, window WW≤αW\le\alpha Wbounded
Multiplicative ϱ\varrhoz(1−1ϱ)z(1-\frac{1}{\varrho})‡bounded†
DRY, no breaker in unit≥λb(n−1)L−a\ge\lambda b^{(n-1)L-a}exponential
DRY, breaker-free run gg≥λbg−1−a\ge\lambda b^{g-1-a}bounded
DRY-C≥λbn−⌈a′/L⌉−c0\ge\lambda b^{n-\lceil a'/L\rceil-c_0}exponential

Table 1. Penalties along a loop. Exponential rows assume W=∞W=\infty; finite windows cap their growth. zz: loop-token logit. ‡For z>0z>0; for z<0z<0 it is ∣z∣(ϱ−1)\lvert z\rvert(\varrho-1). The DRY lower bound needs (n−1)L≥a(n-1)L\ge a; the DRY-C lower bound needs n−⌈a′/L⌉≥c0n-\lceil a'/L\rceil\ge c_0. †Bounded when zz is; multiplicative penalties depend on the logit origin.

DRY and Its Sequence Breakers

The penalty cap

We state DRY as implemented in llama.cpp (Gerganov and contributors, [9]). Parameters are a multiplier λ\lambda, a base b>1b>1, and an allowed length aa (defaults 0.8, 1.75, 2). Let B⊂VB\subset V be the set of breaker tokens, those whose text contains a newline, colon, quotation mark, or asterisk (with these default single-character breakers every breaker occurrence is a single token; we do not consider user-defined multi-token breakers). For context x1,…,xtx_1,\ldots,x_t, choose a look-back window WW and put h=max⁡{1,t−W+1}h=\max\{1,t-W+1\} (h=1h=1 if W=∞W=\infty). Let κ\kappa be the trailing non-breaker length and MjM_j the common-suffix length of x1:jx_{1:j} and x1:tx_{1:t}. The windowed match length is

M(v)=max⁡h≤j≤tmin⁡{Mj,κ,j−h+1},xj+1=vM(v)=\max_{h\le j\le t}\min\{M_j,\kappa,j-h+1\},\quad x_{j+1}=v

with an empty maximum equal to zero, and

dDRY(v)={λbM(v)−aM(v)≥a, v∉B,0otherwise.d_{\mathrm{DRY}}(v)= \begin{cases} \lambda b^{M(v)-a} & M(v)\ge a,\ v\notin B,\\ 0 & \text{otherwise.} \end{cases}

Breakers enter twice: they truncate the match, and breaker tokens themselves are never penalized.

For a unit containing at least one breaker token, arrange uu on a circle and let gg be the largest number of consecutive non-breaker tokens.

Proposition 4 (Penalty cap). For every state (n,l)(n,l) with n≥1n\ge1,

dDRY(ul)≤Dg:={λbg−1−ag≥a+1,0g≤a,d_{\mathrm{DRY}}(u_l)\le D_g:= \begin{cases} \lambda b^{g-1-a} & g\ge a+1,\\ 0 & g\le a, \end{cases}

and the bound is attained for g≥a+1g\ge a+1, n≥2n\ge2, and W≥L+g−1W\ge L+g-1.

Proof sketch. If ul∈Bu_l\in B the penalty is zero. Otherwise the κ\kappa trailing non-breaker tokens together with ulu_l form κ+1\kappa+1 consecutive non-breaker tokens on the circle, so κ≤g−1\kappa\le g-1 and M(ul)≤g−1M(u_l)\le g-1. □\square

Corollary 3 (Blind spot). With top-p after DRY, every state of such a loop with qn,l≥σ(logit⁡(π)+Dg)q_{n,l}\ge\sigma(\operatorname{logit}(\pi)+D_g) is locked.

With default parameters, Dg=0.8, 1.4, 2.45, 4.29, 7.50, 13.1D_g=0.8,\,1.4,\,2.45,\,4.29,\,7.50,\,13.1 for g=3,…,8g=3,\ldots,8, so locking under top-p 0.9 requires log-odds of 3.0, 3.6, 4.7, 6.5, 9.7, 15.3. Measured log-odds after many repetitions lie between about 6 and 20 (§ 7.2). The theory therefore predicts a transition between g=7g=7 and g=8g=8: loops with short breaker-free runs—JSON records, key–value lines, quoted dialogue, short lines—remain locked under DRY. Without breakers and with unlimited look-back, the match length is at least (n−1)L(n-1)L; a finite window eventually caps this growth.

DRY-C: a count term

Match length is capped by breakers, but a loop has a second signature that breakers do not affect: the same continuation recurs many times. Let a′≥1a' \ge1 (minimum length), c0≥1c_0 \ge1 (allowed recurrences) and bc>1b_c > 1. Let JW={j:h+a′−1≤j<t}J_W = \{j : h + a' - 1 \le j < t\}. Define

c(v)=#{j∈JW:xj+1=v, Mj≥a′},c(v) = \#\{j \in J_W : x_{j+1} = v,\ M_j \ge a'\},

that is, how many earlier positions in the window are preceded by the same a′a' tokens as the current one, verbatim and ignoring breakers, and are followed by vv (W=4096W = 4096 here). The count term is

dcnt(v)={λbcc(v)−c0if c(v)≥c00otherwise;d_{\mathrm{cnt}}(v) = \begin{cases} \lambda b_c^{c(v)-c_0} & \text{if } c(v) \ge c_0 \\ 0 & \text{otherwise}; \end{cases}

it applies to breaker tokens as well, and the total penalty is max⁡{dDRY,dcnt}\max\{d_{\mathrm{DRY}}, d_{\mathrm{cnt}}\}. We call the combined sampler DRY-C.

Proposition 5 (Growth along every loop). For any unit uu, write NW=⌊(W−a′)/L⌋N_W = \lfloor(W - a')/L \rfloor. In every state with min⁡(n−⌈a′/L⌉,NW)≥c0\min(n - \lceil a'/L\rceil, N_W) \ge c_0,

dcnt(ul)≥λbcmin⁡(n−⌈a′/L⌉,NW)−c0.d_{\mathrm{cnt}}(u_l) \ge\lambda b_c^{\min(n-\lceil a'/L\rceil,N_W)-c_0}.

With an unlimited window (NW=∞N_W = \infty) the bound grows without limit in nn.

Proof sketch. The same position in each of the nn earlier copies is followed by ulu_l; for the kk-th most recent one, at least (n−k)L(n-k)L preceding tokens agree with the current suffix. Those with (n−k)L≥a′(n-k)L \ge a' whose matching span lies in the window are counted.

Corollary 4. Let DRY-C be followed by top-pp, write Δ=sup⁡n,l(ln⁡(q/r∘)−logit⁡(π))\Delta= \sup_{n,l}(\ln(q/r^\circ) - \operatorname{logit}(\pi)), and assume Δ<∞\Delta< \infty; put δ=log⁡bc(max⁡{Δ,λ}/λ)≥0\delta= \log_{b_c}(\max\{\Delta,\lambda\}/\lambda) \ge0. With an unlimited window, no state is locked for n>⌈a′/L⌉+c0+δn > \lceil a'/L\rceil+ c_0 + \delta. With a window of WW tokens the same holds whenever NW>c0+δN_W > c_0 + \delta.

The unlock time is logarithmic in Δ\Delta, compared with linear for the frequency penalty. With W=4096W = 4096, Δ=20\Delta= 20 and our parameters, the window condition holds for loop units of up to 814 tokens; our detector looks for periods of up to 400. The count term has a cost. A format skeleton that repeats, such as the same JSON keys line after line, can build up a′a' matching tokens and trigger it when nothing is looping; Appendix § 14 measures how often this happens and what it does to requested copying. We use a′=24a' = 24, c0=2c_0 = 2, and bc=3b_c = 3 unless stated otherwise.

Experiments

Setup

Models. Eleven instruction-tuned models from 1.5B to 9B parameters: Qwen2.5 1.5B and 7B (Qwen Team, 2024); Qwen3 1.7B, 4B and 8B [32]; Llama 3.2 3B and 3.1 8B (Llama Team, 2024); Gemma 2 2B and 9B (Gemma Team, 2024); Phi-4-mini [25]; and the DeepSeek-R1 distillation of Qwen 7B [2].

Teacher-forced measurement. We sample 150 English sentences from the WikiText-103 test set [24] and 150 Chinese sentences from Chinese Wikipedia, stratified by length, and add 22 hand-written units (dialogue lines, list items, code). Each unit is repeated up to 200 times after the beginning-of-sequence token, in an inline variant (joined by a space) and a line variant (terminated by a newline), keeping units whose tokenization is stable under repetition. One forward pass with key–value caching yields qn,lq_{n,l}, an,la_{n,l}, and rn,l∘r^\circ_{n,l} at every position; softmax is evaluated in 64-bit precision. Given the logits, the continuation probability under any sampler configuration is computed exactly, with penalties applied before truncation as in llama.cpp. Our DRY computation follows the definition of § 6 and was validated position by position against the llama.cpp sampler Appendix § 12.

Free generation. We run llama.cpp with its own samplers on GGUF quantizations of Qwen3-4B, Llama-3.1-8B and Qwen3.6-35B-A3B. Prompt set 1 has 20 prompts (reasoning, enumeration and eight structured-output tasks); prompt set 2 has 24 structured-output prompts (JSON, tables, YAML, CSV, logs, lists, dialogue) and 12 prose-writing prompts. “Default” denotes the sampler recommended by each model’s developers (Qwen: τ=0.6\tau= 0.6, top-pp 0.95, top-kk 20; Llama: τ=0.6\tau= 0.6, top-pp 0.9), with at most 3000 new tokens. A generation contains a loop if some span of at least 4 tokens occurs at least 5 times consecutively, covering at least 60 tokens. Details are in Appendix § 13.

Reinforcement curves

In Figure 1(a) the log-odds (median over positions, then over sentences) climb steeply over the first few repetitions. The log-odds keep rising, roughly as a saturating power law, to between 6 (Llama-3.2-3B) and 20 (Gemma-2-9B) after 200 repetitions; the copying behind this rise is usually attributed to induction heads ([27]). Every curve sits above the top-pp thresholds from the first repetition onward for the median token; locking requires this at every position, which happens after 5–40 repetitions for half of the sentences (Figure 1(b)). Onset is not monotone: several models dip around the tenth repetition.

Reinforcement curves and onset of locking for eleven models

Figure 1. (a) Log-odds after nn repetitions: median over positions within each inline corpus sentence, then median over sentences. Dotted lines mark the lock thresholds of top-pp 0.9 and 0.95. (b) Fraction of sentences in which every position satisfies q≥0.9q \ge0.9 at repetition nn.

Verification of the criteria. On four models (Qwen2.5-1.5B and 7B, Qwen3-4B, Llama-3.2-3B; about 160,000 positions each) the criteria of Theorem 1 agree with the exactly computed lock status at every position for top-pp 0.9 and 0.95 and min-pp 0.1 and 0.05. The sufficient and necessary conditions of Proposition 3(B) and Theorem 2 have zero violations; the sufficient conditions cover over 99% of locked positions, and the necessary condition with r∘r^\circ is tight (Appendix § 11). A Monte Carlo check with the transformers sampler reproduces the survival formula (0.789 ± 0.013 sampled against 0.786 computed).

Which settings lock

Table 2 reports which units stay locked through the last ten measured repetitions. Pure sampling locks nothing. Top-pp 0.9 locks 80%–100% of units through that interval. Among penalties, the split predicted by Section 5 is visible in every row: presence 1.0 (74%–100%) and windowed frequency 0.5 (56%–99%) leave most units locked; the mild multiplicative penalty leaves between 47% and 99%, a spread that reflects its dependence on the logit origin; a strong one removes most locks (0%–35% remain); and the full-context frequency penalty leaves none locked through the final ten repetitions. Under the full-context frequency penalty locks still form transiently, as late as repetition 86 (Qwen3-8B), before the linear term overtakes them. Figure 5 in Appendix § 13 puts the penalty classes side by side against the measured lock margin.

ModelTruncation only: pureTruncation only: top-pp 0.9Truncation only: min-pp 0.1Truncation only: τ=0.7\tau=0.7 +top-pptop-pp 0.9 + bounded penalty: pres.top-pp 0.9 + bounded penalty: freq64_{64} 0.5top-pp 0.9 + bounded penalty: rep64_{64} 1.1top-pp 0.9 + bounded penalty: rep64_{64} 1.3top-pp 0.9 + other penalties: freq. 0.1top-pp 0.9 + other penalties: DRYtop-pp 0.9 + other penalties: DRY-C
Qwen2.5-1.5B01.001.001.001.00.96.8000.020
Qwen2.5-7B0.99.99.99.98.95.8300.020
Qwen3-1.7B0.99.99.99.99.99.98.210.020
Qwen3-4B01.001.001.00.99.99.98.010.020
Qwen3-8B0.99.991.00.99.99.99.350.020
R1-Distill-7B0.88.91.95.79.70.5000.010
Llama-3.2-3B0.95.971.00.77.56.4700.010
Llama-3.1-8B01.001.001.001.00.90.8900.010
Gemma-2-2B0.80.85.87.74.69.59.010.010
Gemma-2-9B0.91.92.92.91.90.88.200.020
Phi-4-mini0.99.991.00.95.95.530000

Table 2. Fraction of units locked through the last ten measured repetitions (150 sampled units: corpus and handwritten spans). Top-pp, DRY and DRY-C come from a second run in which DRY and DRY-C use a 4,096-token look-back (Appendix § 14); the other columns come from the first run. Subscript 64: penalty window. Temperature precedes top-pp in the τ=0.7\tau=0.7 column. Phi-4 is limited to 4,000 tokens throughout.

Penalty trajectories

Figure 5. Penalty trajectories (analytic, unit length 24, unlimited look-back for growing curves; “count term” is the DRY-C count component) against the lock margin logit⁡(q)−logit⁡(0.9)\operatorname{logit}(q)-\operatorname{logit}(0.9) of Qwen3-4B (band: weakest to typical token of the median sentence). A penalty that stays below the band cannot unlock.

The DRY blind spot

Dose–response. To vary the breaker-free run length while holding content fixed, we take the first 24 tokens of 40 sentences per model and insert a colon (a breaker) after every gg tokens, for nominal g∈{2,3,4,6,8,12,24}g \in\{2, 3, 4, 6, 8, 12, 24\}; as a control we insert a semicolon (not a breaker). Retokenization can change the actual gap; Appendix § 14 reports both groupings.

Figure 2 shows a sharp transition. Pooled over models, DRY leaves 400/400 units locked at g=2g = 2, 404/409 at g=3g = 3, 393/419 at g=4g = 4, 276/416 (66%) at g=6g = 6, and 5/422 (1%) at g=8g = 8, and none beyond. With semicolons, none of the 2,919 units locked under top-pp alone remain locked under DRY (the control selects its locked units separately, hence the different denominator). The models that unlock earliest at g=6g = 6 are the two Llama models, whose reinforcement curves are the lowest in Figure 1, in line with Corollary 3, whose sufficient condition never predicts a lock that does not occur. Among the corpus units of Table 2, the 23 that stay locked under DRY all have 5≤g≤75 \le g \le7, and DRY-C leaves none; Appendix § 14 also reports transient locks and finite-horizon survival.

Fraction of units that remain locked under DRY + top-p 0.9

Figure 2. Fraction of units that remain locked under DRY + top-pp 0.9, among units locked under top-pp alone. Thin lines: individual models; thick line: pooled over eleven models. Top axis: DgD_g evaluated at the nominal gap; actual-gap regrouping is in Appendix § 14.

The real sampler. We queried the unmodified llama.cpp server for the post-sampling probability of the loop token along the repetition path of 12 units. For six ordinary sentences, top-pp locks between repetitions 5 and 15 and DRY removes every lock. Six breaker-dense units (short lines, a key–value line, a JSON object, quoted code) lock under DRY at exactly the repetition at which they lock without it.

Free generation. Figure 3 pools the loops found in four free-generation runs (Qwen3-4B on both prompt sets, Qwen3.6-35B, Llama-3.1-8B; 1,780 generations per setting in total). With the default sampler there are 233 loops, of which 110 have g≤7g \le7 and 123 have g≥8g \ge8 or no breaker. With DRY added there are 109 loops, and all 109 have g≤7g \le7. DRY thus removes the loops outside the predicted blind spot, while the number inside it is unchanged (110 versus 109). Within the blind spot the distribution shifts: at g=7g=7, where the cap D7=7.5D_7=7.5 is close to typical log-odds, loops drop from 10 to 1, whereas loops with g≤5g \le5 rise from 70 to 83: generations that DRY steers away from a long-run loop can fall into a shorter-run one. The pattern holds in each run separately (Appendix § 13) and the surviving loops are spread over many prompts. Loops are concentrated in structured output: with the default sampler, 20.8% (Qwen3-4B) and 16.1% (Llama-3.1-8B) of structured generations on prompt set 2 contain a loop, against 0% and 7.2% for prose; the prose loops of Llama all have g≥8g \ge8 or no breaker, and DRY removes all of them.

Loops found in free generation

Figure 3. Loops found in free generation (four runs pooled), by the longest breaker-free run gg of the loop unit. The dotted line separates D7=7.5D_7 = 7.5 from D8=13.1D_8 = 13.1.

Closing the blind spot

We implemented the count term as a patch to the llama.cpp DRY sampler, disabled by default; with it disabled, outputs are identical to the unpatched build.

Teacher-forced. With DRY-C (bc∈{1.75,3}b_c \in\{1.75, 3\}) no unit stays locked: not in the dose–response experiment at any gg on any model, not among the corpus units (Table 2), and not among the six breaker-dense units in the real sampler.

Free generation. Figure 4 shows the effect on structured prompts. On Qwen3-4B, loops that run to the length limit fall from 59 (default) and 30 (DRY) to 0; on Llama-3.1-8B from 52 and 32 to 0. Loops still appear in 8 and 6 generations but end after a median of 6 and 5 repetitions, in line with the logarithmic unlock time of Corollary 4. The share of generated tokens that lie inside loops drops from 12.2% to 6.7% to 0.1% on Qwen3-4B and from 15.0% to 9.4% to 0.1% on Llama-3.1-8B.

Structured-output prompts showing loop counts for Qwen3-4B and Llama-3.1-8B

Figure 4. Structured-output prompts (360 generations per bar). Light: a loop appears; dark: the loop continues to the length limit. Numbers are counts.

Side effects. DRY-C lowers item duplication (Table 3). Mean coverage moves a little either way, from 40.5% to 38.2% on Qwen and from 71.5% to 73.1% on Llama. Pure sampling leaves Llama a single loop in 360 generations but lowers the share of generations reaching 90% of the requested items to 23.1%. Appendix § 14 compares further baselines. Two results stand out: dropping DRY’s breakers also removes loops but roughly halves JSON validity, and a light repetition penalty (1.05) combines well with DRY-C, raising coverage to 46.8% and JSON validity to 51.1% on Qwen with no loop reaching the limit.

SamplerAns.≥90%Cov.Dup.JSON
Qwen3-4Bdefault62.215.034.028.126.7
+ DRY68.320.040.518.531.1
+ DRY-C65.620.338.215.031.1
pure69.221.440.118.524.4
Llama 3.1-8Bdefault10052.866.123.013.3
+ DRY10058.971.512.926.7
+ DRY-C10061.773.18.722.2
pure10023.146.78.98.9

Table 3. Task completion on structured prompts (%, 360 generations per row). Ans.: an answer is produced within the limit (for Qwen3-4B, the reasoning block ends); ≥90%: at least 90% of the requested number of distinct items; Cov.: mean fraction of requested items produced; Dup.: duplicated items among those produced; JSON: outputs that parse, on the three JSON prompts (45 generations per cell).

Requested repetition. When the user asks for verbatim repetition, DRY and DRY-C both get in

the way: exact completion falls from above 90% to about 10% (Table 7). A stricter test shows that the count term costs extra on blocks of short repeated lines; raising c0c_0 to 6 recovers most of it on those blocks (Appendix § 14).

ModelSamplersent.para.chorustempl.all
Llama-3.1-8Bdefault1001007010095
+ DRY2200810
+ DRY-C2200810
+ DRY-C, c0=6c_0=62300710
Qwen3-4Bdefault100100808291
+ DRY0075012
+ DRY-C0075012
+ DRY-C, c0=6c_0=61075013

Table 7. Tasks that request verbatim repetition: generations (%) containing the required number of exact copies.

Discussion and Conclusion

Locked versus long. Pure sampling never locks a position, yet Qwen3-4B produces loops reaching the generation limit. Positive escape probabilities can be too small to end a loop within a finite budget (Proposition 2); conversely, a trajectory may deviate before a later lock forms.

Conclusion. Whether a loop still has an exit depends on how strongly the model prefers to continue it and on what the sampler does with that preference. Truncation can remove the exit outright; a bounded penalty only raises the bar, while a penalty that keeps growing reopens it. DRY’s breakers make it a bounded penalty on exactly the loops that matter most for structured output, and a count term lifts that cap without giving up the breakers.

Limitations

Our analysis covers verbatim loops only. Near-loops, in which a counter increments or wording drifts, fall outside the model; DRY-C turns a few verbatim loops into such near-repeats (Appendix § 14). We explain persistence, not onset: all results are conditional on a loop having begun. The reinforcement curve is treated as an empirical input; we fit but do not derive its shape. Proposition 1 applies to any sampler whose state is determined by the generated prefix (as with Mirostat), but we derive lock criteria only for top-pp, min-pp and greedy decoding, not for Mirostat or XTC; for τ>1\tau> 1 with temperature before top-pp our sufficient condition is loose. Every deployed penalty, DRY-C included, has a finite look-back window and is therefore bounded; with Δ=20\Delta= 20 and our parameters, the sufficient window condition holds for units of up to 814 tokens. The count parameters were chosen from format considerations; we test several alternatives, but do not optimize them. Side effects are measured by coarse task-completion and copying tests on two models, without human evaluation. DRY-C inherits from DRY a strong penalty on verbatim copying: when the user explicitly requests repetition, both samplers reduce exact completion from above 90% to about 10%. Beyond that, DRY-C by construction penalizes the (c0+1)(c_0 + 1)-th verbatim recurrence of any span longer than a′a', including legitimately repeated blocks of short lines that DRY’s breakers would protect. Teacher-forced experiments use eleven models up to 9B parameters; free-generation experiments use quantized weights, three models, and a 3000-token limit, and loop counts from the 35B model are small. Loop detection uses a fixed criterion (five consecutive repetitions covering at least 60 tokens); other thresholds change the counts but not the pattern (Appendix § 13).

Use of AI Assistance

An AI assistant (Claude, Anthropic) was used extensively in this work: in deriving and checking the proofs, writing the measurement and analysis code, running the experiments, and drafting the text. The authors reviewed the derivations, results and text, and take full responsibility for the content.

Proofs

Proof of Proposition 1. The event {Tk≥m}\{T_k \ge m\} says that the next mLmL tokens equal the tokens of the loop. Write its probability by the chain rule in generation order. Each factor is conditioned on no deviation so far, in which case the context is exactly some state (j,l)(j,l) and the factor is qj,lsq^s_{j,l}. Grouping the LL factors of each copy gives QjQ_j for j=k,…,k+m−1j = k,\ldots,k+m-1. The events decrease to {Tk=∞}\{T_k = \infty\}, and continuity of probability gives the second formula.

Lemma 1. Let 0≤aj<10 \le a_j < 1. Then ∏j(1−aj)>0\prod_j(1-a_j)>0 iff ∑jaj<∞\sum_j a_j<\infty.

Proof. For 0≤x<10 \le x < 1, −ln⁡(1−x)≥x-\ln(1-x) \ge x; for 0≤x≤120 \le x \le\frac{1}{2}, −ln⁡(1−x)≤2x-\ln(1-x) \le2x (compare derivatives). If ∑aj<∞\sum a_j<\infty then aj≤12a_j \le\frac{1}{2} for j≥Jj \ge J and ∑j>J−ln⁡(1−aj)≤2∑j>Jaj<∞\sum_{j>J}-\ln(1-a_j) \le2\sum_{j>J}a_j<\infty, so the tail product is positive, and the first J−1J-1 factors are positive. If ∑aj=∞\sum a_j=\infty then −ln⁡∏j≤N(1−aj)≥∑j≤Naj→∞-\ln\prod_{j\le N}(1-a_j) \ge\sum_{j\le N}a_j\to\infty.

Proof of Proposition 2. A temperature-scaled softmax of finite logits gives every token a probability strictly between 0 and 1, so qn,ls<1q^s_{n,l}<1. The second claim is Proposition 1 with Lemma 1 applied to aj=1−Qja_j=1-Q_j. For the third, P(Tk≥m)≤Q‾m\mathbb{P}(T_k\ge m)\le\overline{Q}^m and E[Tk]=∑m≥1P(Tk≥m)≤Q‾/(1−Q‾)\mathbb{E}[T_k]=\sum_{m\ge1}\mathbb{P}(T_k\ge m)\le\overline{Q}/(1-\overline{Q}).

Proof of Theorem 1. A state is locked iff the retained set is {ul}\{u_l\}.

(a) Suppose q≥π>12q\ge\pi>\frac{1}{2}. Any other token vv has p(v)≤1−q<qp(v)\le1-q<q, so the mass strictly above vv is at least q≥πq\ge\pi and vv is dropped; nothing lies strictly above ulu_l, so ulu_l is kept. Conversely suppose q<πq<\pi. If ulu_l is not a most probable token, a most probable token v1≠ulv_1\ne u_l is kept. If ulu_l is the most probable token, let v2v_2 be most probable among the rest; the mass strictly above v2v_2 is at most q<πq<\pi (if several tokens tie with v2v_2 the mass strictly above them is still only qq), so v2v_2 is kept.

(b) If ulu_l is not the most probable token, the most probable token is kept and ln⁡q−ln⁡a≤0\ln q-\ln a\le0. Otherwise all other tokens are dropped iff a<βqa<\beta q.

(c) By definition. The last sentence of the theorem follows from Proposition 1.

Lemma 2. Let x1,…,xm≥0x_1,\ldots,x_m\ge0. If s≥1s\ge1 then (max⁡ixi)s≤∑ixis≤(∑ixi)s(\max_i x_i)^s\le\sum_i x_i^s\le(\sum_i x_i)^s. If 0≤s≤10\le s\le1 then (∑ixi)s≤∑ixis≤m1−s(∑ixi)s(\sum_i x_i)^s\le\sum_i x_i^s\le m^{1-s}(\sum_i x_i)^s.

Proof. The case A=∑ixi=0A=\sum_i x_i=0 is trivial; otherwise normalize by AA and put yi=xi/A∈[0,1]y_i=x_i/A\in[0,1]. For s≥1s\ge1, yis≤yiy_i^s\le y_i; for s≤1s\le1, yis≥yiy_i^s\ge y_i; summing gives the bounds around (∑ixi)s(\sum_i x_i)^s. The remaining bound for s≥1s\ge1 is trivial and for s≤1s\le1 is Jensen’s inequality for the concave map t↦tst\mapsto t^s.

Proof of Proposition 3. (A) The retained set is determined by the raw distribution; temperature only reweights tokens inside it, and a singleton has probability 1 regardless.

(B) Let s=1/τ≥1s=1/\tau\ge1. After temperature the loop token has probability q(τ)=qs/(qs+∑v≠ulp(v)s)q^{(\tau)}=q^s/(q^s+\sum_{v\ne u_l}p(v)^s). By Lemma 2, as≤∑v≠ulp(v)s≤(1−q)sa^s\le\sum_{v\ne u_l}p(v)^s\le(1-q)^s, so

qsqs+(1−q)s≤q(τ)≤qsqs+as.\frac{q^s}{q^s+(1-q)^s}\le q^{(\tau)}\le\frac{q^s}{q^s+a^s}.

By Theorem 1(a) the state is locked iff q(τ)≥πq^{(\tau)}\ge\pi. The left side is at least π\pi iff \logit(q)\ge\tau\logit(\pi); if the state is locked the right side is at least π\pi, i.e. (q/a)s≥π/(1−π)(q/a)^s\ge\pi/(1-\pi). For min-pp, temperature preserves the order of tokens and raises probability ratios to the power 1/τ1/\tau, so by Theorem 1(b) the state is locked iff (q/a)1/τ>1/β(q/a)^{1/\tau}>1/\beta.

For τ>1\tau>1 and top-pp, the second part of Lemma 2 with m=∣V∣−1m=|V|-1 gives in the same way

\logit(q)\ge\tau\logit(\pi)+(\tau-1)\ln m\Rightarrow\text{locked},
\text{locked}\Rightarrow\logit(q)\ge\tau\logit(\pi).

The sufficient condition is loose because it allows the remaining mass to be spread uniformly over the vocabulary.

Proof of Theorem 2. The penalized distribution is proportional to p(v)e−d(v)p(v)e^{-d(v)}, which gives the formula for q′q'. Since e−d(v)≤1e^{-d(v)}\le1, the sum in the denominator is at most 1−q1-q; keeping only unseen tokens, which have d(v)=0d(v)=0, it is at least r∘r^\circ. As c↦x/(x+c)c \mapsto x/(x+c) is decreasing this gives the two-sided bound. The lower bound has log-odds logit⁡(q)−d\operatorname{logit}(q)-d and the upper bound has log-odds ln⁡(q/r∘)−d\ln(q/r^\circ)-d; Theorem 1(a) applied to q′q' gives the two implications. The min-pp statement is Theorem 1(b) for the penalized distribution; note that the strongest rival may change after the penalty. □

Proof of Corollary 1. q≥σ(logit⁡(π)+D)q \ge\sigma(\operatorname{logit}(\pi)+D) iff logit⁡(q)≥logit⁡(π)+D\operatorname{logit}(q) \ge\operatorname{logit}(\pi)+D, which implies logit⁡(q)−d≥logit⁡(π)\operatorname{logit}(q)-d \ge\operatorname{logit}(\pi). □

Proof of Corollary 2. By the upper bound of Theorem 2, qn,l≤qn,l′e−dn,l/rn,l∘=exp⁡(−(dn,l−ln⁡(qn,l/rn,l∘)))→0q_{n,l} \le q_{n,l}^{\prime}e^{-d_{n,l}/r_{n,l}^{\circ}} = \exp(-(d_{n,l}-\ln(q_{n,l}/r_{n,l}^{\circ}))) \to0. The set retained by top-pp has mass at least π\pi, so after renormalization qn,ls≤qn,l′/πq_{n,l}^{s} \le q_{n,l}^{\prime}/\pi (or 0 if the loop token is dropped). Hence Qn≤qn,l′/π→0Q_n \le q_{n,l}^{\prime}/\pi\to0 and P(Tk=∞)≤QN→0\mathbb{P}(T_k=\infty) \le Q_N \to0 by Proposition 1. If dn,l→∞d_{n,l} \to\infty and rn,l∘≥ρ>0r_{n,l}^{\circ} \ge\rho> 0, then dn,l−ln⁡(qn,l/rn,l∘)≥dn,l−ln⁡(1/ρ)→∞d_{n,l}-\ln(q_{n,l}/r_{n,l}^{\circ}) \ge d_{n,l}-\ln(1/\rho) \to\infty. □

Proof of Proposition 4. If ul∈Bu_l \in B the penalty is zero by definition. Let ul∉Bu_l \notin B. Since n≥1n \ge1, the context ends with at least one complete copy of uu, which contains a breaker; the κ\kappa trailing non-breaker tokens therefore lie in the loop and form a contiguous arc of the circle. The token ulu_l extends this arc, giving κ+1\kappa+1 consecutive non-breaker tokens, so κ+1≤g\kappa+1 \le g. Thus M(ul)≤κ≤g−1M(u_l) \le\kappa\le g-1. If g−1<ag-1<a the penalty is zero; otherwise it is at most λbg−1−a\lambda b^{g-1-a} because b>1b>1. For attainment, let ulu_l be the last token of a longest breaker-free arc, so that κ=g−1\kappa=g-1. For n≥2n \ge2 the position j=t−Lj=t-L satisfies xj+1=ulx_{j+1}=u_l and is preceded by at least one full copy that agrees with the current suffix, so Mj≥L>κM_j \ge L>\kappa; if W≥L+g−1W \ge L+g-1, it also lies in the window with j−h+1≥W−L≥g−1j-h+1 \ge W-L \ge g-1, so M(ul)=g−1M(u_l)=g-1. □

Proof of Corollary 3. Proposition 4 bounds the penalty on the loop token by DgD_g. DRY may also penalize other candidates, but the sufficient condition of Theorem 2 holds for arbitrary d(v)≥0d(v)\ge0, so Corollary 1 applies. □

Proof of Proposition 5. Let tt be the last position of the context, so that ulu_l is to be generated next. For k=1,…,nk=1,\ldots,n put jk=t−kLj_k=t-kL, the same position kk copies earlier; then xjk+1=ulx_{j_k+1}=u_l. From the start of the loop up to jkj_k there are (n−k)L+(l−1)(n-k)L+(l-1) loop tokens, and by periodicity they agree with the equally long suffix ending at tt, so Mjk≥(n−k)LM_{j_k}\ge(n-k)L. Therefore jkj_k is counted whenever (n−k)L≥a′(n-k)L\ge a', i.e. for k≤n−⌈a′/L⌉k\le n-\lceil a'/L\rceil, provided its matching span of a′a' tokens lies within the last WW tokens, i.e. kL+a′≤WkL+a'\le W, i.e. k≤NWk\le N_W. Hence c(ul)≥min⁡(n−⌈a′/L⌉,NW)c(u_l)\ge\min(n-\lceil a'/L\rceil,N_W), and the bound follows because bc>1b_c>1. □

of a′a' tokens lies within the last WW tokens, i.e. kL+a′≤WkL+a' \le W, i.e. k≤NWk \le N_W. Hence c(ul)≥min⁡(n−⌈a′/L⌉,NW)c(u_l) \ge\min(n-\lceil a'/L\rceil,N_W), and the bound follows because bc>1b_c>1. □

Proof of Corollary 4. By the necessary condition of Theorem 2, a locked state has d(u_l) \le\ln(q/r^\circ)-\logit(\pi) \le\Delta. Let m=min⁡(n−⌈a′/L⌉,NW)m=\min(n-\lceil a'/L\rceil,N_W) and suppose m>c0+δm>c_0+\delta. Then m≥c0m\ge c_0, so Proposition 5 gives d(ul)≥λbcm−c0>λbcδ=max⁡{Δ,λ}>Δd(u_l)\ge\lambda b_c^{m-c_0}>\lambda b_c^\delta=\max\{\Delta,\lambda\}>\Delta, and the state is not locked. If NW>c0+δN_W>c_0+\delta, then m>c0+δm>c_0+\delta holds exactly when n>⌈a′/L⌉+c0+δn>\lceil a'/L\rceil+c_0+\delta. □

Verification Details

Lock criteria. For Qwen2.5-1.5B, Qwen2.5-7B, Qwen3-4B and Llama-3.2-3B we compared, at every position of every unit, the lock status computed exactly from the full distribution with the status predicted from qq and aa alone. For top-p∈{0.9,0.95}p\in\{0.9,0.95\} and min-p∈{0.1,0.05}p\in\{0.1,0.05\} the two agree at all positions (about 160,000 per model). The smallest escape probability 1−q1-q observed under pure sampling ranges from 1.9×10−131.9\times10^{-13} to 3×10−63\times10^{-6} across models and is always positive; the per-repetition escape probability 1−Qn1-Q_n settles between 10−1.510^{-1.5} and 10−3.510^{-3.5}.

Temperature. For τ=0.7\tau=0.7 before top-pp 0.9, the sufficient and necessary conditions of Proposition 3(B) have no violations, and the sufficient condition covers 99.6%–99.9% of locked positions. Lock onset moves from repetitions 10–13 to 4–6.

Penalties. For presence penalties 1 and 2 and full-context frequency penalties 0.1 and 0.5, the sufficient condition of Theorem 2 has no violations and covers 99.2%–100% of locked positions. The necessary condition with the measured r∘r^\circ has no violations, and the smallest slack among locked positions is 0.00; replacing r∘r^\circ by 1−q1-q produces tens to thousands of violations, so the distinction matters.

Simulation versus the llama.cpp Sampler

The teacher-forced DRY results rely on our implementation of the definition in § 6. We compared it with llama.cpp (commit 03aa006) on 12 units and 40 repetitions (about 5,000 positions), using the server’s post-sampling probabilities with DRY followed by top-pp 0.9. Lock status differs at 15 positions and the largest probability difference is 0.24. The same comparison for top-pp alone, which involves no DRY computation, differs at 20 positions with a largest difference of 0.22; the residual is therefore due to numerical differences between the half-precision GGUF and the single-precision weights, at positions near the truncation threshold. The comparison is sensitive to the specification: a variant that omits the exemption of breaker tokens differs at 152 positions, with differences up to 1.0. The count term was validated in the same way against the patched sampler (13 and 10 differing positions for bc=1.75b_c = 1.75 and 3). With the patch disabled, the patched and unpatched builds return identical probabilities at all 5,072 positions for top-pp and at all positions where both return a value for DRY.

Experimental Details

Teacher-forced runs. In the window reruns, Qwen2.5-1.5B uses float32, both Gemma models use bfloat16, and the other models use float16. Softmax and sampler calculations use float64. Contexts are limited to 12,288 tokens, and to 4,000 tokens for Phi-4-mini, whose outputs degrade abruptly beyond 4,096 tokens under chunked evaluation. Reinforcement curves use the inline variants of the corpus sentences whose tokenization is stable under repetition (277–300 per model); lock fractions and the DRY comparison use an evenly spaced subset of 150 units; the dose–response experiment uses 40 base sentences per model that contain no breaker characters or semicolons. A unit is counted as finally locked if its last ten measured repetitions are entirely locked (Table 2 and the 60-repetition dose experiment). Ever-locked means at least one measured repetition is entirely locked.

Free generation. Quantizations: Q8_0 for Qwen3-4B and Llama-3.1-8B, Q4_K_M for Qwen3.6-35B-A3B. Prompt set 1: 25 samples per prompt and setting for Qwen3-4B, 10 for the 35B model. Prompt set 2: 15 samples per prompt and setting. DRY uses λ=0.8\lambda= 0.8, b=1.75b = 1.75, a=2a = 2, the default breakers, and a range of 4,096 tokens. Table 5 lists loop counts per run, and Table 4 gives every sampler setting run on prompt set 1. The windowed multiplicative penalty (rep. 1.1) yields fewer loops there than DRY, which we attribute to its also penalizing breaker tokens; in teacher forcing it leaves most units locked (Table 2).

default+ DRY+ pres. 1+ rep. 1.1pure
Qwen3-4B7828442437
of which g≤7g \le73028291926
Qwen3.6-35B94101
of which g≤7g \le734000

Table 4. Loops on prompt set 1 under every sampler setting (500 generations per cell for Qwen3-4B, 200 for the 35B model).

RunSamplerloopsg≤7g \le7g≥8g \ge8
Qwen3-4B, set 1default783048
+ DRY28280
Qwen3-4B, set 2default754530
+ DRY44440
Qwen3.6-35B, set 1default936
+ DRY440
Llama-3.1-8B, set 2default713239
+ DRY33330

Table 5. Loops per free-generation run. The last column includes units without any breaker. Prompt set 2 includes both structured and prose prompts; on Llama, 58 of the 71 default loops and all 33 DRY loops occur on the structured subset used in Table 8.

DRY-C uses a′=24a' = 24, c0=2c_0 = 2, bc=3b_c = 3; with bc=1.75b_c = 1.75 on Qwen3-4B (prompt set 2), 25 structured generations contain a loop instead of 8, and again none runs to the length limit.

Sensitivity to the loop criterion. Table 6 repeats the count of Figure 3 under looser and stricter loop criteria. The number of loops changes, but under every criterion no loop that appears with DRY enabled has g≥8g \ge8.

Criteriondefault alldefault g≤7g \le7default g≥8g \ge8default + DRY alldefault + DRY g≤7g \le7default + DRY g≥8g \ge8
≥\ge3 reps., ≥\ge30 tok.3091241851291290
≥\ge4 reps., ≥\ge40 tok.2621201421161160
≥\ge5 reps., ≥\ge60 tok.2331101231091090
≥\ge8 reps., ≥\ge100 tok.184958999990
≥\ge10 reps., ≥\ge150 tok.169917890900

Table 6. Loops in the four pooled free-generation runs under different detection criteria (minimum consecutive repetitions and minimum total length). The third row is the criterion used in the paper.

Requested repetition. Twelve prompts ask for verbatim repetition of a text given in the prompt: four ask for a sentence to be copied 5 or 8 times, two for a paragraph to be copied 3 times, two for a four-line chorus after each of 4 verses, and four for a fixed line in each of 5–8 items (notes, functions, SQL statements); half are in English and half in Chinese. A generation succeeds if the given text occurs the required number of times in the answer, ignoring differences in whitespace. Table 7 reports this 12-task experiment, with 10 generations per task for default and DRY (120 per row) and three batches of 10 per task for each DRY-C setting (360 per row). A stricter 16-task version is reported in Appendix § 14. The chorus tasks, whose lines are short and newline-terminated, are the only ones on which Qwen3-4B still succeeds under DRY, as expected from § 6.

Larger models. The 35B model loops far less than the 4B model under the same sampler and prompts (4.5% of generations against 15.6%), in agreement with Pipis et al. [30]; the four loops that survive DRY all have g≤6g \le6.

Penalty trajectories. Figure 5 shows each penalty on the loop token as a function of nn, contrasting fixed caps with linear and exponential lower-bound trajectories. The curve labeled “count term” shows the count component alone, not the maximum of the DRY and count penalties.

Task completion. For each structured prompt we extract items from the answer (for reasoning models, the text after the reasoning block) with a prompt-specific pattern, and compare the number of distinct items with the number requested. Generations that reach the length limit before producing an answer count as zero items.

Additional Baselines and Robustness

Additional interventions. Antislop suppresses unwanted strings by backtracking (Paech et al. [28]); Local Temperature Beam Search uses deterministic calibration (Lee et al. [18]); Variance-

Calibrated Modulation adjusts decoding to address concentration in the distribution head (Ding et al. [3]); XTC excludes top choices (Weidmann et al. [36]). e-CUSUM studies reasoning monitors (Ettifouri et al. [5]), “One Neuron” explores internal-component edits (Lazaridis et al. [17]), “Feedback That Backfires” examines repeated failed actions after feedback (Gumaan [11]), and “Word Salad Chopper” detects unproductive reasoning from hidden states (Xie et al. [40]). None of them asks our question: whether the sampler still leaves any probability for leaving a given loop.

Additional baselines. Table 8 uses the same 24 structured prompts, 15 samples per prompt and setting, and 3,000-token generation limit as Table 3. The two token penalties with W=4096W=4096 look back 4,096 tokens, which covers the whole generation, so the frequency penalty grows throughout. The bounded alternatives (rep. 1.1, DRY + rep. 1.05, newline-only breakers) still produce loops that run to the generation limit. Frequency 0.1 nearly removes such loops, but on Llama lowers mean item coverage from 66.1% (default) to 43.3%, with only 7.8% of generations reaching 90% of the requested distinct items. Removing every breaker eliminates detected loops in both models while reducing JSON validity relative to DRY (31.1% to 17.8% for Qwen; 26.7% to 11.1% for Llama). DRY-C again has no loop reaching the limit. On completion it neither beats nor trails DRY consistently: mean coverage is 38.2% against 40.5% on Qwen and 73.1% against 71.5% on Llama. Adding rep. 1.05 to DRY-C on Qwen yields 3 loops, none to the limit, 46.8% coverage and 51.1% JSON validity; the corresponding DRY + rep. 1.05 baseline has 11 run-to-limit loops and 47.4% coverage. The two combine well: the light penalty helps completion, and the count term removes the locks.

ModelSamplerLoopsTo limitLoop tokens (%)Coverage (%)JSON (%)
Qwen3-4Bdefault755912.234.026.7
DRY44306.740.531.1
DRY-C800.138.231.1
frequency 0.1, W=4096W = 40961940.739.615.6
rep. 1.1, W=4096W = 409631224.152.951.1
DRY + rep. 1.0520112.747.442.2
DRY, newline breakers only31284.943.315.6
DRY, no breakers000.042.717.8
DRY-C + rep. 1.05300.346.851.1
Llama-3.1-8Bdefault585215.066.113.3
DRY33329.471.526.7
DRY-C600.173.122.2
frequency 0.1, W=4096W = 40968514.043.34.4
rep. 1.1, W=4096W = 4096741.663.335.6
DRY + rep. 1.05651.867.033.3
DRY, newline breakers only14144.970.133.3
DRY, no breakers000.060.711.1

Table 8. Additional baselines, 360 structured generations per row. Loop tokens: fraction of all generated tokens covered by the detected loop; coverage and JSON use the definitions of Table 3 (45 JSON generations per row). All penalty variants are added to the model’s default sampler.

Count-parameter sensitivity. On Qwen, changing (a′,c0)(a', c_0) from (24, 2) to (12, 2), (48, 2) or (24, 4) yields respectively 4, 33 and 39 detected loops in 360 generations per setting, all ending before the generation limit. The loop-token shares are 0.04%, 0.41% and 1.31%; the baseline (24, 2) has 8 loops and a 0.1% share. With a′=48a'=48, more loops persist long enough to meet the detector criterion before ending, consistent with the later activation in Proposition 5. Coverage/JSON are 39.1%/28.9% for a′=12a'=12 and 38.1%/37.8% for a′=48a'=48. For c0=4c_0=4 they are 37.8%/28.9%.

Windowed lock status and finite survival. The second run, with a 4,096-token look-back for DRY and DRY-C, covers all eleven models with 150 units each (Phi-4 again capped at 4,000 tokens). Top-pp is ever locked on 1,632/1,650 units and locked through the last ten repetitions on 1,577/1,650. DRY has 28 ever-locked and 23 finally locked units, all final locks with 5≤g≤75 \le g \le7; DRY-C (bc=3b_c=3) has 3 ever-locked units and no final locks. In Table 9, k3k_3 is the probability, starting with three copies in context, of following the loop to that unit’s measured endpoint, averaged over units.

ModelNNtop-pp ever/finaltop-pp mean k3k_3DRY ever/finalDRY mean k3k_3DRY-C ever/finalDRY-C mean k3k_3
Gemma-2-2B150144/1200.02213/23.23e-100/00
Gemma-2-9B150150/1370.06963/30.0007380/00
Llama-3.1-8B150150/1500.1131/19.57e-060/00
Llama-3.2-3B150143/1420.1471/11.38e-060/00
Phi-4-mini150150/1490.4720/06.83e-350/00
Qwen2.5-1.5B150150/1500.1303/30.0004350/00
Qwen2.5-7B150150/1490.3463/30.001730/00
Qwen3-1.7B150150/1490.2724/30.00610/00
Qwen3-4B150150/1500.3734/30.008391/00
Qwen3-8B150150/1490.7004/30.01462/00
R1-Distill-7B150145/1320.0009022/12.99e-080/00

Table 9. Window W=4096W = 4096: ever-locked/finally-locked counts and mean finite-horizon k3k_3. Final: last ten repetitions all locked. DRY-C uses bc=3b_c = 3.

Actual breaker gaps. Of 3,080 colon units, 2,914 satisfy the top-pp last-ten lock criterion. Retokenization changes the actual gap on 51 units overall, including 48 of these 2,914. Table 10 contrasts grouping by the intended insertion interval with grouping by the recorded actual token gap. The transition persists: at actual g=6g=6, 277/417 remain locked under DRY; at g=8g=8, 5/418 do. The semicolon control has 0/2,919 remaining locks; its denominator counts the control units (out of 3,080) that lock under top-pp alone.

ggNominal intervalActual gap
2400/400392/392
3404/409410/415
4393/419393/418
5–1/2
6276/416277/417
85/4225/418
9–0/3
10–0/1
11–0/2
120/4230/421
23–0/30
240/4250/395

Table 10. DRY-locked / top-pp-locked colon units, pooled over eleven models, under nominal and actual gap grouping.

Stricter requested-copying evaluation. This experiment adds four tasks that repeat blocks of short lines to the twelve tasks of Appendix § 13. Each setting has 16 tasks with 10 samples each (160 generations per model and setting). We report both whitespace-normalized substring counts and strict counts that normalize only spaces/tabs immediately before a newline, preserving internal spaces and line structure (Table 11). Trailing whitespace is normalized because default outputs also use trailing double spaces as Markdown line breaks. The strict metric shows additional copying loss from DRY-C: overall success falls from DRY’s 10.6% to 6.3% on Llama and from 18.1% to 11.2% on Qwen at c0=2c_0=2. On the four block tasks (40 generations), strict success is 42.5% to 25.0% on Llama and 30.0% to 10.0% on Qwen. Raising c0c_0 to 6 brings these to 40.0% and 27.5%, respectively. The count term therefore costs extra on legitimately repeated blocks, a cost the twelve-task test does not reveal.

SamplerLlama norm.Llama strictQwen norm.Qwen strict
default127120127126
DRY27173129
DRY + rep. 1.0528123531
DRY, newline only32182624
DRY-C, c0=2c_0 = 226101818
DRY-C, c0=6c_0 = 630162822

Table 11. Requested repetition, 16-task experiment: successful generations out of 160 in every cell. Norm.: whitespace-normalized; strict: only trailing line whitespace normalized.

Count activation outside detected loops. Table 12 counts teacher-forced activations on default-sampler generations with no loop under our detector, using exact (a′+1)(a' + 1)-token tuples and a 4,096-token window (all sequences are at most 3,000 tokens). At (a′,c0)=(24,2)(a', c_0)=(24, 2), at least one continuation would be penalized in 108/285 (37.9%) Qwen structured outputs and 57/302 (18.9%) Llama structured outputs; affected-position shares are 3.0% and 5.7%. For prose the corresponding generation shares are 9/180 (5.0%) and 50/167 (29.9%). Raising either threshold reduces them.

a′a'c0c_0Structured QwenStructured LlamaProse Qwen / Llama
12268.153.014.4 / 49.7
12442.842.72.8 / 19.8
24237.918.95.0 / 29.9
24414.413.20.0 / 15.0
48227.010.31.7 / 18.0
4846.76.00.0 / 9.0

Table 12. Potential count activations in generations without detected loops (% with at least one activation). Structured NN = 285/302, prose NN = 180/167 for Qwen/Llama; denominators are fixed across the grid.

Near-loops. Does DRY-C just push verbatim loops into approximate ones that our detector misses? We decoded all 8,280 structured generations and computed two text-level measures: the zlib compression ratio (lower means more repetitive) and the share of lines that are at least 90% similar (difflib) to an earlier line, ignoring lines under five characters. Going from DRY to DRY-C, the share of generations with no verbatim loop but more than half of their lines near-duplicated rises a little, from 8.9% to 12.2% on Qwen and from 17.8% to 19.7% on Llama. Overall repetition does not rise: the median compression ratio goes up (0.339 to 0.347 on Qwen, 0.323 to 0.347 on Llama), and the median near-duplicate line share is essentially unchanged (0.083 to 0.081; 0.050 to 0.054). So a few verbatim loops turn into drifting near-repeats, but the repetition is not simply moved out of sight.

References

  1. [1]Sourya Basu, Govardana Sachitanandam Ramachandran, Nitish Shirish Keskar, and Lav R. Varshney. 2021. Mirostat: A neural text decoding algorithm that directly controls perplexity. In International Conference on Learning Representations.
  2. [2]DeepSeek-AI. 2025. DeepSeek-R1: Incentivizing reasoning capability in LLMs via reinforcement learning. arXiv preprint arXiv:2501.12948.DOI
  3. [3]Yuanhao Ding, Meimingwei Li, Esteban Garces Arias, Matthias Aßenmacher, Christian Heumann, and Chongsheng Zhang. 2026. Breaking the likelihood trap: Variance-calibrated modulation for large language model decoding. arXiv preprint arXiv:2606.22511.arxiv.org/abs/2606.22511
  4. [4]Yixin Dong, Charlie F. Ruan, Yaxing Cai, Ruihang Lai, Ziyi Xu, Yilong Zhao, and Tianqi Chen. 2024. XGrammer: Flexible and efficient structured generation engine for large language models. arXiv preprint arXiv:2411.15100.arxiv.org/abs/2411.15100
  5. [5]El Hassane Ettifouri, Ayoub Belfatmi, Mahaman Sanoussi Yahaya Alassan, and Walid Dahbane. 2026. Calibrated e-CUSUM decoding for quantized reasoning models: Why token log-probability is the wrong observable for decoding monitors. arXiv preprint arXiv:2607.11317.arxiv.org/abs/2607.11317
  6. [6]Matthew Finlayson, John Hewitt, Alexander Koller, Swabha Swayamdipta, and Ashish Sabharwal. 2024. Closing the curious case of neural text degeneration. In International Conference on Learning Representations.arxiv.org/abs/2310.01693
  7. [7]Zihao Fu, Wai Lam, Anthony Man-Cho So, and Bei Shi. 2021. A theoretical analysis of the repetition problem in text generation. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 35, pages 12848–12856.arxiv.org/abs/2012.14660
  8. [9]Georgi Gerganov and contributors. 2023. llama.cpp: LLM inference in C/C++.
  9. [10]Antonio A. Ginart, Naveen Kodali, Jason Lee, Caiming Xiong, Silvio Savarese, and John R. Emmons. 2025. LZ penalty: An information-theoretic repetition penalty for autoregressive language models. arXiv preprint arXiv:2504.2031.arxiv.org/abs/2504.20131
  10. [11]Esmail Gumaan. 2026. Feedback that backfires: Why small language model agents repeat the call they just watched fail. arXiv preprint arXiv:2608.23651.arxiv.org/abs/2608.23651
  11. [12]John Hewitt, Christopher D. Manning, and Percy Liang. 2022. Truncation sampling as language model desmoothing. In Findings of the Association for Computational Linguistics: EMNLP 2022.arxiv.org/abs/2210.15191
  12. [13]Peter Hollows. 2026. Gauge dependence and structured-output corruption in sign-branched repetition penalties: Measurements across models, inference stacks, and alternative repetition controls. arXiv preprint arXiv:2607.09791.arxiv.org/abs/2607.09791
  13. [14]Ari Holtzman, Jan Buys, Li Du, Maxwell Forbes, and Yejin Choi. 2020. The curious case of neural text degeneration. In International Conference on Learning Representations.
  14. [15]Nitish Shirish Keskar, Bryan McCann, Lav R. Varshney, Caiming Xiong, and Richard Socher. 2019. CTRL: A conditional transformer language model for controllable generation. arXiv preprint arXiv:1909.05858.arxiv.org/abs/1909.05858
  15. [16]Guillaume Klein, Yoon Kim, Yuntian Deng, Jean Senel-lart, and Aleksander Rush. 2017. OpenNMT: Open-source toolkit for neural machine translation. In Proceedings of ACL 2017, System Demonstrations.arxiv.org/abs/1701.02810
  16. [17]Aristotelis Lazaridis, Aman Sharma, Dylan Bates, Brian King, Vincent Lu, and Jack FitzGerald. 2026. When can one neuron fix repetition loops in LLMs? arXiv preprint arXiv:2606.13705.arxiv.org/abs/2606.13705
  17. [18]Dongkyu Lee, Gyeonghun Kim, Janghoon Han, Tae-suk Hong, Yi-Reun Kim, Stanley Jungkyu Choi, and Nevin L. Zhang. 2023. Local temperature beam search: Avoid neural text DeGeneration via enhanced calibration. In Findings of the Association for Computational Linguistics: ACL 2023, pages 9903–9915.DOI
  18. [19]Junyoung Lee, Sehyeon Park, Shinhyoung Jang, Seonha Ryu, Hojeong Kim, Hyunsei Lee, Il Hong Suh, and Yeseong Kim. 2026. FOCUS & RePAIR: Mitigating text degeneration via token-level guidance for pruned large language models. arXiv preprint arXiv:2608.26676.arxiv.org/abs/2608.26676
  19. [20]Huayang Li, Tian Lan, Zihao Fu, Deng Cai, Lemao Liu, Nigel Collier, Taro Watanabe, and Yixuan Su. 2023. Repetition in repetition out: Towards understanding neural text degeneration from the data perspective. In Advances in Neural Information Processing Systems, volume 36.arxiv.org/abs/2310.10226
  20. [22]Matéo Mahaut and Francesca Franzon. 2025. Repetitions are not all alike: Distinct mechanisms sustain repetition in language models. arXiv preprint arXiv:2504.01100.arxiv.org/abs/2504.01100
  21. [23]Clara Meister, Tiago Pimentel, Gian Wıher, and Ryan Cotterell. 2023. Locally typical sampling. Transactions of the Association for Computational Linguistics, 11:102–121.
  22. [24]Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. 2017. Pointer sentinel mixture models. In International Conference on Learning Representations.arxiv.org/abs/1609.07843
  23. [25]Microsoft. 2025. Phi-4-mini technical report: Compact yet powerful multimodal language models via mixture-of-LoRAs. arXiv preprint arXiv:2503.01743.
  24. [26]Minh Nhat Nguyen, Andrew Baker, Clement Neo, Allen Roush, Andreas Kirsch, and Ravid Shwartz-Ziv. 2024. Turning up the heat: Min-p sampling for creative and coherent LLM outputs. arXiv preprint arXiv:2407.01082.arxiv.org/abs/2407.01082
  25. [27]Catherine Olsson, Nelson Elhage, Neel Nanda, Nicholas Joseph, Nova DasSarma, Tom Henighan, Ben Mann, Amanda Askell, Yuntao Bai, Anna Chen, et al. 2022. In-context learning and induction heads. arXiv preprint arXiv:2209.11895.arxiv.org/abs/2209.11895
  26. [28]Samuel Paech, Allen Roush, Judah Goldfeder, and Ravid Shwartz-Ziv. 2025. Antislop: A comprehensive framework for identifying and eliminating repetitive patterns in language models. arXiv preprint arXiv:2510.15061.arxiv.org/abs/2510.15061
  27. [29]Romain Paulus, Caiming Xiong, and Richard Socher. 2018. A deep reinforced model for abstractive summarization. In International Conference on Learning Representations.arxiv.org/abs/1705.04304
  28. [30]Charilaos Pipis, Shivam Garg, Vasilis Kontonis, Vaishnavi Shrivastava, Akshay Krishnamurthy, and Dimitris Papailiopoulos. 2025. Wait, wait, wait... why do reasoning models loop? arXiv preprint arXiv:2512.12895.arxiv.org/abs/2512.12895
  29. [32]Qwen Team. 2025. Qwen3 technical report. arXiv preprint arXiv:2505.09388.
  30. [33]Yixuan Su, Tian Lan, Yan Wang, Dani Yogatama, Lingpeng Kong, and Nigel Collier. 2022. A contrastive framework for neural text generation. In Advances in Neural Information Processing Systems, volume 35.arxiv.org/abs/2202.06417
  31. [34]Weiwei Wang, Weijie Zou, and Jiyong Min. 2025. Solving LLM repetition problem in production: A comprehensive study of multiple solutions. arXiv preprint arXiv:2512.04419.arxiv.org/abs/2512.04419
  32. [35]Philipp Emanuel Weidmann. 2024. DRY: A modern repetition penalty that reliably prevents looping. Pull request #5677, ooba­booga/text-generation-webui.
  33. [36]Philipp Emanuel Weidmann, Allen Roush, Judah Goldfeder, Sanjay Basu, and Ravid Shwartz-Ziv. 2026a. XTC: Head-aware sampling by excluding top choices. arXiv preprint arXiv:2608.22758.arxiv.org/abs/2608.22758
  34. [37]Philipp Emanuel Weidmann, Allen G. Roush, Judah Goldfeder, Sanjay Basu, and Ravid Shwartz-Ziv. 2026b. Don’t repeat yourself: Stopping verbatim loops at sampling time. arXiv preprint arXiv:2608.22761.arxiv.org/abs/2608.22761
  35. [38]Sean Welleck, Ilia Kulikov, Stephen Roller, Emily Dinan, Kyunghyun Cho, and Jason Weston. 2020. Neural text generation with unlikelihood training. In International Conference on Learning Representations.
  36. [39]Brandon T. Willard and Rémi Louf. 2023. Efficient guided generation for large language models. arXiv preprint arXiv:2307.09702.arxiv.org/abs/2307.09702
  37. [40]Wenya Xie, Shaochen Zhong, Hoang Anh Duy Le, Zhaozhuo Xu, Jianwen Xie, and Zirui Liu. 2025. Word salad chopper: Reasoning models waste a ton of decoding budget on useless repetitions, self-knowingly. arXiv preprint arXiv:2511.00536.arxiv.org/abs/2511.00536

Paper details

vlnc:W_h64zvkcf
v1 · latestHistory (1)

published · Fresh — added to the Hub within the last 30 days

added ·

Usage

views · 0

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

CC BY 4.0

Original source

  • Computer Science

Claude · View statement →

Looking for related papers…
Contents