[GH-ISSUE #4781] [Engine] 0.1.54 prompt rate drop on a 20 GB Ada card: the auto expert cache is too small, --vram-reserve-mib 1536 restores it (A/B) #2195

Open
opened 2026-11-04 01:57:24 +07:00 by bsakaguchi · 4 comments
Owner

Originally created by @pietroMastro92 on GitHub (Oct 31, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/4781

The 0.1.54 prompt-rate drop on a 20 GB card is the expert-cache sizing, and --vram-reserve-mib 1536 brings it back

Context: #4281 was closed with "post the numbers again when they change". They changed, and this one has a cause
and a fix rather than just numbers, so it goes in its own issue.

Symptom. On this RTX 4000 Ada 20 GB (Windows 11, 255 GiB RAM, Qwen3.8-Flash-Next IQ3_S, context 393216):
0.1.52 read a 20K prompt at ~1,600 tok/s, 0.1.54 at ~1,430 measured the same day, with the 3,8K prompt and the
decode unchanged. I first blamed the attention-batch commit; that was wrong.

A/B, alternating engine loads, 4 fresh nonced prompts per point (the "warm" column is the median of the last
two, the first one pays the cold read):

config expert cache prefill 3,8K prefill 20K (warm)
0.1.54, auto (as shipped) 3.429 MiB 1.250 1.139 (oscillates 955/1444/840/1439)
0.1.54, --vram-reserve-mib 1536 4.112 MiB 1.262 1.588 (1074/1587/1587/1589)
0.1.52, auto 3.571 MiB 1.262 1.592 (941/952/1593/1591)
0.1.54, --vram-reserve-mib 2048 2.577 MiB 1.127 1.250

What it looks like is happening. With no reserve, 0.1.54 leaves 5.414 MiB of VRAM free at load
(vram_free_mib in /metrics) and sizes the cache to 3.429 MiB. Giving it an explicit 1536 MiB reserve makes it
keep more, not less, cache (4.112 MiB, 1.742 -> 2.090 slots) and the prompt rate returns to 0.1.52's level and
stops oscillating. 2048 goes the other way (2.577 MiB, 1.250 tok/s). So somewhere in the auto sizing there is a
threshold this card falls just under, and it is worth a look: 0.1.52 sat at 3.571 and was fine, 0.1.54 at 3.429
is not, and 4.112 is fine again.

Two things that are not the cause (so nobody chases them):

  • STRATA_PROMPT_ATTN_OLD=1: 905 tok/s at 20K, -36%. The old attention is worse, so it is not a regression in
    the new one.
  • --vram-elastic: 1.109 tok/s with the same oscillation, no help.
  • Windows "Shared GPU memory" (the hypothesis from the project-Maya issue about buffers spilling on WDDM):
    sampled with \GPU Adapter Memory(*)\Shared Usage every 250 ms during a 16,2K prompt on 0.1.54, it is flat
    (68.066 -> 68.067 MB, dedicated 14.970 -> 14.975), so on this box nothing spills into shared memory while a
    prompt is read.

What I would ask. Is the auto cache sizing in 0.1.54 leaving headroom it does not need on a 20 GB card? If
that is a deliberate change, a note in the release would help; if not, this card class (20 GB, ~7% of the experts
resident) is a good test case because the cliff is between 3,4 and 4,1 GiB of cache.

Everything was measured on v0.2.8 with engine 0.1.54, fresh prompts with a nonce, the rate read from the engine's
own prompt N tokens = ... read in Z ms line, decode unchanged at 47-50 tok/s throughout.

Originally created by @pietroMastro92 on GitHub (Oct 31, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/4781 ## The 0.1.54 prompt-rate drop on a 20 GB card is the expert-cache sizing, and `--vram-reserve-mib 1536` brings it back Context: #4281 was closed with "post the numbers again when they change". They changed, and this one has a cause and a fix rather than just numbers, so it goes in its own issue. **Symptom.** On this RTX 4000 Ada 20 GB (Windows 11, 255 GiB RAM, Qwen3.8-Flash-Next IQ3_S, context 393216): 0.1.52 read a 20K prompt at ~1,600 tok/s, 0.1.54 at ~1,430 measured the same day, with the 3,8K prompt and the decode unchanged. I first blamed the attention-batch commit; that was wrong. **A/B, alternating engine loads, 4 fresh nonced prompts per point (the "warm" column is the median of the last two, the first one pays the cold read):** | config | expert cache | prefill 3,8K | prefill 20K (warm) | |---|---:|---:|---:| | 0.1.54, auto (as shipped) | 3.429 MiB | 1.250 | **1.139** (oscillates 955/1444/840/1439) | | **0.1.54, `--vram-reserve-mib 1536`** | **4.112 MiB** | 1.262 | **1.588** (1074/1587/1587/1589) | | 0.1.52, auto | 3.571 MiB | 1.262 | 1.592 (941/952/1593/1591) | | 0.1.54, `--vram-reserve-mib 2048` | 2.577 MiB | 1.127 | 1.250 | **What it looks like is happening.** With no reserve, 0.1.54 leaves 5.414 MiB of VRAM free at load (`vram_free_mib` in `/metrics`) and sizes the cache to 3.429 MiB. Giving it an explicit 1536 MiB reserve makes it keep **more**, not less, cache (4.112 MiB, 1.742 -> 2.090 slots) and the prompt rate returns to 0.1.52's level and stops oscillating. 2048 goes the other way (2.577 MiB, 1.250 tok/s). So somewhere in the auto sizing there is a threshold this card falls just under, and it is worth a look: 0.1.52 sat at 3.571 and was fine, 0.1.54 at 3.429 is not, and 4.112 is fine again. **Two things that are not the cause** (so nobody chases them): - `STRATA_PROMPT_ATTN_OLD=1`: 905 tok/s at 20K, -36%. The old attention is worse, so it is not a regression in the new one. - `--vram-elastic`: 1.109 tok/s with the same oscillation, no help. - Windows "Shared GPU memory" (the hypothesis from the project-Maya issue about buffers spilling on WDDM): sampled with `\GPU Adapter Memory(*)\Shared Usage` every 250 ms during a 16,2K prompt on 0.1.54, it is **flat** (68.066 -> 68.067 MB, dedicated 14.970 -> 14.975), so on this box nothing spills into shared memory while a prompt is read. **What I would ask.** Is the auto cache sizing in 0.1.54 leaving headroom it does not need on a 20 GB card? If that is a deliberate change, a note in the release would help; if not, this card class (20 GB, ~7% of the experts resident) is a good test case because the cliff is between 3,4 and 4,1 GiB of cache. Everything was measured on v0.2.8 with engine 0.1.54, fresh prompts with a nonce, the rate read from the engine's own `prompt N tokens = ... read in Z ms` line, decode unchanged at 47-50 tok/s throughout.
Author
Owner

@github-actions[bot] commented on GitHub (Oct 31, 2026):

Thanks for the issue. To keep the tracker readable, every item needs an area prefix in the title and the parts of the issue form filled in. This one is missing:

  • Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other], then a short description. Example: "[Engine] decode stops after 2 minutes".

Edit the issue (title and description) and this note goes away on its own. If it is still missing parts in 5 days it will be closed, which is not a rejection: fix it and comment /reopen.

Details: CONTRIBUTING.md

<!-- gh-comment-id:6539068684 --> @github-actions[bot] commented on GitHub (Oct 31, 2026): Thanks for the issue. To keep the tracker readable, every item needs an area prefix in the title and the parts of the issue form filled in. This one is missing: - [ ] Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other], then a short description. Example: "[Engine] decode stops after 2 minutes". Edit the issue (title and description) and this note goes away on its own. If it is still missing parts in 5 days it will be closed, which is not a rejection: fix it and comment `/reopen`. Details: [CONTRIBUTING.md](https://github.com/Niko1221/Strata/blob/main/CONTRIBUTING.md)
Author
Owner

@github-actions[bot] commented on GitHub (Oct 31, 2026):

Thanks, this follows the format now.

<!-- gh-comment-id:6540405247 --> @github-actions[bot] commented on GitHub (Oct 31, 2026): Thanks, this follows the format now.
Author
Owner

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

Thank you for the A/B and for ruling out the other causes. 0.2.8 keeps an extra 256 MiB free after the expert cache (it fixes cards ending under the free-memory line the engine warns about), which is about the cache difference you saw. We could not reproduce the drop, because we have no 20 GB card, and we cannot yet explain why --vram-reserve-mib 1536 gives a larger cache than the automatic choice. Could you post the engine start log for the automatic run and for the 1536 run? The lines we need are "expert cache auto: ...", any "only N MiB free once the slots are written", "prompt path borrows N cache slots" and "prompt chunk auto". Until we have looked at it, --vram-reserve-mib 1536 works on your card.

<!-- gh-comment-id:6547918853 --> @Niko1221 commented on GitHub (Oct 31, 2026): Thank you for the A/B and for ruling out the other causes. 0.2.8 keeps an extra 256 MiB free after the expert cache (it fixes cards ending under the free-memory line the engine warns about), which is about the cache difference you saw. We could not reproduce the drop, because we have no 20 GB card, and we cannot yet explain why `--vram-reserve-mib 1536` gives a larger cache than the automatic choice. Could you post the engine start log for the automatic run and for the 1536 run? The lines we need are "expert cache auto: ...", any "only N MiB free once the slots are written", "prompt path borrows N cache slots" and "prompt chunk auto". Until we have looked at it, `--vram-reserve-mib 1536` works on your card.
Author
Owner

@pietroMastro92 commented on GitHub (Oct 31, 2026):

Thanks for getting back to me, and for the 0.2.8 note about the extra 256 MiB. Here are the start logs you asked for, both on 0.2.9 with engine 0.1.55, same machine (RTX 4000 Ada 20 GB, Windows 11, Qwen3.8 IQ3_S, 393216 ctx), one variable changed (the reserve), engine restarted between the two runs, nothing else running.

The automatic run (no --vram-reserve-mib)

strata generate: expert cache auto: 9.11 GiB free, 700 MiB reserved (+218 MiB for the draft head, +256 MiB for what is allocated after the cache) -> 3211 slots
strata generate: only 0 MiB free once the slots are written (reserve 700 MiB); shrinking the expert cache
strata generate: only 0 MiB free once the slots are written (reserve 700 MiB); shrinking the expert cache
strata generate: only 0 MiB free once the slots are written (reserve 700 MiB); shrinking the expert cache
strata generate: only 0 MiB free once the slots are written (reserve 700 MiB); shrinking the expert cache
strata serve: prompt chunk auto: 5120 tokens, a 199-slot ring
strata serve: the prompt path borrows 1522 CUDA0 cache slots (2.92 GiB)

Final: expert_cache_mib 3429, vram_free_mib 5414.

The --vram-reserve-mib 1536 run

strata generate: expert cache auto: 9.11 GiB free, 1536 MiB reserved (+218 MiB for the draft head, +256 MiB for what is allocated after the cache) -> 2881 slots
strata generate: only 0 MiB free once the slots are written (reserve 1536 MiB); shrinking the expert cache
strata generate: only 0 MiB free once the slots are written (reserve 1536 MiB); shrinking the expert cache
strata serve: prompt chunk auto: 6912 tokens, a 199-slot ring
strata serve: the prompt path borrows 1865 CUDA0 cache slots (3.58 GiB)

Final: expert_cache_mib 4112, vram_free_mib 0.

What the two logs say, in case it helps

  1. The automatic reserve on this card is 700 MiB, not the 256 MiB you added in 0.2.8, and it starts from 3211 slots against 2881 with the explicit 1536. So the explicit reserve starts with a smaller cache, as one would expect.
  2. The difference appears in the shrinking: the auto run hits "only 0 MiB free" four times, the 1536 run twice. That is where the 3211 goes to 3429 in the auto case but 2881 to 4112 in the 1536 case: the auto shrink takes ~700 MiB back, the 1536 shrink takes less and the cache ends up larger.
  3. prompt chunk auto changes with it: 5120 -> 6912 tokens, and the borrow goes 1522 -> 1865 slots. Since the chunk and the borrow scale together, the cache's own numbers look like a consequence of the chunk the prompt path decided on, not the other way round.
  4. The end state differs: reserve 1536 leaves vram_free_mib 0 (my card is then full, which is why I keep 1536 and not 2048: at 2048 the cache comes out at 2577 and the 20K prompt rate drops back). The warning "add --vram-reserve-mib 2048" wants to reserve more, but on this card it produces a smaller usable cache and 0 free either way.

So on my card the sequence seems to be: explicit reserve -> smaller initial cache -> fewer shrink rounds -> bigger prompt chunk -> bigger borrow -> bigger final cache. If that is the intended interaction, a sentence in the docs would help; if it is not, the auto path shrinking four times where the explicit one shrinks twice is the thing to look at.

Prompt rate on the same prompts (fresh nonced prompts, 4 each, median of the last 2, read from the engine's own line): 20K 1139 auto against 1588 with 1536; 3.8K 1250 against 1262. Decode unchanged at 47-50 tok/s.

<!-- gh-comment-id:6550426827 --> @pietroMastro92 commented on GitHub (Oct 31, 2026): Thanks for getting back to me, and for the 0.2.8 note about the extra 256 MiB. Here are the start logs you asked for, both on **0.2.9 with engine 0.1.55**, same machine (RTX 4000 Ada 20 GB, Windows 11, Qwen3.8 IQ3_S, 393216 ctx), one variable changed (the reserve), engine restarted between the two runs, nothing else running. ### The automatic run (no `--vram-reserve-mib`) ``` strata generate: expert cache auto: 9.11 GiB free, 700 MiB reserved (+218 MiB for the draft head, +256 MiB for what is allocated after the cache) -> 3211 slots strata generate: only 0 MiB free once the slots are written (reserve 700 MiB); shrinking the expert cache strata generate: only 0 MiB free once the slots are written (reserve 700 MiB); shrinking the expert cache strata generate: only 0 MiB free once the slots are written (reserve 700 MiB); shrinking the expert cache strata generate: only 0 MiB free once the slots are written (reserve 700 MiB); shrinking the expert cache strata serve: prompt chunk auto: 5120 tokens, a 199-slot ring strata serve: the prompt path borrows 1522 CUDA0 cache slots (2.92 GiB) ``` Final: `expert_cache_mib 3429`, `vram_free_mib 5414`. ### The `--vram-reserve-mib 1536` run ``` strata generate: expert cache auto: 9.11 GiB free, 1536 MiB reserved (+218 MiB for the draft head, +256 MiB for what is allocated after the cache) -> 2881 slots strata generate: only 0 MiB free once the slots are written (reserve 1536 MiB); shrinking the expert cache strata generate: only 0 MiB free once the slots are written (reserve 1536 MiB); shrinking the expert cache strata serve: prompt chunk auto: 6912 tokens, a 199-slot ring strata serve: the prompt path borrows 1865 CUDA0 cache slots (3.58 GiB) ``` Final: `expert_cache_mib 4112`, `vram_free_mib 0`. ### What the two logs say, in case it helps 1. The automatic reserve on this card is **700 MiB**, not the 256 MiB you added in 0.2.8, and it starts from **3211 slots** against 2881 with the explicit 1536. So the explicit reserve starts with a *smaller* cache, as one would expect. 2. The difference appears in the shrinking: the auto run hits "only 0 MiB free" **four times**, the 1536 run **twice**. That is where the 3211 goes to 3429 in the auto case but 2881 to 4112 in the 1536 case: the auto shrink takes ~700 MiB back, the 1536 shrink takes less and the cache ends up larger. 3. `prompt chunk auto` changes with it: **5120 -> 6912 tokens**, and the borrow goes **1522 -> 1865 slots**. Since the chunk and the borrow scale together, the cache's own numbers look like a consequence of the chunk the prompt path decided on, not the other way round. 4. The end state differs: reserve 1536 leaves `vram_free_mib 0` (my card is then full, which is why I keep 1536 and not 2048: at 2048 the cache comes out at 2577 and the 20K prompt rate drops back). The warning "add --vram-reserve-mib 2048" wants to reserve more, but on this card it produces a *smaller* usable cache and 0 free either way. So on my card the sequence seems to be: explicit reserve -> smaller initial cache -> fewer shrink rounds -> bigger prompt chunk -> bigger borrow -> bigger final cache. If that is the intended interaction, a sentence in the docs would help; if it is not, the auto path shrinking four times where the explicit one shrinks twice is the thing to look at. Prompt rate on the same prompts (fresh nonced prompts, 4 each, median of the last 2, read from the engine's own line): 20K **1139 auto** against **1588 with 1536**; 3.8K 1250 against 1262. Decode unchanged at 47-50 tok/s.
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#2195
No description provided.