GLM 5.3 Flash: long agentic thinking turn degenerates into one repeated token at temperature 1.0; no server-side repetition control

Aperta
#1,301 0 commenti 1 reazione 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
c

Direzione di ricerca

Start by reading the request parsing and sampler paths described in the issue, then trace the decode loop to see how generated tokens and thinking blocks are handled. Reproduce the repeated-token output with the supplied GLM-5.3-Flash settings if the model is available. Done means the server can prevent or recover from this loop, with behavior covered by a focused test; the issue offers two possible approaches but leaves the choice open.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Summary

A long agentic thinking turn degenerated into one repeated token, even with the model card's sampling.

Setup:

  • GLM-5.3-Flash Q2, resident: --ctx 393216 --warm-weights, disk KV.
  • M5 Max 128 GB, ds4 at 5379c1c.
  • Client: Hermes Agent through /v1/chat/completions, with temperature 1.0, top_p 0.95, top_k 0, min_p 0 and reasoning_effort: high.

After 29 consecutive tool calls in one user turn, the 30th reasoning block degenerated:

generated tokens context position content
0 – 5,779 128,794 – 134,573 ordinary (increasingly terse) reasoning
5,780 – 7,559 134,574 – 136,353 hmm — repeated 890 times
7,561 – ~20,600 136,355 – ~149,400 token 68926 aaaaaaaa, repeated ~13,000 times

Decode held ~21.9 tok/s throughout, and the client cut the stream after about 16 minutes. The token ids come from the continued checkpoint the server wrote at 143,360 tokens.

This is not greedy decoding, so it is a different case from #1196 and #1045 (DeepSeek at temperature 0 / 0.2).

What led into it

This model keeps all previous reasoning by default (clear_thinking is false). So the turn's earlier reasoning blocks made up 51% of the 128,794-token prompt. Their style drifted, measured per 1K characters of reasoning:

reasoning blocks hmm =
first 30 turns of the session 0.8 0.2
this turn, 1–10 2.0 8.7
this turn, 11–20 3.4 12.4
this turn, 21–29 10.4 18.2
this turn, 30 the loop above

Engine side, as far as I can tell

  • Not the checkpoints. Two continued checkpoints were written during this decode, at 133,120 and 143,360 tokens. The first came 1,454 tokens before the stutter began, and the GLM payload save only reads state.
  • No repetition control. The request parsers silently skip presence_penalty, frequency_penalty and repetition_penalty (json_skip_value); the sampler reads only temperature, top_p, top_k, min_p and seed. An OpenAI-compatible client has no way to push back on a loop, and nothing on the server stops a run of one repeated token before max_tokens.

Possible fixes

  1. Honour presence_penalty / frequency_penalty over the generated tokens, skipping speculative decoding while they are set.
  2. Add a cheap guard in the decode loop: inside thinking, when the last few hundred generated tokens are an exact cycle with a short period, emit the think-close sequence so the model moves on to its answer. This is the trailing-block detection #1196 suggests, and it would also end the greedy loops there.

I can send a PR for either if you have a preference.

Lingua principale
C
Stelle
24.4k
Fork
2.4k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di antirez/ds4

Tutte le issue di antirez/ds4

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.