mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #2619] gdn state left by a fresh prefill is not bit-reproducible across runs at long prompts (2K and 40K are bit-stable, 120K is not) #1042
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#1042
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @kietq8684-design on GitHub (Oct 15, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/2619
Summary
Two independent runs of
tools/conversation_cache_soak.pyon the same box with the same config produced differentgdnstate fingerprints for the fresh-prefill (baseline) arm at a 120K prompt, while the park/restore(candidate) arm was bit-identical across both runs. Generation output was identical in both runs, so we saw no
semantic impact — but bit-reproducibility of the prefill path is lost. This looks like an engine-side determinism
question, not a conversation-cache defect: the cache is the stable side here.
Environment
0x66af) + Radeon Pro VII / Instinct MI50 16 GB (0x66a1), both gfx906, layer splitmixa3607/rocm-gfx906:7.14-complete; kernel 6.8.0-146-p2p; Ubuntu 24.04;HSA_OVERRIDE_GFX_VERSION=9.0.661b3fb5), gfx906 opt-in build (-DSTRATA_HIP_GFX906=ON), working tree clean--nativepack), local NVMe--serve --kv int8 --kv-resident 32768 --max-context 131072 --layer-split 27 --prefill 4096 --pipeline-windows 2 --ple-row-cache 8388608 --pcie-frac 0 --spec 2STRATA_STATE_HASH=1 STRATA_SPLIT_MTP_BATCH=1 STRATA_STAGE_TRIM=1 STRATA_ARENA_MMAP=1 STRATA_GFX906_ATTN_QUERY_SWIZZLE=1 STRATA_GFX906_ATTN_REDUCE12=1(all verified present in
/proc/<engine-pid>/environinside the container)evictions=0throughoutReproduction
tools/conversation_cache_soak.pyunmodified. Two runs, same config, same box, back to back:Each run does an A/B/A: first the baseline arm with
--conversation-cache-mib 0(fresh prefill, no cache), then thecandidate arm with
--conversation-cache-mib 8192. Compare thestrata serve: STATE_HASH ...lines that thebaseline arm emits, run 1 vs run 2.
Observed —
gdnfingerprint per prompt length, both arms, both runsL(prompt tokens)11588c1477c2b34211588c1477c2b34211588c1477c2b34211588c1477c2b3427073c4a1518343157073c4a1518343157073c4a1518343157073c4a151834315ba8166e26a13cb48ba8166e26a13cb48ba8166e26a13cb48ba8166e26a13cb4852f2e6a00b00ffda52f2e6a00b00ffda52f2e6a00b00ffda52f2e6a00b00ffda610f3b1ff5dde7ba1dd3577d2a1918d51dd3577d2a1918d51dd3577d2a1918d5a54d74e32544a13b2261bd02e18451362261bd02e18451362261bd02e1845136Every other fingerprinted component (
L,kv,ple,tail,dead,pooled,ple_prev) is identical acrossruns at every length, including 120K.
kvin particular — the real attention K/V over[0, L), including thestreamed host copy — is byte-identical across both arms and both runs at all lengths.
Also: within a single run the candidate arm emits the 120K
gdn10 times and always the same value; only thebaseline (fresh prefill) differs between runs. So the non-determinism is on the prefill side, not the restore side.
Output was identical, so this is a reproducibility issue, not (observed) a correctness one
Both runs returned the same known answers and the same continuation tokens at every length. We are not claiming
wrong output. We are claiming that "prefill the same prompt twice on the same box, same config → same
gdn" doesnot hold at 120K, which is what a bit-exactness / determinism expectation would require, and which the soak's
stategate implicitly assumes.What we ruled out, and what we did NOT establish
prefill) side is the one that moves. At 2K/40K both sides are stable.
atomicAddin the GDN kernels: none.grep -c atomicAddis 0 in every GDN source file:src/kernels/cuda/native_gdn.cu,src/kernels/cuda/fused_gdn.cu,src/kernels/cuda/native_gdn_preprocess.cu,src/kernels/cuda/gdn.cu,src/kernels/gdn_parity.cpp, and allgdnheaders. The onlyatomicAddhits in anyfile with "gdn" in its name are 6 counter atomics inside
src/prefill/gdn_rec_parity.cu, which is a parity testharness (
landed/late/apart/sitting/out), not the state update.grep -i "non-determin"oversrc/: 0 hits.prompt > --kv-resident. The 40K prompt (39,985 tokens) isalso larger than
--kv-resident 32768, so streaming KV is active there too, and it is bit-stable. Whateverdistinguishes 120K from 40K is not pinned down by this data — that is an open question for you, not a conclusion
from us.
Confirmed code facts, for whoever picks this up
What the buffer is —
src/program/generate.cpp:3484:i.e. per GDN layer: the recursive matrix plus the conv rolling window, ×4 B, ×
gdn_alloclayers(21 here, the layer-split 27 carve).
The same buffer is already treated as containing non-semantic bytes by your own test —
src/core/conversation_snapshot_test.cpp:202:a canary fill, which is the reason we did not immediately call the mismatch a cache bug.
The per-layer debug hash already exists on both paths:
src/program/generate.cpp:11789(serve) andsrc/prefill/prefill.cpp:4096("the GDN states as the prompt path leaves them"), gated onSTRATA_STATE_HASH_GDN.Suggested next step
Run the same prompt twice through the prefill path above the resident window with
STRATA_STATE_HASH_GDN=1anddiff the per-layer hashes; if it reproduces, the
gdncomparison inconversation_cache_soak.py/conversation_cache_parity.pyshould compare cross-run stability of the restore side rather than equality to asingle baseline sample, in the streamed region. We can run this on our box if you want a second data point, but we
did not want to file a mechanism claim we cannot support.
@qiuzan2001 commented on GitHub (Oct 15, 2026):
A data point from a single NVIDIA card, where the fresh prefill is bit-reproducible at 120K, plus one way to narrow yours down.
Setup. RTX 5070 Ti 16 GB, CUDA 13.1, Linux, Swift 1.5 IQ3_S, engine from main
296b59d2(0.1.44.1) on the default path,--prefill auto(8192-token chunks),--kv int8 --kv-resident 32768,--spec 4with the MTP drafter, no layer split,STRATA_STATE_HASH=1 STRATA_STATE_HASH_GDN=1. Two engine starts, each the same sequence of greedy 1-token requests: 1,881 tokens, 38,804, 117,887 (continued from the 32,768 checkpoint), 1,881 again, 117,887 read from token 0.Across the two starts: every
STATE_HASHfield (gdn,ple,tail,pooled,kv,mtp) was identical at all five positions, the per-layerSTATE_HASH_GDNlines too. So on this backend the prompt path at 120K is deterministic from one start to the next; the two things your box has that this one cannot test are the gfx906 HIP kernels and--layer-split 27 --pipeline-windows 2.One mechanism with the same shape as your table (prompt path equal, state after the request not): with
STRATA_ROUTE_TAIL_SKIPon (the CUDA default) the 117,887-token prompt read from 0 and the same prompt continued from the 32,768 checkpoint left differentgdn/kv/pooled/tailafter the first token, while the prompt path's own per-layer line (strata prefill: GDN_HASH ...) was identical for both, andSTATE_HASH_GDNmatched for the first two GDN layers and differed from the third on. The two reads had different expert-cache contents (decode hit rate 78.9% vs 64.2%), and the skip's decision follows the cache. WithSTRATA_ROUTE_TAIL_SKIP=0the two reads were bit-identical in every field butmtp. Your gfx906 build has no skip default, so this is not your cause as such, but anything in the first-token window that depends on which experts happen to be in VRAM would look the same.A cheap check on your existing logs: at the 120K request, compare run 1 and run 2 on (a) the
strata prefill: GDN_HASHline (setSTRATA_STATE_HASH_GDN=1; it is printed when the prompt path hands over) and (b) thedecode expert cache hit rateline. If (a) matches and onlySTATE_HASHdiffers, the difference is in the window that produces the first token, not in the prefill; if (a) differs, the index of the first differing layer says which stage of the split it is on.@kietq8684-design commented on GitHub (Oct 18, 2026):
Thanks for the data point and the mechanism — I ran your check on the two runs behind this issue (soak1/soak2, fresh prefill, identical engine cmdline; the only env difference is soak2 added
STRATA_STATE_HASH_GDN=1).gdnstill differed.GDN_HASH: not runnable as stated — soak1 ran withoutSTRATA_STATE_HASH_GDN=1, so it has nostrata prefill: GDN_HASHlines. Only soak2 has them (31 lines at the 120K prefill, roughly one per chunk). The prefill-vs-first-token-window split can't be made from these two logs.One correction to a premise:
STRATA_ROUTE_TAIL_SKIP=7was ON (default) in both runs on this 0.1.42 gfx906 build, and it fired identically — 19 skipped by the 120K request in each. So the skip is live here, but since it fired identically in both runs, it's not the differentiator either.What the comparison does isolate: at 120K only
gdn(610f3b1f…vs1dd3577d…) andmtpdiffer;ple/tail/pooled/kvare identical.mtpmatches at 2K/40K and differs only at 120K — the same pattern asgdn. Whether they share a cause, the logs don't say.(Separate phenomenon, not to be conflated: each soak's own verify also failed — restored state ≠ baseline — that's the park/restore path, not the across-runs comparison.)
To get the (a) split, I'd need to rerun both with the flag on — that's the next step on my side.
@Niko1221 commented on GitHub (Oct 19, 2026):
Thanks for taking the time to report this.
We're resetting the tracker for 0.2.0-beta. There are more than 1,300 open issues and pull requests, too many for us to read properly, so we're closing everything that isn't being worked on right now. Closed here does not mean rejected.
To reopen it takes about two minutes:
/reopen. A check runs and either reopens the issue or lists what is still missing.The rules are in CONTRIBUTING.md.