[GH-ISSUE #1683] [Feature]: --resident-budget-gib keeps no lend region, so every prompt chunk reads the borrowed slots' experts from the SSD #672

Closed
opened 2026-11-04 01:44:57 +07:00 by bsakaguchi · 3 comments
Owner

Originally created by @KarlGrier on GitHub (Oct 9, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/1683

What do you want to do?

Use --resident-budget-gib (to cap how much RAM the expert copy takes) without the prompt path reading its borrowed cache slots' experts from the SSD on every chunk, when a larger budget, or RAM, has room for them.

Today a RAM budget turns the RAM copy's lend region off. pin_cache_complement sets lend_from_slot = -1 in its budget branch (expert_source.cpp L2291 at v0.1.41, commented "A budget turns lend off"). So the experts of the GPU slots that a prompt chunk borrows are in neither VRAM nor RAM during the prompt, and every chunk reads them from the drive, even when the budget already holds every other expert and RAM has room for these too. A larger budget does not help: the budget branch only places experts the GPU cache does not hold. Without a budget, --resident-experts keeps them ("2225 of the prompt path's 2225 lendable slots keep their experts in RAM too").

Measured 2026-10-09 on stock v0.1.41 (source build with -DSTRATA_MMQ_KQUANTS=ON). UD-Q4_K_XL (unsloth, 71.7 GiB of routed experts), RTX 5080 16 GB alone, 96 GB RAM, --prefill auto:16384. Served, A B B A, a fresh server per arm, model page cache dropped first. Two different 32,768-token prompts per arm, nothing reused:

arm RAM copy lent slots' experts in RAM 32K prompt read (s) prompt tok/s read from the drive per 32K prompt decode tok/s MemAvailable, lowest
--resident-budget-gib 66 64.00 GiB (every expert the GPU cache does not hold) 0 of 2,225 11.53-12.03 2,724-2,844 28.8-29.2 GB 61.0-68.4 16.6 GiB
--resident-experts 70.49 GiB 2,225 of 2,225 9.14-9.50 3,449-3,584 1.2 GB 66.6-71.1 12.2 GiB

Four 32K reads per setting (two arms, two prompts each). The budget arm takes about 26 % longer to read a 32K prompt (11.76 s against 9.33 s on average) and reads about 24 times as much from the drive. The engine's own I/O line for one 32K prompt: "the OS read 28821.4 MB from storage (14 major faults) for 27507.6 MB of expert reads" with the budget, and "the OS read 1215.3 MB from storage ... for 0.0 MB of expert reads" with --resident-experts. Decode after these prompts was 61.0-68.4 tok/s with the budget and 66.6-71.1 with --resident-experts. These are short answers, one per prompt; we did not look into that difference.

The start warning in budget mode says:

strata generate: WARNING: a prompt chunk of 16384 tokens lends 2225 cache slots to the prompt path, but only 0 of their experts fit in RAM: the others are read from the SSD on every chunk, and prompts can read ~3x slower than with --prefill auto (#669). A smaller --prefill, or auto, keeps them all in RAM

With a budget the count is 0 whatever the chunk size, so its advice (a smaller --prefill, or auto) cannot keep them in RAM here.

Two ways this could go: the budget mode keeps a lend region inside the budget, filled after the complement as far as the budget reaches (as --resident-experts does from available RAM). Or the warning names the budget as the cause when one is set.

Related: #669 and #765 (the warning itself), #1389 (lend coverage with --resident-experts, where the line now warns when it is not N of N), and #1190 (the same gap for a layer split; it leaves the single-GPU path as it is).

Not tested: a helper GPU, a layer split, Windows, other files and chunk sizes, --prefill auto, and longer prompts (on 2026-10-08 a local build of v0.1.41 showed the same warning in budget mode and read a 120K prompt in 34 s).

Measured and drafted with Claude Code.

Originally created by @KarlGrier on GitHub (Oct 9, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/1683 ### What do you want to do? Use `--resident-budget-gib` (to cap how much RAM the expert copy takes) without the prompt path reading its borrowed cache slots' experts from the SSD on every chunk, when a larger budget, or RAM, has room for them. Today a RAM budget turns the RAM copy's lend region off. `pin_cache_complement` sets `lend_from_slot = -1` in its budget branch ([expert_source.cpp L2291 at v0.1.41](https://github.com/Niko1221/Strata/blob/fb58e0dbc8399662c0e47c76578c6e878b14f6cf/src/core/expert_source.cpp#L2291), commented "A budget turns `lend` off"). So the experts of the GPU slots that a prompt chunk borrows are in neither VRAM nor RAM during the prompt, and every chunk reads them from the drive, even when the budget already holds every other expert and RAM has room for these too. A larger budget does not help: the budget branch only places experts the GPU cache does not hold. Without a budget, `--resident-experts` keeps them ("2225 of the prompt path's 2225 lendable slots keep their experts in RAM too"). **Measured 2026-10-09 on stock v0.1.41** (source build with `-DSTRATA_MMQ_KQUANTS=ON`). UD-Q4_K_XL (unsloth, 71.7 GiB of routed experts), RTX 5080 16 GB alone, 96 GB RAM, `--prefill auto:16384`. Served, A B B A, a fresh server per arm, model page cache dropped first. Two different 32,768-token prompts per arm, nothing reused: | arm | RAM copy | lent slots' experts in RAM | 32K prompt read (s) | prompt tok/s | read from the drive per 32K prompt | decode tok/s | MemAvailable, lowest | |---|---|---|---|---|---|---|---| | `--resident-budget-gib 66` | 64.00 GiB (every expert the GPU cache does not hold) | 0 of 2,225 | 11.53-12.03 | 2,724-2,844 | 28.8-29.2 GB | 61.0-68.4 | 16.6 GiB | | `--resident-experts` | 70.49 GiB | 2,225 of 2,225 | 9.14-9.50 | 3,449-3,584 | 1.2 GB | 66.6-71.1 | 12.2 GiB | Four 32K reads per setting (two arms, two prompts each). The budget arm takes about 26 % longer to read a 32K prompt (11.76 s against 9.33 s on average) and reads about 24 times as much from the drive. The engine's own I/O line for one 32K prompt: "the OS read 28821.4 MB from storage (14 major faults) for 27507.6 MB of expert reads" with the budget, and "the OS read 1215.3 MB from storage ... for 0.0 MB of expert reads" with `--resident-experts`. Decode after these prompts was 61.0-68.4 tok/s with the budget and 66.6-71.1 with `--resident-experts`. These are short answers, one per prompt; we did not look into that difference. The start warning in budget mode says: ``` strata generate: WARNING: a prompt chunk of 16384 tokens lends 2225 cache slots to the prompt path, but only 0 of their experts fit in RAM: the others are read from the SSD on every chunk, and prompts can read ~3x slower than with --prefill auto (#669). A smaller --prefill, or auto, keeps them all in RAM ``` With a budget the count is 0 whatever the chunk size, so its advice (a smaller `--prefill`, or auto) cannot keep them in RAM here. Two ways this could go: the budget mode keeps a lend region inside the budget, filled after the complement as far as the budget reaches (as `--resident-experts` does from available RAM). Or the warning names the budget as the cause when one is set. Related: #669 and #765 (the warning itself), #1389 (lend coverage with `--resident-experts`, where the line now warns when it is not N of N), and #1190 (the same gap for a layer split; it leaves the single-GPU path as it is). Not tested: a helper GPU, a layer split, Windows, other files and chunk sizes, `--prefill auto`, and longer prompts (on 2026-10-08 a local build of v0.1.41 showed the same warning in budget mode and read a 120K prompt in 34 s). Measured and drafted with Claude Code.
Author
Owner

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

Thank you, this is a clear report and the code agrees with it. In pin_cache_complement, a RAM budget sets lend_from_slot = -1, so no lend region is kept, and a larger budget cannot change that because the budget branch only places experts the GPU cache does not hold. Your numbers (28.8 GB read per 32K prompt against 1.2 GB) fit that exactly. The start warning also does give advice that cannot work in that mode, which we will fix whatever else we do.

The change we would look at is the first one you suggest: with a budget, keep the lend region too, filled after the complement (hottest first) as far as the budget reaches, so the budget stays a hard cap. Only where experts are placed changes, not the maths, so the output should stay identical; we would verify that, and A/B the prompt read time and MemAvailable on a machine where the RAM is smaller than the model. A budget that is too small for the complement plus the lend region would simply keep fewer lent slots and warn, as --resident-experts does now.

One question: with --resident-budget-gib 66, MemAvailable went down to 16.6 GiB, and with --resident-experts to 12.2 GiB. Is there a reason you did not use a budget of about 72 (the complement plus the 6.5 GiB the lend slots need) to compare? It would only show the same 0 of 2,225, as you say, but we want to be sure what you measured before we change the code.

<!-- gh-comment-id:6099682954 --> @Niko1221 commented on GitHub (Oct 10, 2026): Thank you, this is a clear report and the code agrees with it. In `pin_cache_complement`, a RAM budget sets `lend_from_slot = -1`, so no lend region is kept, and a larger budget cannot change that because the budget branch only places experts the GPU cache does not hold. Your numbers (28.8 GB read per 32K prompt against 1.2 GB) fit that exactly. The start warning also does give advice that cannot work in that mode, which we will fix whatever else we do. The change we would look at is the first one you suggest: with a budget, keep the lend region too, filled after the complement (hottest first) as far as the budget reaches, so the budget stays a hard cap. Only where experts are placed changes, not the maths, so the output should stay identical; we would verify that, and A/B the prompt read time and MemAvailable on a machine where the RAM is smaller than the model. A budget that is too small for the complement plus the lend region would simply keep fewer lent slots and warn, as `--resident-experts` does now. One question: with `--resident-budget-gib 66`, MemAvailable went down to 16.6 GiB, and with `--resident-experts` to 12.2 GiB. Is there a reason you did not use a budget of about 72 (the complement plus the 6.5 GiB the lend slots need) to compare? It would only show the same 0 of 2,225, as you say, but we want to be sure what you measured before we change the code.
Author
Owner

@KarlGrier commented on GitHub (Oct 11, 2026):

Thanks. To your question: no, there was no reason against 72; I just didn't know yet that the lend region mattered. The budget was sized before the model's first start. The 5080's cache would hold about 2,650 experts, and every other expert came to 63.9 GiB. Since the budget branch only allocates what it places, I expected anything above 64 GiB to hold every expert, and set 66 for some slack. The lend slots' 6.5 GiB was not part of that sum, because I didn't know a budget turns the lend region off. I only learned that from the start warning, and then from pin_cache_complement, which also showed that a larger budget could not change the count. So I didn't measure one, and for the issue I kept 66 to match the earlier run.

I have now measured --resident-budget-gib 72 on stock v0.1.42 (61b3fb5d, built with -DSTRATA_MMQ_KQUANTS=ON) with STRATA_ROUTE_TAIL_SKIP=0. Everything else is as in the issue: machine, file, flags and method (served, a fresh server per arm, the model's page cache dropped first, the same two 32,768-token prompts). I ran 66 and --resident-experts again in the same session to compare. My first try at these runs was cut short by a RAM stability problem on my machine (now fixed). The RAM now runs at 6000 MT/s instead of the issue's 6200, and the NVIDIA driver is 615.71.09, so compare these rows with each other rather than with the issue's.

arm RAM copy lent slots' experts in RAM 32K prompt read (s) prompt tok/s read from the drive per 32K prompt decode tok/s MemAvailable, lowest
--resident-budget-gib 72 63.95 GiB 0 of 2,258 11.31 / 11.21 2,896 / 2,923 29.0 / 28.9 GB 64.4 / 66.3 16.9 GiB
--resident-budget-gib 66 63.95 GiB 0 of 2,258 11.32 / 11.22 2,895 / 2,922 29.0 / 28.9 GB 65.4 / 64.5 17.1 GiB
--resident-experts 70.53 GiB 2,258 of 2,258 8.94 / 8.75 3,663 / 3,744 1.2 / 1.2 GB 68.4 / 71.4 12.8 GiB

(The 5080 now has about 50 MiB more free at start, so its cache gets 2,669 slots instead of 2,651 and lends 2,258 instead of the issue's 2,225.)

The engine's lines with 72:

FileExpertSource: RAM budget 72.00 GiB: 21907 of the 63.95 GiB of experts the GPU cache does not hold, by profile rank; the rest are read from the files
FileExpertSource: mapped pinned cache complement ready: resident 63.95 GiB, pinned 63.95 GiB in 15 s; page-locked and mapped
strata generate: WARNING: a prompt chunk of 16384 tokens lends 2258 cache slots to the prompt path, but only 0 of their experts fit in RAM: ...
strata serve: the prompt path borrows 2258 CUDA0 cache slots (6.59 GiB)

So 72 behaves exactly like 66. The RAM copy stops at the 63.95 GiB complement, 0 of the 2,258 lent slots keep their experts in RAM, and each 32K prompt reads about 29 GB from the drive. The other 8 GiB of the budget stay unused. They would have been enough: the complement plus the lent slots is 63.95 + 6.59 = 70.54 GiB, which is what --resident-experts holds (70.53 GiB). With those experts in RAM, the 32K read takes 8.8-8.9 s instead of 11.2-11.3 s, and the drive reads drop from about 29 GB to 1.2 GB per prompt.

Measured and drafted with Claude Code.

<!-- gh-comment-id:6106416706 --> @KarlGrier commented on GitHub (Oct 11, 2026): Thanks. To your question: no, there was no reason against 72; I just didn't know yet that the lend region mattered. The budget was sized before the model's first start. The 5080's cache would hold about 2,650 experts, and every other expert came to 63.9 GiB. Since the budget branch only allocates what it places, I expected anything above 64 GiB to hold every expert, and set 66 for some slack. The lend slots' 6.5 GiB was not part of that sum, because I didn't know a budget turns the lend region off. I only learned that from the start warning, and then from `pin_cache_complement`, which also showed that a larger budget could not change the count. So I didn't measure one, and for the issue I kept 66 to match the earlier run. I have now measured `--resident-budget-gib 72` on stock v0.1.42 (`61b3fb5d`, built with `-DSTRATA_MMQ_KQUANTS=ON`) with `STRATA_ROUTE_TAIL_SKIP=0`. Everything else is as in the issue: machine, file, flags and method (served, a fresh server per arm, the model's page cache dropped first, the same two 32,768-token prompts). I ran 66 and `--resident-experts` again in the same session to compare. My first try at these runs was cut short by a RAM stability problem on my machine (now fixed). The RAM now runs at 6000 MT/s instead of the issue's 6200, and the NVIDIA driver is 615.71.09, so compare these rows with each other rather than with the issue's. | arm | RAM copy | lent slots' experts in RAM | 32K prompt read (s) | prompt tok/s | read from the drive per 32K prompt | decode tok/s | MemAvailable, lowest | |---|---|---|---|---|---|---|---| | `--resident-budget-gib 72` | 63.95 GiB | 0 of 2,258 | 11.31 / 11.21 | 2,896 / 2,923 | 29.0 / 28.9 GB | 64.4 / 66.3 | 16.9 GiB | | `--resident-budget-gib 66` | 63.95 GiB | 0 of 2,258 | 11.32 / 11.22 | 2,895 / 2,922 | 29.0 / 28.9 GB | 65.4 / 64.5 | 17.1 GiB | | `--resident-experts` | 70.53 GiB | 2,258 of 2,258 | 8.94 / 8.75 | 3,663 / 3,744 | 1.2 / 1.2 GB | 68.4 / 71.4 | 12.8 GiB | (The 5080 now has about 50 MiB more free at start, so its cache gets 2,669 slots instead of 2,651 and lends 2,258 instead of the issue's 2,225.) The engine's lines with 72: ``` FileExpertSource: RAM budget 72.00 GiB: 21907 of the 63.95 GiB of experts the GPU cache does not hold, by profile rank; the rest are read from the files FileExpertSource: mapped pinned cache complement ready: resident 63.95 GiB, pinned 63.95 GiB in 15 s; page-locked and mapped strata generate: WARNING: a prompt chunk of 16384 tokens lends 2258 cache slots to the prompt path, but only 0 of their experts fit in RAM: ... strata serve: the prompt path borrows 2258 CUDA0 cache slots (6.59 GiB) ``` So 72 behaves exactly like 66. The RAM copy stops at the 63.95 GiB complement, 0 of the 2,258 lent slots keep their experts in RAM, and each 32K prompt reads about 29 GB from the drive. The other 8 GiB of the budget stay unused. They would have been enough: the complement plus the lent slots is 63.95 + 6.59 = 70.54 GiB, which is what `--resident-experts` holds (70.53 GiB). With those experts in RAM, the 32K read takes 8.8-8.9 s instead of 11.2-11.3 s, and the drive reads drop from about 29 GB to 1.2 GB per prompt. Measured and drafted with Claude Code.
Author
Owner

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

Thanks for the report. To keep the tracker current we are closing issues older than three days: 0.1.44 is out with a long list of fixes, and many older reports are covered by it or by 0.1.43.1.

If this still happens on 0.1.44, please leave a comment here with your engine log (and the version line it prints), and we will reopen it. A new issue that links this one works too.

<!-- gh-comment-id:6156181445 --> @Niko1221 commented on GitHub (Oct 13, 2026): Thanks for the report. To keep the tracker current we are closing issues older than three days: [0.1.44](https://github.com/Niko1221/Strata/releases/tag/v0.1.44) is out with a long list of fixes, and many older reports are covered by it or by 0.1.43.1. If this still happens on 0.1.44, please leave a comment here with your engine log (and the version line it prints), and we will reopen it. A new issue that links this one works too.
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#672
No description provided.