[GH-ISSUE #5213] [Engine] DFlash2 confidence ignores --kv-resident: a 32 GB card with KV streaming gets 0.35 where its 8,312 slots want 0.5 #3104

Open
opened 2026-11-07 14:38:06 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @sdroege on GitHub (Nov 4, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/5213

Area

[Engine] (speed, kernels, models, the server and API)

Desktop app, Terminal or source?

Source (START-HERE.bat, setup.sh or a build)

What happened

On a single 32 GB R9700 running Qwen3.8-Flash-Next UD-Q4_K_XL with --max-context 163840 --kv-resident 32768, an Auto/DFlash2 start picks --draft-conf 0.35. The engine's own log says expert cache 8312 slots, and drafting.CONF_STEPS prescribes 0.5 for 7,500 to 12,000 slots.

Measured on this machine, same start otherwise, 3 rounds each, 1,000-token generation:

--draft-conf decode tok/s draft acceptance
0.35 (what the start picks) 66.7 58.4%
0.5 (what 8,312 slots prescribe) 71.1 67.0%

Against the MTP on the same build, 0.35 is about -3.4% decode and 0.5 is +8.2%.

Cause (static analysis). strata_control/drafting.py:505 expected_slots() reads --max-context, --kv, --vram-reserve-mib and --prefill, but not --kv-resident, and calls vram_fit.session_mib(ctx, kv) without the streamed window. For this config that prices the KV session at 2,382 MiB instead of 792 MiB, 1,590 MiB too high, which is 815 slots. With the window counted the estimate is 11,558, which is the 0.5 step; without it, 12,373, which is the 0.35 step.

The estimate is still high after that (11,558 against the engine's 8,312). The remaining gap looks like the nominal 32 GB against 30.7 GiB usable and SLOT_BASE_MIB not covering the DFlash2 drafter and draft head, but that part is a separate finding and I have not isolated it.

Smallest steps or command that reproduce it

  1. Use a config with --kv-resident below --max-context and no --draft-conf.
  2. Start it and read the engine command line: it contains --draft-conf 0.35.
  3. Read the engine log's expert cache N slots line: 8,312 here.
  4. Add "user_args": ["--draft-conf", "0.5"] and start again: decode improves.

Expected: the confidence matches the slots the engine actually holds.
Actual: 0.35, one step too low.

Related: #5109, #5129, #5178 (same family: the automatic confidence is wrong for the card).

Proposed fix: read --kv-resident in expected_slots() and pass it as the third argument to session_mib, which already supports it.

Reproduction status

Reproduced locally for the symptom; the code cause above is unconfirmed static analysis (I did not patch and rerun).

Strata version

Strata 0.2.10, engine 0.1.56

Graphics card, memory and system

Radeon AI PRO R9700 32 GB, 121.5 GiB RAM, Fedora 44 (kernel 7.2.13-200.fc44.x86_64)

Originally created by @sdroege on GitHub (Nov 4, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/5213 ### Area [Engine] (speed, kernels, models, the server and API) ### Desktop app, Terminal or source? Source (START-HERE.bat, setup.sh or a build) ### What happened On a single 32 GB R9700 running Qwen3.8-Flash-Next UD-Q4_K_XL with `--max-context 163840 --kv-resident 32768`, an Auto/DFlash2 start picks `--draft-conf 0.35`. The engine's own log says `expert cache 8312 slots`, and `drafting.CONF_STEPS` prescribes 0.5 for 7,500 to 12,000 slots. Measured on this machine, same start otherwise, 3 rounds each, 1,000-token generation: | `--draft-conf` | decode tok/s | draft acceptance | |---|---|---| | 0.35 (what the start picks) | 66.7 | 58.4% | | 0.5 (what 8,312 slots prescribe) | 71.1 | 67.0% | Against the MTP on the same build, 0.35 is about -3.4% decode and 0.5 is +8.2%. **Cause (static analysis).** `strata_control/drafting.py:505` `expected_slots()` reads `--max-context`, `--kv`, `--vram-reserve-mib` and `--prefill`, but not `--kv-resident`, and calls `vram_fit.session_mib(ctx, kv)` without the streamed window. For this config that prices the KV session at 2,382 MiB instead of 792 MiB, 1,590 MiB too high, which is 815 slots. With the window counted the estimate is 11,558, which is the 0.5 step; without it, 12,373, which is the 0.35 step. The estimate is still high after that (11,558 against the engine's 8,312). The remaining gap looks like the nominal 32 GB against 30.7 GiB usable and `SLOT_BASE_MIB` not covering the DFlash2 drafter and draft head, but that part is a separate finding and I have not isolated it. ### Smallest steps or command that reproduce it 1. Use a config with `--kv-resident` below `--max-context` and no `--draft-conf`. 2. Start it and read the engine command line: it contains `--draft-conf 0.35`. 3. Read the engine log's `expert cache N slots` line: 8,312 here. 4. Add `"user_args": ["--draft-conf", "0.5"]` and start again: decode improves. Expected: the confidence matches the slots the engine actually holds. Actual: 0.35, one step too low. Related: #5109, #5129, #5178 (same family: the automatic confidence is wrong for the card). **Proposed fix:** read `--kv-resident` in `expected_slots()` and pass it as the third argument to `session_mib`, which already supports it. ### Reproduction status Reproduced locally for the symptom; the code cause above is unconfirmed static analysis (I did not patch and rerun). ### Strata version Strata 0.2.10, engine 0.1.56 ### Graphics card, memory and system Radeon AI PRO R9700 32 GB, 121.5 GiB RAM, Fedora 44 (kernel 7.2.13-200.fc44.x86_64)
Author
Owner

@tskorupka-emiteo commented on GitHub (Nov 5, 2026):

Another card class with the same symptom: one RX 7900 XTX 24 GB (gfx1100, HIP), Qwen3.8-Flash-Next IQ3_XXS, engine 0.1.56, --max-context 262144 --kv int8 --kv-resident 32768, Auto/DFlash2.

  • What the start picks: --draft-conf 0.7, the 3,000-7,499 step.
  • What the card holds: the engine log says expert cache 10712 slots, and CONF_STEPS prescribes 0.5 for that.

Decode, short prompt, 400 output tokens, greedy, medians of 5-6 per arm. Each value is a separate engine start, run back to back:

--draft-conf decode tok/s
0.7 (what the start picks) 85.3
0.5 (what 10,712 slots prescribe) 94.5
0.35 78.9

So 0.5 is +11% over the automatic value here, and 0.35 is clearly worse, which matches the 7,500-11,999 step of the table. The only way I found to keep 0.5 across starts was user_args in the run config with the server started directly (see #5178), because strata launch regenerates the config.

<!-- gh-comment-id:6657049424 --> @tskorupka-emiteo commented on GitHub (Nov 5, 2026): Another card class with the same symptom: **one RX 7900 XTX 24 GB (gfx1100, HIP)**, Qwen3.8-Flash-Next IQ3_XXS, engine 0.1.56, `--max-context 262144 --kv int8 --kv-resident 32768`, Auto/DFlash2. - **What the start picks**: `--draft-conf 0.7`, the 3,000-7,499 step. - **What the card holds**: the engine log says `expert cache 10712 slots`, and `CONF_STEPS` prescribes 0.5 for that. Decode, short prompt, 400 output tokens, greedy, medians of 5-6 per arm. Each value is a separate engine start, run back to back: | `--draft-conf` | decode tok/s | | --- | ---: | | 0.7 (what the start picks) | 85.3 | | 0.5 (what 10,712 slots prescribe) | 94.5 | | 0.35 | 78.9 | So 0.5 is +11% over the automatic value here, and 0.35 is clearly worse, which matches the 7,500-11,999 step of the table. The only way I found to keep 0.5 across starts was `user_args` in the run config with the server started directly (see #5178), because `strata launch` regenerates the config.
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#3104
No description provided.