mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #1922] [Bug]: RouterLookahead overhead with fully resident experts; disabling it improves decode by 19% on RTX 4070 #760
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#760
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 @Takayuki-Ishimaru on GitHub (Oct 11, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/1922
What happened
With all experts in GPU cache or pinned RAM, the file-tier RouterLookahead still runs CPU router prediction although there are no expert file reads. On the same UD-IQ4_XS model and v0.1.41 binary, disabling it improved mean decode throughput from 32.80 to 39.06 tok/s (+19.1%).
STRATA_LOOKAHEAD=0The off arm automatically used paced
cudaHostRegister; the first on arm used bulk allocation. To check that confound, I repeated the on arm withSTRATA_PIN_GUARD=2. Both paced arms fully pinned 54.85 GiB; the comparison still shows +20.2% throughput. The pin guard is only a diagnostic control, not the proposed workaround.In those paced arms, total host-pool time fell from 18.38 to 13.29 ms/output token; CPU expert work was 13.14 to 12.66 ms and GPU-reach time 8.97 to 8.93 ms. This supports predictor overhead/competition as an explanation, but does not isolate mutex, scheduling, or memory-bandwidth costs.
Strata version, GPU, OS
v0.1.41,
fb58e0dbc8399662c0e47c76578c6e878b14f6cf; RTX 4070 12 GB; Intel i5-13500 (AVX2), five pool workers plus the caller. Ubuntu 24.04 LXC, kernel 6.17.13-21-pve, 96 GiB container RAM; CUDA 13, sm_89 build.Model: Unsloth Qwen3.8-Flash-Next UD-IQ4_XS native three-part GGUF, pack created with
iq_pack.py --compat-bf16. GPU cache: 1,690 slots / 3,886 MiB; pinned RAM complement: 54.85 GiB. A local thinking-budget/stop patch is present; these measurements use the raw engine--serveprotocol, bypassing Python HTTP handling. The same binary, weights, pack and MTP are used in all arms.Reproduction
Start a single engine with a native GGUF and enough RAM for the whole complement. Common options:
Actual KV residency was 20,480. Foresight was off; expert file-blob reads stayed at zero. Do not substitute a partial resident budget.
Freeze prompt token IDs; warm with 150 output tokens, then generate 600 tokens for seeds 101–103. Use temperature 0.7, top-p 0.8, top-k 20, ignore EOS and no prompt-cache hits. My short Japanese prompt asks for all 47 prefectures, north to south, with two or three sentences each; numbered markers make each request fresh (60 tokens).
Restart with only
STRATA_LOOKAHEAD=0changed and repeat. Timing instrumentation must match between arms. Check the resident/pin log and expert file-read counter in both.Expected optimization
Consider automatically skipping file-prefetch prediction after residency is established and all relevant experts are accessible from RAM/GPU. Preserve prediction for partial/file-backed residency, Foresight,
STRATA_LOOKAHEAD_STATS, and explicit measurement/override use. The resident flag alone is insufficient because a limited or failed RAM allocation can leave a file tier.In v0.1.41, lookahead is initialized before the resident complement is filled;
FileExpertSource::warms()checks mappings, whilewarm()later skips RAM-resident experts. The corresponding guards remain in current main's generate.cpp, warms(), and warm(). Current main was inspected, not benchmarked.Limits and related work
One machine, three requests per arm, fixed arm order and one engine startup per arm; no interleaved repeated restarts. Outputs and adaptive routing can differ; paced-arm MTP acceptance moved from 69.8% to 71.6%, adding uncertainty. No quality or long-context A/B for this flag, and no byte-identical output guarantee.
Searches for
STRATA_LOOKAHEAD, lookahead, and resident/prefetch found related #1348 (Foresight), #1838 (partial RAM adaptation), and #416 (older Windows mmap benchmarks), but no exact report of this full-resident case. Those configurations differ; this report does not propose disabling prediction globally.@Niko1221 commented on GitHub (Oct 11, 2026):
Thank you for the measurement. We tried it on an RTX 3060 with every expert resident (3,539 GPU slots plus the rest pinned in RAM, no file reads): STRATA_LOOKAHEAD=0 against the default gave no decode difference (story +0.0%, code +0.1%, a long document -0.8%, 5 interleaved pairs) and the same tokens. That box has 20 CPU cores, so if the look-ahead threads compete with the decode threads it would show much less there than on a 6-core i5-13500. Could you post the decode numbers on 0.1.43 with and without it, and the
pool-workers/ CPU lines of the start-up log? If it holds on smaller CPUs, turning the look-ahead off when nothing can be read from disk is a cheap default.@Takayuki-Ishimaru commented on GitHub (Oct 11, 2026):
Thanks for checking this. I updated to 0.1.43 (
7695859a) and repeated the measurements on the same RTX 4070 / UD-IQ4_XS configuration. Disabling lookahead still improves decode throughput here:STRATA_LOOKAHEAD=0, mean tok/sI ran five paired comparisons, alternating ON→OFF and OFF→ON, with a fresh engine for each arm. Each start had a 150-token warmup followed by 600 tokens per workload. Prompt token IDs and seeds matched within each pair. All measured runs reached 600 tokens, with no prompt-cache reuse and zero expert file-blob reads.
Both arms had 1,690 GPU cache slots (3,886 MiB), with the entire 54.85 GiB RAM complement pinned. Both used
STRATA_PIN_GUARD=2andSTRATA_DECODE_TIMING=1; all other settings, including 0.1.43's route-tail-skip default, were identical. The three Japanese pairs with identical output tokens improved by 19.2%, 19.9%, and 20.5%.I also remembered an important constraint: I run Strata in an LXC container on Proxmox in my homelab, with the host's sustained CPU package power limit deliberately set to 35 W to save electricity (120 W short-term). The i5-13500 physically has 6P+8E cores, but this container can use only logical CPUs
0,2,4,6,11,15: five P cores and one E core. Its CPU quota is unlimited.Startup lines:
This seems consistent with your CPU-contention hypothesis, although I have not repeated the test with the power limit removed.
I think an automatic policy would have practical value for other homelab users running Proxmox or similar environments with power caps and restricted CPU allocations. The CPU model and total host core count alone may not reflect the resources actually available to Strata. Adapting to those constraints could help users get better throughput within their existing power budget.
Would you consider:
The measurements are from one machine and short prompts. Some output tokens and MTP acceptance rates differ, so this is not a fully token-identical benchmark; I have not tested long-context performance or quality differences. The local patch only changes Python server thinking-budget/stop handling, and these measurements use the raw engine protocol.
@Niko1221 commented on GitHub (Nov 5, 2026):
Thanks for taking the time to report this.
Strata has changed a lot since this was opened, and 0.2.11 is out now, so many older reports no longer apply. We're closing issues older than a week that have had no new reports in the last week. 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.
@Apertur3 commented on GitHub (Nov 6, 2026):
Re-test on 0.2.11 with a different setup. It supports the small-CPU explanation: the look-ahead costs throughput only when no CPU is left over for it.
Setup: Strata 0.2.11 built from source. 2x RTX 3090, AMD EPYC 7443 with 44 logical CPUs visible, Linux. Model Qwen3.8-Flash-Next IQ3_S, layer split auto, MTP on (
--spec 4),--resident-budget-gib 60. Most experts sit in the GPU caches and in pinned RAM; a small rest goes through the file tier, so this is not the fully resident case. Each cell is the median of a 512-token bench run. Arms alternate on/off with a fresh engine per arm.taskset)taskset)STRATA_LOOKAHEAD=0STRATA_LOOKAHEAD=0With 16 CPUs, turning the look-ahead off gives +27% short, +13% at 30K and +25% copy (tok/s). With all CPUs there is no difference beyond run noise (about 6% here).
The start-up log shows the difference between the two cases:
15 pool workers on logical processors 1-15, the host thread on 0andaux cpus: ... none spare18 pool workers on logical processors 1-18, the host thread on 0andaux cpus: ... go to CPUs 19So the look-ahead threads compete with the pool workers when every CPU is already taken by a worker or the host. That is the situation on the 6-core i5 above, and on any box where the engine is pinned to a few cores. In our case it also happens while some experts are still file-backed. A gate on "nothing can be read from disk" alone would therefore miss it; a gate on "no spare aux CPU" (or both) would cover it.