mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #463] [CLOSED] decode: wait for an adaptive expert swap before reading the residency table #2652
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#2652
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?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/463
Author: @constantindjonkam
Created: 10/2/2026
Status: ❌ Closed
Base:
main← Head:pr/2-determinism-fixes📝 Commits (1)
4d07a0adecode: wait for an adaptive expert swap before reading the residency table📊 Changes
1 file changed (+60 additions, -4 deletions)
View changed files
📝
src/program/generate.cpp(+60 -4)📄 Description
What
Make greedy decode reproducible across requests, when an adaptive expert swap is in flight.
Opt-in, default off.
The race
apply_pending(false)polls the swap's CUDA event with a non-blockingcudaEventQuery, so whetherthe experts an adapt round had just copied in were resident for the next window depended on whether
their PCIe copies had landed.
A resident expert runs the GPU kernel; a streamed one is computed on the CPU. On a machine without
AVX-512 those two kernels round differently enough to move a top logit by 0.266 - from there the
trajectory is a different one, permanently.
Thank you for the independent measurement on 0.1.37 / RTX 5090 / NVFP4, which reproduces the race on a
different base, quant and tier. Same signature as here:
Why it is opt-in
Your numbers are the reason. The wait is bounded by the swap volume, so it is not free on a busy tier:
192 swaps every 2 rounds cost ~5% a round (18.38 -> 19.32 ms). The same change here, on a lighter
tier (96 swaps every 4 rounds, 23-77 per round), was under 0.3% (78.27/78.19 -> 78.30/78.06 tok/s).
So it is a real trade, and the right answer is not one size for all:
STRATA_ADAPT_WAIT=1asks forreproducibility, and an install's default speed is unchanged.
Worth keeping in view: the wait is not only a cost. It also makes the swaps count sooner - your hit
rate 0.898 -> 0.906 and misses/layer 3.11 -> 2.92, with the CPU pool at 6.5-8.0 ms against 7.3-8.1.
On a tier that busy the 5% buys fewer CPU experts.
This matches the flag you already carry in your fork, so the two do not have to be reconciled.
Scope
apply_pending(adapt_wait)in both decode loops. Nothing else changes: no new counters, no change tothe default path, and the residency table is untouched.
The
STRATA_TRACE_ADAPTlines that show the race are env-gated and off by default; they ride alonghere so the PR is self-verifying.
Reproducing
The per-window probe in #462 localises it further if
you want the window index rather than just the divergence.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.