M5 Ultra: decode drift and repetition loops when M5_PARALLEL_FULL_FFN and M5_ROUTER_PROJECT_SELECT_FUSE are both enabled

Aperta
#1,316 0 commenti 0 reazioni 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
43/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
c, macos

Direzione di ricerca

Start by locating the implementations of M5_PARALLEL_FULL_FFN and M5_ROUTER_PROJECT_SELECT_FUSE, then trace their interaction on the M5 Ultra Metal decode path. Reproduce with the supplied ds4 command and compare --decode-consistency 16 results with each flag disabled in turn. Done means the default configuration matches the consistent 0.723 max_abs and 0.122 rms baseline across repeated runs without decode drift.

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

Descrizione

On an M5 Ultra, DeepSeek V4 Flash Q2 decode drifts badly from a fresh prefill and often degenerates into repetition loops. It only happens when M5_PARALLEL_FULL_FFN and M5_ROUTER_PROJECT_SELECT_FUSE are both enabled (the default). Disabling either one fixes it. Results vary run to run under greedy decoding, so it looks like a missing barrier between the fused router select and the parallel FFN.

Repro

ds4 -p "Explain Redis streams in one paragraph." --nothink --decode-consistency 16

Sample degenerate output from a default run (thinking on, default sampling):

###. Redis streams are one paragraph explanation. Let's think about Redis streams. [...] They have "a" "b" "c" "d" "e" "f" [...] "x" "y" "z" "z" "a" "b" "c" [...]

Results

--decode-consistency 16, two runs per config:

Config max_abs rms
Default 22.63 / 8.23 4.78 / 1.58
DS4_METAL_DISABLE_M5_PARALLEL_FULL_FFN=1 0.723 / 0.723 0.122 / 0.122
DS4_METAL_DISABLE_M5_ROUTER_PROJECT_SELECT_FUSE=1 0.723 / 0.723 0.122 / 0.122
All 13 DS4_METAL_DISABLE_M5_* set 0.723 0.122
Bisect details
  1. All 13 M5 paths disabled except one, for each of the 13: every run gives 0.723 / 0.122, bit-identical. No single path breaks on its own.
  2. Default with exactly one M5 path disabled: only PARALLEL_FULL_FFN and ROUTER_PROJECT_SELECT_FUSE bring drift down to 0.723 / 0.122. The other 11 stay in the 8-24 max_abs range.
  3. Other toggles that did not help (single run each, max_abs): DS4_METAL_DISABLE_METAL4=1 13.2, DS4_METAL_MATH_SAFE=1 16.7, DS4_METAL_KV_RAW_F32=1 18.3, DS4_METAL_HC_STABLE=0 13.3.
  4. --metal-graph-prompt-test agrees with CPU on the prompt (same top token, top logit 39.06 vs 39.03), so prefill looks fine.

Workaround: export DS4_METAL_DISABLE_M5_ROUTER_PROJECT_SELECT_FUSE=1 (64.4 -> 63.9 t/s generation).

Environment

  • Apple M5 Ultra, 96 GB, macOS 27.2 (26B123), iogpu.wired_limit_mb=90112
  • ds4 0.0.20261102.1026 (Homebrew, temikus/tap/ds4)
  • DeepSeek-V4-Flash-IQ2XXS-w2Q2K-AProjQ8-SExpQ8-OutQ8-chat-v2-imatrix-0731.gguf, SHA-256 matches HF (ca22ae2f...)
  • Default drift-patch flags: hc_stable=on norm_unify=on kv_raw_f32=off rope_exp2_log2=off math_safe=off tensor_matmul=on
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.