mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #1928] Greedy output depends on wall-clock timing: the draft policy picks the verify window from measured round times, and the CPU expert rounding depends on the window #765
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#765
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 @gputier on GitHub (Oct 11, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/1928
Summary
On a native IQ pack (IQ3_S, RTX 5090, v0.1.42 fork), the same prompt at
--greedyproduces different token streams from one fresh engine to the next. Two documented rules combine to cause this, and the documentation never mentions the combination:DraftPolicy::choosedecides, round by round, whether to verify a suffix (prompt lookup) window instead of the MTP window. It works from the EMA of measured round times (src/spec/draft_policy.cpp:60-89, cost EMA at:91-97,kCostAlphaat:13). It is called fromsrc/program/generate.cpp:12694in generate, and from:11122and:11540in serve. It is also observed at:12829and:11695. The suffix drafter is on by default (suffix_draft = 3,generate.cpp:652).src/kernels/cpu/native_expert.cpp:115-131, used at:158and:171; down rows at:204-213; issue #152,docs/DETAILS.md:97). How many tokens in a window share an expert depends on the window, so the logits depend on the window shape.Wall-clock noise (another process, clocks, a sampler) changes which windows get taken. That changes the rounding, which flips near-ties in the argmax. The header of
draft_policy.hppand two comments say the policy "only chooses which drafts to verify: the output is unchanged" (include/strata/spec/draft_policy.hpp:15,draft_policy.cpp:83,generate.cpp:657). That holds only withSTRATA_IQ_MT_MIN=1.Repro
Host: Windows, RTX 5090, native IQ3_S pack, production flags (
--spec 4 --spec-min-p 0.5 --mtp <dir> --prefill auto:32768 --expert-cache auto --kv int8 ...,STRATA_PREFILL_CPU_SHARE=0). Prompt: 2,520 tokens, run with--max-new 256 --greedy --tokens-file p2.ids. One fresh engine per run.Default flags, 16 runs twice (32 runs): 12/16 and 15/16 identical. The minority runs differ from token 114. Each distinct output maps one to one to a distinct pattern in the engine's own
window sizesandsuffix draftsstats lines (for exampleT5:1 T6:1, 7 windows, accepted 20 of 23againstT5:0 T6:0, 3 windows, accepted 5 of 8).--suffix-draft 0(twice)STRATA_IQ_MT_MIN=1--suffix-draft 0(16 of 16)--adapt-swaps 0--pcie-frac 0.55(the probed value)--pool-workers 8STRATA_ROUTE_TAIL_SKIP=0generate.cpp:8068-8080is serve-only)The decisive pair is
STRATA_IQ_MT_MIN=1with and without--suffix-draft 0: the outputs are byte-identical even though the window patterns differ.Serve mode (the reported case) and 0.1.42's PcieAuto
In serve mode,
STRATA_IQ_MT_MIN=1, the documented reproducibility switch, is no longer enough in 0.1.42.PcieAuto(generate.cpp:1615-1665, applied at:11670-11681) refinespcie_fracfrom the measured CPU pool time during the first decode windows (up to three updates). That changes which missed experts the GPU computes and which the CPU computes. The engine itself says the GPU rounds differently from the CPU (generate.cpp:5019). The trajectory differs between fresh servers (for example 0.55 to 0.45 in one step on two servers, and 0.55 to 0.50 to 0.45 on three), and the outputs split exactly along it.Fresh servers, temperature 0, 256 tokens, p1/p2/p3 (distinct answers per prompt out of 5 servers, with the GPU and RAM sampler running):
--pcie-frac 0.55STRATA_IQ_MT_MIN=1--suffix-draft 0--pcie-frac 0.55+STRATA_IQ_MT_MIN=1--pcie-frac 0.55+--suffix-draft 0--pcie-frac Nfixes the share (no refinement).STRATA_PCIE_FRAC_DEFAULT=oldis the documented restore of the 0.1.41 rule (not tried here).docs/DETAILS.md:1196should name them next to--adapt-every 100000, which is not enough:--adapt-swaps 0still produced 3 variants in 16 runs and changed the answer itself.Proposal (any one)
STRATA_IQ_MT_MIN=1(or--suffix-draft 0) indocs/DETAILS.md, next to the serve section that currently points only at--adapt-every 100000(docs/DETAILS.md:1196), and fix the three "output unchanged" comments.Notes
STRATA_IQ_MT_MIN=1upstream: 1 to 3 % decode on IQ3_S with AVX-512 (native_expert.cpp:118-120). Not measured here.generate.cpp:1622-1665, applied at:11670) and the tail skip (expert_source.cpp:3592-3631, which depends on the whole window). Both depend on timing or on the window.@gputier commented on GitHub (Oct 17, 2026):
Still present on v0.1.45 (read at the tag; not re-measured on a GPU).
src/spec/draft_policy.cppandinclude/strata/spec/draft_policy.hpphave no change between v0.1.42 and v0.1.45.DraftPolicy::choose(draft_policy.cpp:60) still compares windows bycost_ms, the EMA of measured round times (kCostAlphaat:13, update at:94and:145). Calls atsrc/program/generate.cpp:13789,:14214,:15575; observed at:14077,:14432,:15710-15711. The suffix drafter is still on by default (suffix_draft = 3,generate.cpp:760).native_gu_mt_minstill defaults to 2 (src/kernels/cpu/native_expert.cpp:131), and so does the down rows' rule (:255, used at:264). The commits on this file since v0.1.42 (e51b4379,f235e394,b766cde6for NVFP4;8ee2005d,77ddc2ff,b558df67for the opt-inSTRATA_CPU_IQ_ALL_EXACT1) do not change it: the exact singleton rows reproduce ggml's own one-token dot (:168-182), so a lone token still rounds differently from the same token in a group.draft_policy.hpp:15,draft_policy.cpp:83, andgenerate.cpp:765(was:657).PcieAutois still on by default for single-GPU serve without--pcie-frac(generate.cpp:2115-2122,pcie_frac_autoset at:3331/:3341, applied from:9425).STRATA_PCIE_FRAC_DEFAULT=oldis read at:1933and:3310.Docs, to be precise about what is already there:
docs/DETAILS.md:99-114(since43685766, before v0.1.42) already namesSTRATA_IQ_MT_MIN=1and, for byte-identical server repeats,--prompt-cache 0 --adapt-swaps 0 --pcie-frac 0. What is still missing: that the verify window itself is chosen from measured round times (soSTRATA_IQ_MT_MIN=1alone is not enough in serve whilePcieAutorefines the share), and any mention of--suffix-draftinDETAILS.md(no match). The sampling paragraph (DETAILS.md:1370) still points only at--adapt-every 100000.@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.