mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #3327] [Engine] the same build is not run-to-run identical at temperature 0 on long answers (RTX 4090) - how should an end-to-end bit-identity check be done? #1348
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#1348
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 @Dmitry-B on GitHub (Oct 20, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/3327
Observation, not a bug claim: on this machine the generated text of the same binary and the same
configuration differs between starts, so an end-to-end comparison of two builds by their answers cannot
demonstrate (or refute) "bit-identical". Release notes and community reports use that phrase as a gate for
new switches, and we cannot measure it on a live server here. We would like to know what the intended
end-to-end check is, since the repository's parity harnesses are kernel-level.
Problem
One build, one config, fixed prompts,
temperature: 0,chat_template_kwargs.enable_thinking: false, thelearned expert profile pinned to an identical copy for every start: 2 of 6 prompts come back identical
when the server is started twice.
Environment
Strata
e88ee39d(0.2.0-beta, engine 0.1.45.3,engine/BUILD.jsonsrc hash25c992dfc5c6cb06), builtfrom source on the machine (CUDA arch
[89]). Ubuntu 26.04.1, kernel 7.0.0-38, NVIDIA 615.71.09,CUDA 13.4, RTX 4090 24 GB, Ryzen 9 7950X, 46 GiB RAM. Model: Flash-Next IQ3_XXS, 204,800-token context,
INT8 KV, packed experts,
--expert-cache auto --prefill auto --spec 4 --mtp --pool-workers 10,--pcie-frac 0.00.Reproduce
What the script does (it starts its own server per arm, like
tools/ab_engine.py, port 8090, theproduction service stopped): builds the config from the working one, removes
--expert-profile-saveand--expert-profile-save-every, and copies--expert-profileto a fresh identical copy for every start, sono arm inherits routing state from a previous one. Then one warm-up request and the same six requests per
arm, in the same order: the three short prompts of
tools/ab_engine.py, one arithmetic question, oneshort code task, and
ab_engine.long_prompt(1500). SHA-256 of the returned text is compared. (Script ismine, not from the repository; the prompts are the repository's own fixtures.)
Actual (first two rounds of the control arm, one build)
The differences are not truncations: they start inside the first sentence or two and then the texts
diverge ("…consisting of coils both inside and outside the appliance…" vs "…consisting of an evaporator
coil inside the fridge and…"). With two switch arms measured against the same baseline the counts land in
the same range as the control (5 of 12 and 6 of 12 comparisons matching, control 4 of 12), so on this
machine nothing can be said about whether a switch changes the output.
Short, strongly constrained answers (one number, a short deterministic function) do reproduce; anything
longer than a couple of sentences does not.
What is ruled out
Not the saved expert profile: with
--expert-profile-save/--expert-profile-save-everyremoved and theloaded profile replaced by a fresh byte-identical copy for every start, the divergence stays. (With the
working configuration, where the profile is rewritten during the run, 4 of 7 prompts differed - so the
profile makes it worse, it is not the cause.) Not the prompt text and not the sampling parameters: they
are fixed, greedy, thinking off.
What was not tested
Which part of the pipeline is non-reproducible. Plausible candidates, named as hypotheses only: the
adaptive expert tier computing the same expert on the host and on the GPU in different runs (different
floating-point paths, near-ties flip), the speculative/MTP verification path, kernels that reduce with
atomics.
Question
The repository demonstrates bit-identity with kernel- and feature-level harnesses
(
src/kernels/cpu/*_parity.cpp,src/kernels/bf16_gemv_parity.cpp,bench/micro/fusions_parity.cu,tools/conversation_cache_parity.py,tools/split_mtp_batch_parity.py) and evidence files such asbench/results/2026-10-12-p40-sm61-kernels/dequant-wide-parity.txt. Is there an intended end-to-endway to show it on a running server - a set of switches that makes serving reproducible (a fixed expert
tier, no adaptive overlap), a reference server configuration used for such claims, or a tool that compares
logits/tokens rather than text? With that, we can attach this kind of evidence to our own reports; without
it, on this hardware an answer-based gate measures the machine, not the change.
Reproduction status
Reproduced locally: the control arm was run twice as separate server starts at the same commit, and the
same divergence appears for two other arms and across rounds of the same arm (six starts in total, three
configurations).
@Niko1221 commented on GitHub (Oct 26, 2026):
Your finding is right: with the IQ packs the CPU rounds one-token and multi-token groups differently, so two starts can end in different but equally good answers. 0.2.6 documents the settings for byte-identical runs in docs/DETAILS.md (Reproducible output): STRATA_IQ_MT_MIN=1 and, in the engine args, --prompt-cache 0 --adapt-swaps 0 --pcie-frac 0. Please repeat your two-start test with those; --adapt-swaps 0 is the one missing from your config. If the six prompts are still not identical, tell us the first prompt that differs and we will look for another source. For our own gates we compare with fixed expert-cache slots (the identity gate uses --expert-cache 1500) so the resident set does not depend on VRAM.
@Dmitry-B commented on GitHub (Oct 26, 2026):
Re-ran the two-start test with the settings from
docs/DETAILS.md("Reproducible output") — they work.We repeated the two-start test with those settings on the same machine and the same build: 23 pairs (46 server starts). Your diagnosis is right, and one part of our original report here was wrong. Below: the numbers, the first prompt that differs, which switch is load-bearing, what the settings cost, the correction, two questions, and the limits of these runs.
1. What was run
One pair = two independent server starts of the same build and the same config (the script starts its own
serve/server.pyon a second local port, 8090, with the production service stopped, the waytools/ab_engine.pydoes), thesame fixed corpus sent to both starts, greedy sampling (
temperature: 0,chat_template_kwargs.enable_thinking: false, as intools/ab_engine.py), 256 new tokens per request, andSHA-256 over the whole returned text. 23 pairs = 46 starts in six sessions, run from 23:08 to 01:10 on
the machine's local clock over the night of 2026-10-26 to 2026-10-27; the session headings below are those
local times, and the log file names carry the same stamps.
Build, unchanged during all sessions (checked after the last one): engine
0.1.51, source build on thismachine,
BUILD.jsonsrc ida88a598cd60d6ee1,engine/stratamd5cdf8aae7d3baa13bb1e274f8006384a8.Strata
v0.2.6, commit4b9e05a2a806a3fe24f7b2560d98626c37dade35. So every comparison below is one buildagainst itself.
Hardware: RTX 4090 24 GB (23,028 MiB,
sm_89), Ryzen 9 7950X, 47,579,476 kB RAM, Ubuntu 26.04.1, driver615.71.09, CUDA 13.4. Model Qwen3.8-Flash-Next IQ3_XXS (
…-GSQ-RCO-IQ3_XXS-00001/00002-of-00002.gguf,native pack,
--kv int8,--resident-experts,--spec 4 --mtp <draft directory: dense.bin md5 a16efaf4…, draft_vocab.bin md5 18b68403…> --spec-min-p 0.50,--prefill auto→ chunk 8192 with a 96-slot ring,--pool-workers 10,--max-context 204800,--vision,draft_vocab: cyrillic,reasoning_effort: low(overridden per request), experimental speed projection on:
--control-vector-scaled <projection gguf>:1.0 --control-vector-layer-range 4 44 --cvec-mode project --cvec-dir per-layer, andSTRATA_PF_FUSED=1.Frozen state for every start: the learned expert profile is not written (
expert_profile_saveandexpert_profile_save_everyare removed from the config, not only the flags — see §6) and--expert-profilepoints to a fresh copy of
data/expert-profile.bin(md5ff1bc6544d3f2f0013e3e376632d33a8) made per start,which the engine confirms (
profile /tmp/ident_…).Three arms, so that each part of your set is isolated. Everything else is identical in all three, including
--pcie-frac 0.00, which our working config already carries — it is shared, not one of the isolatedvariables. What each arm adds on top of that shared configuration:
--expert-cache 1500 --prompt-cache 0 --adapt-swaps 0STRATA_IQ_MT_MIN=1--expert-cache 1500STRATA_IQ_MT_MIN=1--expert-cache 1500The fixed-slot part of the gate is in effect in every start: the engine logs
expert cache 1980 slots, 3.25 GiB of VRAMin all 46 starts, no other value. For contrast, our working config with--expert-cache autopicked between 3,014 and 7,874 slots in the starts recorded in its own log — which is exactly thedependency you wanted removed. The
slots onlyandMT onlyarms really do run with the adaptive tier andthe prompt cache active (
adaptive swaps exchange them with the GPU cache (no file reads)in their enginelogs); in the
your setarm the same line readsadaptive swaps off.2. Result
STRATA_IQ_MT_MIN=1)--expert-cache 1500)Per session, so the counts can be checked against the logs:
3. The first prompt that differs (you asked for this)
Corpus order and what happened in the
slots onlyarm over 12 pairs. Labels 0-2 andlongare thefixtures from
tools/ab_engine.py;arithmetic,codeand the twopp…requests are ours. Prompt tokencounts are the engine's own
usage.prompt_tokens.chat0chat1chat2arithmeticcodelongab_engine.long_prompt(1500)pp1500wlong_prompt(1500)with the answer capped at 24 tokenspp6000wlong_prompt(6000)with the answer capped at 24 tokensIn five of the six flipped pairs the first differing prompt in corpus order is
chat1; in the sixth it iscode. Nothing differs in theyour setorMT onlyarms, in any pair, on any of these prompts.An answer that is just a number never differed: the same SHA-256 in all 52 recorded starts of this prompt —
46 here (all three arms) plus the 6 from our October run in this issue.
4. Prompt path: our first version of the test did not test it at all
Our earlier corpus stopped at a 1623-token prompt, i.e. one chunk (the working chunk is 8192), so the
exact_pphalf of your gate was untouched. Addedpp1500wandpp6000w, same fixture, short answers sothat the prompt path is what is being compared:
long_prompt(1500), 24-token answerlong_prompt(1500), 256-token answerlong_prompt(6000)= 6345 tokens, 24-token answer921d0f63…vs0d84853…)6345 tokens is still one chunk, so this is not a chunk-boundary effect; it is the prompt path at a length we
had not tried. The same prompt with a short answer is stable at 1623 tokens and flips at 6345. With a long
answer the same 1623-token prompt already flips through decode. Two consequences for anyone measuring here:
a flip rate read off a short-prompt corpus is a floor, and "short answers reproduce, longer ones do not" was
too simple — it depends on prompt length and answer length, and both thresholds are below what we now know
flip.
5. Which switch is load-bearing on this machine
--expert-cache 1500alone is necessary and not sufficient: two starts of the same build with the residentset fixed still differ in 6 of 12 pairs. With
STRATA_IQ_MT_MIN=1added, 6 of 6 pairs identical — includingthe arm where the adaptive tier and the prompt cache are running. That matches your diagnosis and the code:
src/kernels/cpu/native_expert.cpp:432readsSTRATA_IQ_MT_MINwith a default of 2, and at 1 the CPU pathtakes the multi-token kernel for a single token too (
native_expert.cpp:280, whose comment says the choice"can depend on how many drafts a verify window held"; the same effect is what docs/DETAILS.md:317
describes as "uses the multi-token kernels for every group, so the answer no longer depends on drafting").
With
--spec 4 --mtpthe verify window is not the same size run to run, and these runs do read the RAM experttier (
expert tiers: GPU 47,996 hits this request; since the start RAM 57,732 blobsin one of them), so thedefault path can compare two different roundings depending on how the drafts landed. That is the mechanism
your answer describes; what our runs establish is the effect, not the exact kernel path — with
--resident- expertsmost expert work is on the GPU, and we have not traced which of the CPU kernels these particularrequests reach.
We are not claiming
--prompt-cache 0and--adapt-swaps 0are unnecessary. Every pair here is a coldstart: nothing is carried between requests, and the state those two flags protect is exactly the state this
test never creates. They are also what stops the engine from writing the profile between runs (§6), so
inside a session they do work we did not measure.
6. A correction to what we wrote in this issue
We wrote that the saved expert profile is ruled out, because we removed
--expert-profile-save/--expert-profile-save-everyand re-copied the loaded profile per start. That was wrong for our configs.The save is configured there by the config keys
expert_profile_save/expert_profile_save_every, andlearned_profile_args()inserve/server.py(#477) both appends--expert-profile-saveto the engine argsand, when the learned profile's shape matches, replaces the load path with the learned file
(
args[i] = save). So our October control started each run from a profile the previous run had written, andpart of what that run measured was carry-over, not engine nondeterminism. (That control's engine log was
overwritten, so the October run cannot be reconstructed character by character; this statement is from the
code and the config structure, and the mechanism was active.)
Your advice does stop the writing — the engine's own start message says saving needs the adaptive tier
("
--expert-profile-saveneeds the adaptive tier (--adapt-everyand--adapt-swapsabove 0) … nothing willbe saved"). But the load path stays redirected to whatever earlier runs wrote. A config that carries
expert_profile_saveruns any gate on its learned profile, not on the--expert-profilefile it names. Ourthree arms run on the static profile, which is the routing state the numbers above describe. One sentence in
the "Reproducible output" paragraph would save the next person this: removing the flag from the arguments
does not take the profile out of the comparison.
7. What your set costs here (decode tok/s)
One client, a fixed expository request (in Russian: "write a coherent ~300-word note on how a heat pump
works and why it is more efficient than an electric heater"), 300 new tokens, thinking off, temperature 0,
three runs per config, two independent probe sessions (the second one also covers the MT-only config, which
the first session did not include). Individual runs and medians, not just the best one; the first run of each
config is always lower (cold caches), which is why the median is used.
--expert-cache auto)STRATA_IQ_MT_MIN=1STRATA_IQ_MT_MINby itself could not be measured: −5.7 % in one session, +5.0 % in the other, with thesame config otherwise. That is inside our own probe's band, so the honest statement is that no cost was
measurable — consistent with the −1…−3 % in DETAILS.md, not with a measured number. What does cost: the
small fixed expert cache (×0.69) and
--prompt-cache 0(×0.76 on top of that, ×0.52 overall).--pcie-frac 0is not in this delta because our working config already carries it.The band itself, which our earlier speed numbers did not state: the median of the same config moved by
+5.6 % (working), −8.2 % (1500 slots), +2.2 % (MT only) and +3.1 % (your set) between the two sessions.
Within one session, individual runs scatter more — up to −19 % on the first run after engine start.
8. Two questions
--expert-cache 1500reportsexpert cache 1980 slots, 3.25 GiB of VRAMin every start. The number isstable, so the gate works, but 1500 is not what an outside reporter sees in a log. Is 1500 counted in
blobs, or rounded up by the engine? If the identity gate names a fixed flag, it would help to name the
log line a reporter should see, so "the gate is in effect" can be told apart from "the engine overrode
me". Related: none of the reproducibility switches (
STRATA_IQ_MT_MIN,--prompt-cache 0,--adapt-swaps 0) is echoed in the engine's start log — only the parity tools print them(
src/kernels/cpu/iq_avx2_parity.cpp:558). Echoing them once at start would make community "bit-identical"claims checkable by anyone.
means the same thing as your gate? Our configs carry three answer-changing things your paragraph does not
name:
STRATA_PF_FUSED=1— for the native packs this is env-only opt-in (src/prefill/moe_fused.cu:690,requested(); without the env,enabled()at 679 and the comment at 678 leave only the dense/Q2_0kernels on) — the experimental speed projection (
--cvec-mode project --cvec-dir per-layer, layers 4-44),and
draft_vocab: cyrillicplus the locally prepared MTP draft. They are identical across all our starts,so they do not affect the cross-start result, but they do mean our "identical" is identical for this
configuration, not a reproduction of your gate.
9. Limits of these runs
while — the state
--prompt-cache 0and--adapt-swaps 0protect. The repository already has tools forthat half (
tools/conversation_cache_parity.py,conversation_cache_isolation.py); we did not run them.exact_pp 4K/20Kat 20K(docs/DETAILS.md:1054); answers capped at 256 / 24 tokens.
--batch, no CPU-only path.strata bench runortools/strata_bench.py: comparable inside this report, not comparable with other reports.itself between starts, not that two builds are bit-identical to each other.
10. What we will do next
Run the same pairs across two engine builds (0.1.48.1 and 0.1.51, the pair from #4212) under your set, which
is the bit-identity half of that benchmark's claims, and correct that PR's "Limits" section, which currently
says the noise band was not measured — it now is (§7). The gate script, the config generator, the probe, the
three configs (with
api_keyand the MCP bearer token removed) and the per-pair logs are ready; if you wantthem in the repository rather than in this thread, say so and they go in as
bench/results/2026-10-26-community-rtx4090-identity-gate/in a results-only PR.