You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
spec: greedy output diverges from non-speculative baseline under batched verification on CUDA (deterministic numerics; draft-simple alone reproduces, DFlash2 amplifies) #27407
With speculative decoding enabled (temp 0, fixed seed, otherwise identical settings), greedy output diverges from the identical non-speculative run. The divergence is deterministic (reruns are byte-identical) and is classified as CUDA numerical divergence under batched speculative verification, not a logic bug: the plain draft-simple path — which exercises batched verification with none of the DFlash2 code — reproduces it on one workload, while the DFlash2 path amplifies it (diverges on both workloads tested, and earlier).
Outputs remain coherent; this is a bit-exactness concern only, and speculative acceptance is unaffected. No fix is claimed here — this is a documentation/confirmation request.
1d69d9619a1bde9249dac21e6fccaf99 (2482 B) — = none
draft-dflash
25dfca084f4cec36bc8f71f5eaa8da24 (1401 B)
24d531f596c8aa41c1119ea01bd824d7 (2459 B)
Reruns are byte-identical (determinism confirmed).
Example near-tie flips (short workload): " storage of information." vs ", recall, forgetting"; ". Too many" vs "syllables. Too". Coding workload: digit flip "1, 2" vs "8, 4" in generated code.
Analysis
Batched verification alone (draft-simple, no DFlash hooks) perturbs CUDA target logits at near-ties: it diverges on the short workload yet is byte-identical on coding → near-tie dependent, not systematic.
draft-dflash diverges on both workloads and earlier: DFlash2's extraction graph (llama_set_embeddings_layer_inp graph-output marking) amplifies the numeric shift but is not the sole cause (proven by the draft-simple divergence).
Deterministic across reruns → consistent with CUDA fp-non-associativity in the batched verification decode (e.g. n_max=7 draft batch in one flash-attn batch vs sequential target decode) and/or graph-extraction side effects.
Is bit-exact greedy output expected to be preserved under batched speculative verification on CUDA? (MTP presumably shows the same class of divergence.)
Is there a supported way to force the sequential target-decode path during verification, for bit-exact comparisons?
Summary
With speculative decoding enabled (
temp 0, fixed seed, otherwise identical settings), greedy output diverges from the identical non-speculative run. The divergence is deterministic (reruns are byte-identical) and is classified as CUDA numerical divergence under batched speculative verification, not a logic bug: the plaindraft-simplepath — which exercises batched verification with none of the DFlash2 code — reproduces it on one workload, while the DFlash2 path amplifies it (diverges on both workloads tested, and earlier).Outputs remain coherent; this is a bit-exactness concern only, and speculative acceptance is unaffected. No fix is claimed here — this is a documentation/confirmation request.
Environment
5ecbe1ac17ec0484c5b44af0bd580cdc9c428ed4(local build, MSVC 19.44, CUDA 12.4, sm_86)empero-ai/Qwen3.8-27B-Ridge-GGUFQwen3.8-27B-Ridge-3.7bpw.gguf(IQ2_M)incoai/Qwen3.8-27B-DFlash2-GGUFQwen3.8-27B-DFlash2-Q4_K_M.gguf(1,143,006,752 bytes; SHA-25618a380efc9b7ed8d88677fc895f5c11ae170653434ee378f7348f715c14d0594)Repro (llama-cli, 6 runs)
Baseline (
--spec-type none):Speculative variants add:
Run the same with
-n 512 -f prompt_coding.txt. Note:--draft-modelis not a valid flag in this build; use-md(cli) /--spec-draft-model(server).Results (token-level, same-vocab
llama-tokenize)Stripped-output MD5 (static banner/prompt-echo removed; generation content only):
db0b78ede21fcb32543217e5cbfd437f(1330 B)1d69d9619a1bde9249dac21e6fccaf99(2482 B)c55e97dec9b537272f72dc578e1f00dc(1346 B)1d69d9619a1bde9249dac21e6fccaf99(2482 B) — = none25dfca084f4cec36bc8f71f5eaa8da24(1401 B)24d531f596c8aa41c1119ea01bd824d7(2459 B)Reruns are byte-identical (determinism confirmed).
Example near-tie flips (short workload):
" storage of information."vs", recall, forgetting";". Too many"vs"syllables. Too". Coding workload: digit flip"1, 2"vs"8, 4"in generated code.Analysis
draft-simple, no DFlash hooks) perturbs CUDA target logits at near-ties: it diverges on the short workload yet is byte-identical on coding → near-tie dependent, not systematic.draft-dflashdiverges on both workloads and earlier: DFlash2's extraction graph (llama_set_embeddings_layer_inpgraph-output marking) amplifies the numeric shift but is not the sole cause (proven by thedraft-simpledivergence).Questions
Cross-links: PR #27342 (DFlash2), companion issue mtmd vision position-gap, z-lab#1 (Metal byte-identical validation).