[GH-ISSUE #5274] [Other] Long-context degeneration in Qwen3.8-Flash-Next is distributed, not a localized weight direction (negative result) #3141

Open
opened 2026-11-07 14:38:24 +07:00 by bsakaguchi · 3 comments
Owner

Originally created by @e041l4su3qu4u03 on GitHub (Nov 5, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/5274

TL;DR — rank-1 weight surgery (and whole-layer ablation) does not fix the
long-context degeneration of Qwen3.8-Flash-Next. The failure is distributed across the
48 layers, not concentrated in a few editable directions. The wrap detector in #5218 is
the practical fix; this issue is the negative result behind that choice.

This is not a bug report. It is a reproducible measurement, posted so nobody has to
spend another 40 hours on the same experiment.

Context

  • #5218: a guard that detects the hyphen run-on at 512 output tokens and wraps the
    reasoning. It works 3/3 on 0.2.10, while four existing guards do not.
  • #5212: a benchmark issue where udqe noticed that B/D's finish=length with zero
    parsed findings rhymes with #5218. That prompted this write-up.

Setup

  • Model: Qwen3.8-Flash-Next, ISTA-DASLab GSQ-RCO IQ3_S (two GGUF shards)
  • Engine: Strata 0.2.10 / engine 0.1.56 for the reference run; llama.cpp 0.9.0-dev
    (CUDA, RTX 4090) for per-layer access
  • Prompt: 134,592 tokens, captured from the Strata request (not reconstructed from
    the chat template; reconstructing it dropped 35k tokens of historical
    reasoning_content and the model emitted EOS immediately)
  • Sampling: temperature 1.0, top_p 0.95, top_k 20
  • Replay: exact token ids into llama.cpp; 48-layer ffn_out, l_last and
    ffn_moe_probs dumps for 600 decode steps; 134k KV state cache for fast repeats

Reproduction of the degeneration

600 generated tokens, 2,717 chars, hyphen_run = 348, finish=length, no parseable
answer. The signature matches the guarded runs in #5218 (longest chain 348 vs. 259–765
there), and detect.py reports VERDICT: LOOP.

Why rank-1 does not apply here

Measurement Result Surgery precondition
ffn_out top-3 layer share, step 20→120 14.5% > 50%
ffn_out top-3, step 120→550 14.0% > 50%
ffn_out top-3, step 20→550 13.5% > 50%
routing (ffn_moe_probs) JS top-3, early vs late 11.1% > 50%
mean cross-layer cosine of per-step deltas 0.013 close to 1
global delta, top-1 explained variance 7.8% a dominant direction

Whole-layer ablation, one layer at a time, same seed (3), 600 steps:

Result Layers
still LOOP 41 / 48
below the hyphen threshold 7 / 48

The 7 “below threshold” runs did not recover: six stayed telegraphic / self-referential,
one (L47) turned into a numeric loop (100,000,000,...). Ablation changes the failure
mode; it does not restore the capability.

l_last does show 37–39% concentration in the last layers, but that is cumulative
residual growth, not a local lesion: every layer's change is added to the stream.

What I would ask the community

  1. Has anyone found a compact loop direction for long-context degeneration in this
    family (Qwen3.8 / MoE hybrid), rather than a distributed drift?
  2. Has activation steering (residual-stream vector, no weight edit) been tried on
    this failure? It would be cheaper to test than a quantized-weight edit.
  3. Is there a router-level intervention that works when the FFN outputs are flat but the
    routing still drifts?

Reproducibility

The exact prompt contains private session data, so it cannot be posted as-is. I can
provide a redacted 100k+ agent transcript if the signature survives sanitization;
the exact token ids and the 134k state cache are local. The analysis scripts are plain
Python/numpy and can be shared.


(ai-assisted write-up; all numbers above are from the same IQ3_S / 0.2.10 runs as #5218.)

Originally created by @e041l4su3qu4u03 on GitHub (Nov 5, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/5274 **TL;DR** — rank-1 weight surgery (and whole-layer ablation) does not fix the long-context degeneration of Qwen3.8-Flash-Next. The failure is distributed across the 48 layers, not concentrated in a few editable directions. The wrap detector in #5218 is the practical fix; this issue is the negative result behind that choice. This is **not a bug report**. It is a reproducible measurement, posted so nobody has to spend another 40 hours on the same experiment. ## Context - #5218: a guard that detects the hyphen run-on at 512 output tokens and wraps the reasoning. It works 3/3 on 0.2.10, while four existing guards do not. - #5212: a benchmark issue where `udqe` noticed that B/D's `finish=length` with zero parsed findings *rhymes* with #5218. That prompted this write-up. ## Setup - Model: Qwen3.8-Flash-Next, ISTA-DASLab GSQ-RCO IQ3_S (two GGUF shards) - Engine: Strata 0.2.10 / engine 0.1.56 for the reference run; llama.cpp 0.9.0-dev (CUDA, RTX 4090) for per-layer access - Prompt: **134,592 tokens**, captured from the Strata request (not reconstructed from the chat template; reconstructing it dropped 35k tokens of historical `reasoning_content` and the model emitted EOS immediately) - Sampling: temperature 1.0, top_p 0.95, top_k 20 - Replay: exact token ids into llama.cpp; 48-layer `ffn_out`, `l_last` and `ffn_moe_probs` dumps for 600 decode steps; 134k KV state cache for fast repeats ## Reproduction of the degeneration 600 generated tokens, 2,717 chars, `hyphen_run = 348`, `finish=length`, no parseable answer. The signature matches the guarded runs in #5218 (longest chain 348 vs. 259–765 there), and `detect.py` reports `VERDICT: LOOP`. ## Why rank-1 does not apply here | Measurement | Result | Surgery precondition | |---|---:|---| | `ffn_out` top-3 layer share, step 20→120 | **14.5%** | > 50% | | `ffn_out` top-3, step 120→550 | **14.0%** | > 50% | | `ffn_out` top-3, step 20→550 | **13.5%** | > 50% | | routing (`ffn_moe_probs`) JS top-3, early vs late | **11.1%** | > 50% | | mean cross-layer cosine of per-step deltas | **0.013** | close to 1 | | global delta, top-1 explained variance | **7.8%** | a dominant direction | Whole-layer ablation, one layer at a time, same seed (3), 600 steps: | Result | Layers | |---|---:| | still LOOP | **41 / 48** | | below the hyphen threshold | 7 / 48 | The 7 “below threshold” runs did not recover: six stayed telegraphic / self-referential, one (L47) turned into a numeric loop (`100,000,000,...`). Ablation changes the failure mode; it does not restore the capability. `l_last` does show 37–39% concentration in the last layers, but that is cumulative residual growth, not a local lesion: every layer's change is added to the stream. ## What I would ask the community 1. Has anyone found a **compact loop direction** for long-context degeneration in this family (Qwen3.8 / MoE hybrid), rather than a distributed drift? 2. Has **activation steering** (residual-stream vector, no weight edit) been tried on this failure? It would be cheaper to test than a quantized-weight edit. 3. Is there a router-level intervention that works when the FFN outputs are flat but the routing still drifts? ## Reproducibility The exact prompt contains private session data, so it cannot be posted as-is. I can provide a **redacted** 100k+ agent transcript if the signature survives sanitization; the exact token ids and the 134k state cache are local. The analysis scripts are plain Python/numpy and can be shared. --- (ai-assisted write-up; all numbers above are from the same IQ3_S / 0.2.10 runs as #5218.)
Author
Owner

@e041l4su3qu4u03 commented on GitHub (Nov 5, 2026):

Adding the related work I checked before filing this, so the negative result is not
read as "nobody looked".

1. The closest paper

When Can One Neuron Fix Repetition Loops in LLMs? — arXiv:2606.13705 (v2, Aug 2026)

It edits Qwen3.5-4B (the cross-family arm) with 100 L12 neurons, sign-inverted,
not 2 neurons. Reported effect:

  • Antidoom detector: 181 → 104 positives (111 resolved, 34 introduced)
  • their detector: 74 → 42 (56 resolved, 24 introduced)
  • natural stopping: 95 → 166 of 400; the rest still hit the token limit

The paper's own conclusions matter more than the headline:

  • no universal loop circuit; attribution rankings are unstable across captures
  • for the 26B MoE, masking 3/3840 routed experts was not distinguishable from
    matched random masks
    on held-out data
  • loop count falling is not task completion; residual failures shift to "doom looping"

That is the same shape as the flat layer/routing result in this issue, on a much smaller
model.

2. Training-based alternative: Antidoom / FTPO

FTPO mines the loop-start token, builds preference pairs, and trains a LoRA adapter.
Reported Qwen3.5-4B result: 22.9% → 1% loop rate under greedy; ~2–4 h on an H100.
It is not weight surgery, and on Qwen 113/400 outputs still exhausted the budget even
when the detector no longer called them loops.

3. Weight-space programming (Astra)

The successful Qwen3.5-0.8B edit touches 0.016% of weights, but it uses ~50 forward
passes and a small dense model. It does not address a 134k-token, 48-layer, 512-expert
context.

4. Inference-time steering

Steering vectors work for compact behaviors (refusal, sentiment, formality). I did not
find a published result for long-context degeneration of this kind; if anyone has one,
that is the direction I would test next, because it does not require rewriting IQ3_S
weights.


If anyone has a compact loop direction for Qwen3.8-Flash-Next (or another 48-layer MoE
with 512 experts), I would like to compare measurements. The flatness here is measured,
not assumed: ffn_out top-3 share 13.5–14.5%, routing JS top-3 11.1%, 41/48 layers still
loop after single-layer ablation.

<!-- gh-comment-id:6651356131 --> @e041l4su3qu4u03 commented on GitHub (Nov 5, 2026): Adding the related work I checked before filing this, so the negative result is not read as "nobody looked". ### 1. The closest paper **When Can One Neuron Fix Repetition Loops in LLMs?** — arXiv:2606.13705 (v2, Aug 2026) It edits Qwen3.5-4B (the cross-family arm) with **100 L12 neurons, sign-inverted**, not 2 neurons. Reported effect: - Antidoom detector: **181 → 104** positives (111 resolved, 34 introduced) - their detector: **74 → 42** (56 resolved, 24 introduced) - natural stopping: 95 → 166 of 400; the rest still hit the token limit The paper's own conclusions matter more than the headline: - no universal loop circuit; attribution rankings are unstable across captures - for the **26B MoE**, masking 3/3840 routed experts was **not distinguishable from matched random masks** on held-out data - loop count falling is not task completion; residual failures shift to "doom looping" That is the same shape as the flat layer/routing result in this issue, on a much smaller model. ### 2. Training-based alternative: Antidoom / FTPO - code: https://github.com/Liquid4All/antidoom - data: https://huggingface.co/datasets/LiquidAI/antidoom-mix-v1.0 FTPO mines the loop-start token, builds preference pairs, and trains a LoRA adapter. Reported Qwen3.5-4B result: 22.9% → 1% loop rate under greedy; ~2–4 h on an H100. It is not weight surgery, and on Qwen 113/400 outputs still exhausted the budget even when the detector no longer called them loops. ### 3. Weight-space programming (Astra) - write-up: https://rikiyat.github.io/blog/weight-space-programming/ - logs: https://github.com/RikiyaT/lm_understand-logs - edited models: https://huggingface.co/edgerunner-ai (Gemma-4 *-noloop variants) The successful Qwen3.5-0.8B edit touches 0.016% of weights, but it uses ~50 forward passes and a small dense model. It does not address a 134k-token, 48-layer, 512-expert context. ### 4. Inference-time steering - index: https://github.com/Lukas-Xue/awesome-inference-time-steering Steering vectors work for compact behaviors (refusal, sentiment, formality). I did not find a published result for long-context degeneration of this kind; if anyone has one, that is the direction I would test next, because it does not require rewriting IQ3_S weights. --- If anyone has a compact loop direction for Qwen3.8-Flash-Next (or another 48-layer MoE with 512 experts), I would like to compare measurements. The flatness here is measured, not assumed: `ffn_out` top-3 share 13.5–14.5%, routing JS top-3 11.1%, 41/48 layers still loop after single-layer ablation.
Author
Owner

@udqe commented on GitHub (Nov 5, 2026):

The credit chain in your write-up should be corrected in one direction: our comment was a pointer, yours is forty hours - the proportionality here is that negative results are the expensive half. Posting the ablation matrix (41/48 still LOOP, the seven "below threshold" runs changing failure mode rather than recovering, L47's numeric loop) is exactly the artifact that saves the next person the week, and it is the second time this week we have watched a tracker thread do that in public.

Your two community questions, answered honestly as nulls: (1) compact loop direction - nothing in our season's records, our measurements live at the serving layer (routing, cache, split, budgets) and we have no weight-side tooling behind the claim "we looked and found nothing"; (2) activation steering - same null. The most useful transferable thing we can say is what your own table already shows: the surgery preconditions (>50% top-3 share, dominant direction, cosine near 1) are not near-misses - they are an order of magnitude off (14.5% against 50%, 7.8% top-1 EV, cosine 0.013), which reads less like "wrong layers" and more like a different failure kind entirely. Whatever a fix is, it is probably not in the lesion-and-repair family at all.

One generalization from our side that your setup note independently proves. Today on PR #5189 we captured the other server-side transcript intervention this project has (the answer_room wrap-up) verbatim from a live run: a closing sentence injected into reasoning, no client-side flag, no finish_reason, invisible in usage. Your detector-guard is the second one - right intervention (it fires on measured signatures), same transcript property: after any wrap, the bytes the client stored are not the bytes the model streamed, and nothing in the response says so. Your own reproduction is the strongest argument for making that explicit: reconstructing the prompt from the chat template "dropped 35k tokens of historical reasoning_content and the model emitted EOS immediately" - transcript fidelity is load-bearing at 134k, so provenance (a usage field, a finish_reason, even a count of injected bytes) is not cosmetic for this family. The ask we filed on #5189 generalizes to your guard verbatim: when it ships, flag the cut.

Status so the thread does not read as closed: the B/D raw text and the finish=length cap provenance on #5212 are with the benchmark's author, and your four-class discriminator plus the batch-MTP separation arms are queued on that one artifact - nothing further for anyone's box to run until it lands.

Scope: we ran nothing for this comment; no weight-side claim is made anywhere above; external figures are yours or from #5212/#5189 as posted.

(ai-assisted; our #5189 capture as posted today at 15:27 JST)

<!-- gh-comment-id:6651668208 --> @udqe commented on GitHub (Nov 5, 2026): The credit chain in your write-up should be corrected in one direction: our comment was a pointer, yours is forty hours - the proportionality here is that negative results are the expensive half. Posting the ablation matrix (41/48 still LOOP, the seven "below threshold" runs changing failure mode rather than recovering, L47's numeric loop) is exactly the artifact that saves the next person the week, and it is the second time this week we have watched a tracker thread do that in public. Your two community questions, answered honestly as nulls: (1) compact loop direction - nothing in our season's records, our measurements live at the serving layer (routing, cache, split, budgets) and we have no weight-side tooling behind the claim "we looked and found nothing"; (2) activation steering - same null. The most useful transferable thing we can say is what your own table already shows: the surgery preconditions (>50% top-3 share, dominant direction, cosine near 1) are not near-misses - they are an order of magnitude off (14.5% against 50%, 7.8% top-1 EV, cosine 0.013), which reads less like "wrong layers" and more like a different failure kind entirely. Whatever a fix is, it is probably not in the lesion-and-repair family at all. One generalization from our side that your setup note independently proves. Today on PR #5189 we captured the other server-side transcript intervention this project has (the answer_room wrap-up) verbatim from a live run: a closing sentence injected into reasoning, no client-side flag, no finish_reason, invisible in usage. Your detector-guard is the second one - right intervention (it fires on measured signatures), same transcript property: after any wrap, the bytes the client stored are not the bytes the model streamed, and nothing in the response says so. Your own reproduction is the strongest argument for making that explicit: reconstructing the prompt from the chat template "dropped 35k tokens of historical reasoning_content and the model emitted EOS immediately" - transcript fidelity is load-bearing at 134k, so provenance (a usage field, a finish_reason, even a count of injected bytes) is not cosmetic for this family. The ask we filed on #5189 generalizes to your guard verbatim: when it ships, flag the cut. Status so the thread does not read as closed: the B/D raw text and the `finish=length` cap provenance on #5212 are with the benchmark's author, and your four-class discriminator plus the batch-MTP separation arms are queued on that one artifact - nothing further for anyone's box to run until it lands. Scope: we ran nothing for this comment; no weight-side claim is made anywhere above; external figures are yours or from #5212/#5189 as posted. (ai-assisted; our #5189 capture as posted today at 15:27 JST)
Author
Owner

@e041l4su3qu4u03 commented on GitHub (Nov 5, 2026):

Landed in #5218 as 87e392a (2 commits, 3 files, +111/−5): the guard now says when it
changed the transcript.

Response shape (only when a wrap happened):

"usage": {
  "strata_wrap": {
    "reason": "hyphen run-on",
    "detail": "longest chain 348 chars",
    "at_token": 512,
    "injected_chars": 62
  }
}

It is carried on Chat Completions, the Responses API, and Anthropic message_delta.usage,
and the same record goes into /metrics history. Non-wrapped responses are unchanged.

One bug found while wiring it, which matters for the detector itself: the reasoning
text was accumulated under if self.reasoning_loop_recovery and ev.kind == "reasoning":,
so a standalone reasoning_degeneracy setting received an empty string and could never
fire. That is now if (self.reasoning_loop_recovery or self.reasoning_degeneracy != "off").
Without it, the flag would have been permanently false for the exact configuration the PR
documents.

20 unit tests pass, including a wrap that asserts the reason, position and injected
character count. No model was loaded for that test (MockEngine).

I agree with your framing: after a wrap, the bytes the client stored are not the bytes the
model streamed, and at 134k that difference is load-bearing. The flag is the minimum that
makes it visible; a finish_reason change would break clients, so usage was the safer
surface.

<!-- gh-comment-id:6651993355 --> @e041l4su3qu4u03 commented on GitHub (Nov 5, 2026): Landed in #5218 as **87e392a** (2 commits, 3 files, +111/−5): the guard now says when it changed the transcript. **Response shape (only when a wrap happened):** ```json "usage": { "strata_wrap": { "reason": "hyphen run-on", "detail": "longest chain 348 chars", "at_token": 512, "injected_chars": 62 } } ``` It is carried on Chat Completions, the Responses API, and Anthropic `message_delta.usage`, and the same record goes into `/metrics` history. Non-wrapped responses are unchanged. **One bug found while wiring it, which matters for the detector itself:** the reasoning text was accumulated under `if self.reasoning_loop_recovery and ev.kind == "reasoning":`, so a standalone `reasoning_degeneracy` setting received an empty string and could never fire. That is now `if (self.reasoning_loop_recovery or self.reasoning_degeneracy != "off")`. Without it, the flag would have been permanently false for the exact configuration the PR documents. 20 unit tests pass, including a wrap that asserts the reason, position and injected character count. No model was loaded for that test (MockEngine). I agree with your framing: after a wrap, the bytes the client stored are not the bytes the model streamed, and at 134k that difference is load-bearing. The flag is the minimum that makes it visible; a `finish_reason` change would break clients, so `usage` was the safer surface.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#3141
No description provided.