[GH-ISSUE #410] Greedy output varies between server requests, but not between fresh engine runs (STRATA_IQ_MT_MIN=1, 0.1.32) #192

Closed
opened 2026-11-04 01:40:47 +07:00 by bsakaguchi · 4 comments
Owner

Originally created by @brenoperucchi on GitHub (Oct 1, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/410

Follow-up to #152. With STRATA_IQ_MT_MIN=1, temperature 0 still gives different answers to identical requests on
this machine. The engine itself looks deterministic: the variation comes from state the server carries from one
request to the next, and the adaptive expert tier explains at least part of it.

Machine: RTX 5090 32 GB, Ryzen 9 5950X (Zen 3, AVX2 only), 96 GB DDR4-3200, Windows 11 26200.
Engine: 0.1.32 from the release zip, with the v0.1.32 checkout's serve/server.py.
Model and config: Flash-Next IQ2_XS with --expert-cache auto --spec 4 --mtp <rt> --max-context 32768 --kv int8 --pcie-frac 0.55 --spec-min-p 0.70 and STRATA_IQ_MT_MIN=1.
Requests: /v1/chat/completions, temperature 0, seed 42, cache_prompt false, max_tokens 256, one after
another on one server. We compare the SHA-256 of the returned content.

Results

Setup Prompt Distinct outputs
Engine CLI, a new process each run, --tokens (41 fixed ids) --max-new 64 short 1 of 5; the STRATA_DUMP_FIRST_LOGITS file is identical too
Server, defaults short (27 tokens) 2 of 5
Server, --prompt-cache 0 short 3 of 6
Server, --prompt-cache 0 --adapt-swaps 0 short 1 of 6, with the same draft acceptance every time
same medium (2,671 tokens) 3 of 4
Server, --prompt-cache 0 --adapt-swaps 0 --no-prefill-borrow medium 4 of 4
same long (5,952 tokens) 1 of 4

With the defaults, draft acceptance on the short prompt moved between 36 and 37 of 48-49 across requests even when
the text came out the same.

On 0.1.31 we had already ruled out the GPU/CPU split by itself: with --expert-cache 1 --pcie-frac 0 (decode cache
hit rate 0.1%) outputs still varied, 2 to 3 distinct in 5. The adaptive tier was on in that run.

What we think is going on

The adaptive tier moves experts between RAM and VRAM based on what earlier requests routed. The GPU and the CPU round
the same expert differently (the startup message says so), so the same token can be computed on a different device
from one request to the next. Turning the tier off made the short prompt reproducible.

We cannot explain the medium prompt yet. It still varies with the tier off and with --no-prefill-borrow, while the
longer prompt does not. Something else that persists between requests seems to affect the prompt path at that length.

We are not reporting a quality problem. Greedy repeats are not byte-identical, which gets in the way of A/B tests.
The docs say STRATA_IQ_MT_MIN=1 makes the answer independent of the drafting. It may help to add that the
adaptive tier (and maybe other server state) still changes it, and that --adapt-swaps 0 removes that part. We can
run more tests here if you tell us what to try.

Originally created by @brenoperucchi on GitHub (Oct 1, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/410 Follow-up to #152. With `STRATA_IQ_MT_MIN=1`, temperature 0 still gives different answers to identical requests on this machine. The engine itself looks deterministic: the variation comes from state the server carries from one request to the next, and the adaptive expert tier explains at least part of it. **Machine:** RTX 5090 32 GB, Ryzen 9 5950X (Zen 3, AVX2 only), 96 GB DDR4-3200, Windows 11 26200. **Engine:** 0.1.32 from the release zip, with the `v0.1.32` checkout's `serve/server.py`. **Model and config:** Flash-Next IQ2_XS with `--expert-cache auto --spec 4 --mtp <rt> --max-context 32768 --kv int8 --pcie-frac 0.55 --spec-min-p 0.70` and `STRATA_IQ_MT_MIN=1`. **Requests:** `/v1/chat/completions`, `temperature 0`, `seed 42`, `cache_prompt false`, `max_tokens 256`, one after another on one server. We compare the SHA-256 of the returned content. ## Results | Setup | Prompt | Distinct outputs | |---|---|---| | Engine CLI, a new process each run, `--tokens` (41 fixed ids) `--max-new 64` | short | 1 of 5; the `STRATA_DUMP_FIRST_LOGITS` file is identical too | | Server, defaults | short (27 tokens) | 2 of 5 | | Server, `--prompt-cache 0` | short | 3 of 6 | | Server, `--prompt-cache 0 --adapt-swaps 0` | short | 1 of 6, with the same draft acceptance every time | | same | medium (2,671 tokens) | 3 of 4 | | Server, `--prompt-cache 0 --adapt-swaps 0 --no-prefill-borrow` | medium | 4 of 4 | | same | long (5,952 tokens) | 1 of 4 | With the defaults, draft acceptance on the short prompt moved between 36 and 37 of 48-49 across requests even when the text came out the same. On 0.1.31 we had already ruled out the GPU/CPU split by itself: with `--expert-cache 1 --pcie-frac 0` (decode cache hit rate 0.1%) outputs still varied, 2 to 3 distinct in 5. The adaptive tier was on in that run. ## What we think is going on The adaptive tier moves experts between RAM and VRAM based on what earlier requests routed. The GPU and the CPU round the same expert differently (the startup message says so), so the same token can be computed on a different device from one request to the next. Turning the tier off made the short prompt reproducible. We cannot explain the medium prompt yet. It still varies with the tier off and with `--no-prefill-borrow`, while the longer prompt does not. Something else that persists between requests seems to affect the prompt path at that length. We are not reporting a quality problem. Greedy repeats are not byte-identical, which gets in the way of A/B tests. The docs say `STRATA_IQ_MT_MIN=1` makes the answer independent of the drafting. It may help to add that the adaptive tier (and maybe other server state) still changes it, and that `--adapt-swaps 0` removes that part. We can run more tests here if you tell us what to try.
Author
Owner

@Niko1221 commented on GitHub (Oct 1, 2026):

Thanks, a careful write-up, and your reading of the first part is right.

  1. The adaptive tier (--adapt-swaps) moves experts between RAM and VRAM based on earlier requests, and the GPU and the CPU round the same expert differently, so the same token can come out differently from one request to the next. --adapt-swaps 0 removes that part.
  2. The prompt cache (--prompt-cache) lets a repeated request continue from a saved state and read only the new tail, through the decode path instead of the batched prompt path. Same quality, different rounding. A fresh CLI run always reads the whole prompt in one batch, which is why it's stable.
  3. The medium prompt (2,671 tokens) still varying with both off is not explained yet. Could you run it again with STRATA_TRACE=1 in the config's env and post the engine's lines for two requests that differ? We're after the prompt N = R reused + M read line and the expert cache and prompt-path lines. Also check whether a server restarted before each request gives one output.

We'll add 1 and 2 to the reproducibility notes in DETAILS.md (byte-identical repeats need --prompt-cache 0 --adapt-swaps 0 besides STRATA_IQ_MT_MIN=1). Keeping this open for 3.

<!-- gh-comment-id:5938533531 --> @Niko1221 commented on GitHub (Oct 1, 2026): Thanks, a careful write-up, and your reading of the first part is right. 1. **The adaptive tier (`--adapt-swaps`)** moves experts between RAM and VRAM based on earlier requests, and the GPU and the CPU round the same expert differently, so the same token can come out differently from one request to the next. `--adapt-swaps 0` removes that part. 2. **The prompt cache (`--prompt-cache`)** lets a repeated request continue from a saved state and read only the new tail, through the decode path instead of the batched prompt path. Same quality, different rounding. A fresh CLI run always reads the whole prompt in one batch, which is why it's stable. 3. **The medium prompt (2,671 tokens)** still varying with both off is not explained yet. Could you run it again with `STRATA_TRACE=1` in the config's `env` and post the engine's lines for two requests that differ? We're after the `prompt N = R reused + M read` line and the expert cache and prompt-path lines. Also check whether a server restarted before each request gives one output. We'll add 1 and 2 to the reproducibility notes in DETAILS.md (byte-identical repeats need `--prompt-cache 0 --adapt-swaps 0` besides `STRATA_IQ_MT_MIN=1`). Keeping this open for 3.
Author
Owner

@brenoperucchi commented on GitHub (Oct 1, 2026):

Ran it again on 0.1.33 (release binary) with STRATA_TRACE=1, --prompt-cache 0 --adapt-swaps 0 and
STRATA_IQ_MT_MIN=1, same IQ2_XS config as above. The 2,671-token prompt from the first report is private, so I used
public prompts built from this repo at v0.1.32: the first 9,000 bytes of src/core/expert_source.cpp with a review
instruction (2,644 tokens) and the first 50,000 bytes with a summary instruction (14,649 tokens). Identical requests,
temperature 0, seed 42, 256 output tokens. The hash covers reasoning_content and content, since with these
prompts the model spends the 256 tokens thinking.

Setup Prompt Distinct outputs
one server, requests back to back 2,644 tokens 1 of 4
same server, right after 14,649 tokens 2 of 2
server restarted before each request 14,649 tokens 1 of 3, same draft acceptance (137 of 171) every time
one server, --no-prefill-borrow added 14,649 tokens 3 of 4

So the remaining variation is not tied to one prompt length here: our medium prompt was stable this time and the long
one was not. A restart before each request gives one output, so some state still carries over between requests with
both options off. --no-prefill-borrow does not remove it.

The two long requests that differed, from the same server. The prompt side is identical, and the first difference
in the trace is 62 tokens into the reply, where the window at position 14710 held 2 tokens in one request and 4 in the
other:

strata trace: request 14649 0
strata trace: prompt start 14648 -1
strata trace: lent 3324 slots for 8192 tokens in 0.4 ms
strata trace: prompt chunk 0 of 14648
strata trace: prompt chunk 8192 of 14648
strata trace: read 14648 tokens (batched) in 2936.8 ms
strata trace: refill start 3324 -1
strata trace: refilled 3324 slots on 1 stage(s) in 174.9 ms
strata trace: prompt done (slots refilled) -1 -1
strata serve: prompt 14649 tokens = 0 reused + 14649 read in 3113 ms (4705.7 tok/s), 256 generated in 1640 ms (156.1 tok/s), drafts accepted 118 of 144, 0 checkpoints
strata serve: decode expert cache hit rate: 97.9% (133133 hits / 136051 lookups)
strata trace: request 14649 0
strata trace: prompt start 14648 -1
strata trace: lent 3324 slots for 8192 tokens in 0.4 ms
strata trace: prompt chunk 0 of 14648
strata trace: prompt chunk 8192 of 14648
strata trace: read 14648 tokens (batched) in 2932.5 ms
strata trace: refill start 3324 -1
strata trace: refilled 3324 slots on 1 stage(s) in 174.6 ms
strata trace: prompt done (slots refilled) -1 -1
strata serve: prompt 14649 tokens = 0 reused + 14649 read in 3108 ms (4712.8 tok/s), 256 generated in 1435 ms (178.4 tok/s), drafts accepted 148 of 172, 0 checkpoints
strata serve: decode expert cache hit rate: 96.9% (130027 hits / 134207 lookups)

The full engine logs for these runs (including every window line) are ready to attach if useful.

<!-- gh-comment-id:5941713201 --> @brenoperucchi commented on GitHub (Oct 1, 2026): Ran it again on 0.1.33 (release binary) with `STRATA_TRACE=1`, `--prompt-cache 0 --adapt-swaps 0` and `STRATA_IQ_MT_MIN=1`, same IQ2_XS config as above. The 2,671-token prompt from the first report is private, so I used public prompts built from this repo at `v0.1.32`: the first 9,000 bytes of `src/core/expert_source.cpp` with a review instruction (2,644 tokens) and the first 50,000 bytes with a summary instruction (14,649 tokens). Identical requests, temperature 0, seed 42, 256 output tokens. The hash covers `reasoning_content` and `content`, since with these prompts the model spends the 256 tokens thinking. | Setup | Prompt | Distinct outputs | |---|---|---| | one server, requests back to back | 2,644 tokens | 1 of 4 | | same server, right after | 14,649 tokens | 2 of 2 | | server restarted before each request | 14,649 tokens | 1 of 3, same draft acceptance (137 of 171) every time | | one server, `--no-prefill-borrow` added | 14,649 tokens | 3 of 4 | So the remaining variation is not tied to one prompt length here: our medium prompt was stable this time and the long one was not. A restart before each request gives one output, so some state still carries over between requests with both options off. `--no-prefill-borrow` does not remove it. The two long requests that differed, from the same server. The prompt side is identical, and the first difference in the trace is 62 tokens into the reply, where the window at position 14710 held 2 tokens in one request and 4 in the other: ``` strata trace: request 14649 0 strata trace: prompt start 14648 -1 strata trace: lent 3324 slots for 8192 tokens in 0.4 ms strata trace: prompt chunk 0 of 14648 strata trace: prompt chunk 8192 of 14648 strata trace: read 14648 tokens (batched) in 2936.8 ms strata trace: refill start 3324 -1 strata trace: refilled 3324 slots on 1 stage(s) in 174.9 ms strata trace: prompt done (slots refilled) -1 -1 strata serve: prompt 14649 tokens = 0 reused + 14649 read in 3113 ms (4705.7 tok/s), 256 generated in 1640 ms (156.1 tok/s), drafts accepted 118 of 144, 0 checkpoints strata serve: decode expert cache hit rate: 97.9% (133133 hits / 136051 lookups) ``` ``` strata trace: request 14649 0 strata trace: prompt start 14648 -1 strata trace: lent 3324 slots for 8192 tokens in 0.4 ms strata trace: prompt chunk 0 of 14648 strata trace: prompt chunk 8192 of 14648 strata trace: read 14648 tokens (batched) in 2932.5 ms strata trace: refill start 3324 -1 strata trace: refilled 3324 slots on 1 stage(s) in 174.6 ms strata trace: prompt done (slots refilled) -1 -1 strata serve: prompt 14649 tokens = 0 reused + 14649 read in 3108 ms (4712.8 tok/s), 256 generated in 1435 ms (178.4 tok/s), drafts accepted 148 of 172, 0 checkpoints strata serve: decode expert cache hit rate: 96.9% (130027 hits / 134207 lookups) ``` The full engine logs for these runs (including every `window` line) are ready to attach if useful.
Author
Owner

@Niko1221 commented on GitHub (Oct 2, 2026):

We reproduced it here and found the remaining part: the PCIe share of the missed experts (--pcie-frac, which streams part of them to the GPU instead of computing them on the CPU). IQ3_XXS, a 3.6K-token prompt, 4 identical greedy requests on one server:

Settings Distinct answers
defaults + STRATA_IQ_MT_MIN=1 2 of 4
+ --prompt-cache 0 --adapt-swaps 0 --no-prefill-borrow (yours) 2 of 4 (the first differs)
+ --pcie-frac 0 1 of 4
yours + no prompt streaming 2 of 4

So with your settings, the PCIe share still made the first answer after a start differ from the next ones. It's a GPU-vs-CPU rounding difference like the others, not a quality issue. 0.1.34's DETAILS.md (reproducible greedy output) now says: for byte-identical repeats through the server use --prompt-cache 0 --adapt-swaps 0 --pcie-frac 0 with STRATA_IQ_MT_MIN=1. --pcie-frac 0 costs decode speed, so keep it for A/B runs. Closing; reopen if those settings still vary on your PC.

<!-- gh-comment-id:5943823263 --> @Niko1221 commented on GitHub (Oct 2, 2026): We reproduced it here and found the remaining part: the PCIe share of the missed experts (`--pcie-frac`, which streams part of them to the GPU instead of computing them on the CPU). IQ3_XXS, a 3.6K-token prompt, 4 identical greedy requests on one server: | Settings | Distinct answers | | --- | --- | | defaults + `STRATA_IQ_MT_MIN=1` | 2 of 4 | | + `--prompt-cache 0 --adapt-swaps 0 --no-prefill-borrow` (yours) | 2 of 4 (the first differs) | | + `--pcie-frac 0` | **1 of 4** | | yours + no prompt streaming | 2 of 4 | So with your settings, the PCIe share still made the first answer after a start differ from the next ones. It's a GPU-vs-CPU rounding difference like the others, not a quality issue. [0.1.34](https://github.com/Niko1221/Strata/releases/tag/v0.1.34)'s DETAILS.md (reproducible greedy output) now says: for byte-identical repeats through the server use `--prompt-cache 0 --adapt-swaps 0 --pcie-frac 0` with `STRATA_IQ_MT_MIN=1`. `--pcie-frac 0` costs decode speed, so keep it for A/B runs. Closing; reopen if those settings still vary on your PC.
Author
Owner

@brenoperucchi commented on GitHub (Oct 2, 2026):

Confirmed here on 0.1.34 (release binary), IQ2_XS, with --prompt-cache 0 --adapt-swaps 0 --pcie-frac 0 and STRATA_IQ_MT_MIN=1: 4 identical answers out of 4 on each of the three public prompts (63, 2,644 and 14,649 tokens), the first request after a start included. Draft acceptance still moved a little between requests (136-137 of 166-172 on the long one), with the same text every time. Thanks for tracking it down.

<!-- gh-comment-id:5944658613 --> @brenoperucchi commented on GitHub (Oct 2, 2026): Confirmed here on 0.1.34 (release binary), IQ2_XS, with `--prompt-cache 0 --adapt-swaps 0 --pcie-frac 0` and `STRATA_IQ_MT_MIN=1`: 4 identical answers out of 4 on each of the three public prompts (63, 2,644 and 14,649 tokens), the first request after a start included. Draft acceptance still moved a little between requests (136-137 of 166-172 on the long one), with the same text every time. Thanks for tracking it down.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#192
No description provided.