[GH-ISSUE #2342] RTX 3080 10 GB / 64 GB RAM: KV residency, expert cache capacity, and benchmark observations #947

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

Originally created by @wojski on GitHub (Oct 14, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/2342

While benchmarking Qwen3.8-Flash-Next IQ3_S on Strata (RTX 3080 10 GB, 64 GB system RAM, 131,072 max context, INT8 KV), I noticed a substantial improvement after changing the memory configuration. I then asked GPT-6.1 Sol to inspect the relevant source code and explain the results.

This is a benchmark observation and code-analysis summary, not a confirmed bug report.

Benchmark observations

Configuration Initial GPU expert cache Prefill at ~130K input Decode at ~130K
Original automatic allocation (no explicit --kv-resident) 756 experts / 1.46 GiB ~628 tok/s ~49 tok/s
--kv-resident 32768 (with adaptation overrides) 1,416 experts / 2.73 GiB 1,528.7 tok/s (median, 2 runs) 61.5 tok/s
--kv-resident 16384 (with adaptation overrides) 1,491 experts / 2.88 GiB 1,608 tok/s (1 run) 61.2 tok/s
--kv-resident 8192 1,491 experts / 2.88 GiB Essentially unchanged from 16K Essentially unchanged

The 32K and 16K measurements used almost identical prompts (~129,973 vs. ~129,970 actual tokens), with 256 generated tokens. Moving from 32K to 16K improved measured prefill by ~5.2%. Additional experiments changing --adapt-swaps (240 → 80) and --pcie-frac (0.00 → 0.20) showed no meaningful improvement in this test.

During the initial tuning, I observed approximately 2.2× higher prefill throughput compared with the starting setup. This is not yet a controlled 1:1 comparison: the initial measurement was at a different prompt length, and multiple settings changed. The most reliable directly observed difference is the expert-cache allocation increase from 756 to 1,416 experts after the first configuration changes.

Follow-up source analysis by GPT-6.1 Sol

After seeing these results, I asked GPT-6.1 Sol to analyze Strata's setup, allocation, and calibration code. Its findings were:

  • KV allocation is the likely explanation for the cache increase (high confidence). Setting --kv-resident 32768 reduces main-model and MTP GPU state by approximately 1.2705 GiB, closely matching the observed ~1.27 GiB increase in GPU expert-cache allocation. Adaptive flags affect expert replacement behavior, not initial cache capacity.
  • Setup's RAM gate matters (high confidence for the inspected source). The IQ3_S / 131K setup path requires approximately 64.799 GiB, above the RAM available on this 64 GB machine. This conservative requirement is intentional and has already been discussed in issue #620. The original setup version/logs would be needed to confirm its exact role in my initial configuration.
  • Calibration does not appear to be the cause (high confidence). The inspected calibration code tunes decode scheduling/adaptation, not KV residency or initial expert-cache capacity. The analysis did not identify a calibration defect explaining this result.

Working hypothesis: on some memory-constrained configurations, a lower GPU KV residency can free enough VRAM for a significantly larger expert cache, potentially improving prefill throughput. This does not establish that the automatic allocator is incorrect or that lower residency is universally better.

Scope and next steps

These numbers come only from the synthetic benchmark, not from a live Claude Code / agentic workflow. They do not yet establish improvements in multi-turn prompt reuse, tool-heavy sessions, or sustained real-world use.

They also apply specifically to my 64 GB RAM configuration. Where possible, I will check whether similar gains appear with larger context workloads and with 128 GB of system RAM.

The most useful next controlled comparison would be the original configuration vs. the original configuration plus only --kv-resident 32768, using identical ~16K inputs, generation limits, and repeated runs. It would help separate the effect of KV residency from the other tuning changes.

I am sharing this mainly to ask whether this memory trade-off is expected, and whether setup could make the KV-residency / expert-cache trade-off more visible or offer an alternative profile for limited-VRAM GPUs.

Originally created by @wojski on GitHub (Oct 14, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/2342 While benchmarking **Qwen3.8-Flash-Next IQ3_S** on **Strata** (RTX 3080 10 GB, **64 GB system RAM**, 131,072 max context, INT8 KV), I noticed a substantial improvement after changing the memory configuration. I then asked **GPT-6.1 Sol** to inspect the relevant source code and explain the results. This is a **benchmark observation and code-analysis summary**, **not a confirmed bug report**. ## Benchmark observations | Configuration | Initial GPU expert cache | Prefill at ~130K input | Decode at ~130K | | --- | ---: | ---: | ---: | | Original automatic allocation (no explicit `--kv-resident`) | 756 experts / 1.46 GiB | ~628 tok/s | ~49 tok/s | | `--kv-resident 32768` (with adaptation overrides) | 1,416 experts / 2.73 GiB | 1,528.7 tok/s (median, 2 runs) | 61.5 tok/s | | `--kv-resident 16384` (with adaptation overrides) | 1,491 experts / 2.88 GiB | 1,608 tok/s (1 run) | 61.2 tok/s | | `--kv-resident 8192` | 1,491 experts / 2.88 GiB | Essentially unchanged from 16K | Essentially unchanged | The 32K and 16K measurements used almost identical prompts (~129,973 vs. ~129,970 actual tokens), with 256 generated tokens. Moving from 32K to 16K improved measured prefill by **~5.2%**. Additional experiments changing `--adapt-swaps` (240 → 80) and `--pcie-frac` (0.00 → 0.20) showed no meaningful improvement in this test. During the initial tuning, I observed approximately **2.2× higher prefill throughput** compared with the starting setup. **This is not yet a controlled 1:1 comparison:** the initial measurement was at a different prompt length, and multiple settings changed. The most reliable directly observed difference is the expert-cache allocation increase from **756 to 1,416 experts** after the first configuration changes. ## Follow-up source analysis by GPT-6.1 Sol After seeing these results, I asked GPT-6.1 Sol to analyze Strata's setup, allocation, and calibration code. Its findings were: - **KV allocation is the likely explanation for the cache increase (high confidence).** Setting `--kv-resident 32768` reduces main-model and MTP GPU state by approximately **1.2705 GiB**, closely matching the observed **~1.27 GiB** increase in GPU expert-cache allocation. Adaptive flags affect expert replacement behavior, not initial cache capacity. - **Setup's RAM gate matters (high confidence for the inspected source).** The IQ3_S / 131K setup path requires approximately **64.799 GiB**, above the RAM available on this **64 GB** machine. This conservative requirement is intentional and has already been discussed in [issue #620](https://github.com/Niko1221/Strata/issues/620). The original setup version/logs would be needed to confirm its exact role in my initial configuration. - **Calibration does not appear to be the cause (high confidence).** The inspected calibration code tunes decode scheduling/adaptation, not KV residency or initial expert-cache capacity. The analysis did not identify a calibration defect explaining this result. **Working hypothesis:** on some memory-constrained configurations, a lower GPU KV residency can free enough VRAM for a significantly larger expert cache, potentially improving prefill throughput. This does **not** establish that the automatic allocator is incorrect or that lower residency is universally better. ## Scope and next steps These numbers come **only from the synthetic benchmark**, **not from a live Claude Code / agentic workflow**. They do not yet establish improvements in multi-turn prompt reuse, tool-heavy sessions, or sustained real-world use. They also apply specifically to my **64 GB RAM** configuration. **Where possible, I will check whether similar gains appear with larger context workloads and with 128 GB of system RAM.** The most useful next controlled comparison would be the **original configuration vs. the original configuration plus only `--kv-resident 32768`**, using identical ~16K inputs, generation limits, and repeated runs. It would help separate the effect of KV residency from the other tuning changes. I am sharing this mainly to ask whether this memory trade-off is expected, and whether setup could make the KV-residency / expert-cache trade-off more visible or offer an alternative profile for limited-VRAM GPUs.
Author
Owner

@qiuzan2001 commented on GitHub (Oct 15, 2026):

This matches what setup does on purpose. KV streaming (--kv-resident 32768: the KV cache in RAM, only the attention's window in VRAM, so more experts fit) is turned on only when the RAM covers the model plus the streamed KV plus 1 GB (kv_streaming_wanted, setup.py:4062). For IQ3_S at 131,072 tokens with 8-bit KV that is 62 + 1.8 + 1 = 64.8 GB, just over a 64 GB PC, so setup leaves it off and says why: KV streaming off: it needs ~1.8 GB of RAM beside the ~62 GB IQ3_S uses ... --kv-streaming on turns it on anyway. --kv-streaming on (or the --kv-resident you used) overrides that test; the attention reads the same values either way (docs/DETAILS.md, "KV streaming": Q2_0 at 262K went from 1,589 to 3,872 experts in VRAM, 50.9 → 62.6 tok/s). Your +2.2x prefill at 130K on a 10 GB card is a bigger effect than the docs show; the RAM margin is what to watch.

<!-- gh-comment-id:6184288935 --> @qiuzan2001 commented on GitHub (Oct 15, 2026): This matches what setup does on purpose. KV streaming (`--kv-resident 32768`: the KV cache in RAM, only the attention's window in VRAM, so more experts fit) is turned on only when the RAM covers the model plus the streamed KV plus 1 GB (`kv_streaming_wanted`, setup.py:4062). For IQ3_S at 131,072 tokens with 8-bit KV that is 62 + 1.8 + 1 = 64.8 GB, just over a 64 GB PC, so setup leaves it off and says why: `KV streaming off: it needs ~1.8 GB of RAM beside the ~62 GB IQ3_S uses ... --kv-streaming on turns it on anyway`. `--kv-streaming on` (or the `--kv-resident` you used) overrides that test; the attention reads the same values either way ([docs/DETAILS.md](https://github.com/Niko1221/Strata/blob/main/docs/DETAILS.md), "KV streaming": Q2_0 at 262K went from 1,589 to 3,872 experts in VRAM, 50.9 → 62.6 tok/s). Your +2.2x prefill at 130K on a 10 GB card is a bigger effect than the docs show; the RAM margin is what to watch.
Author
Owner

@qiuzan2001 commented on GitHub (Oct 16, 2026):

A follow-up on the part you had to find by hand: which --kv-resident and expert cache the engine actually loaded, against what you set and what setup writes. Strata Profile Studio shows the settings as three columns (loaded now, next load, the run config file) with a warning where they differ, and its Compare view puts two profile runs (for example --kv-resident 32768 against 16384) against the noise floor measured from same-settings runs on the same PC, per workload and per agent turn, so a 5 % prefill change is judged against the PC's own spread rather than by eye. It reads the reports of tools/strata_profile.py (#2660) from bench/results.

<!-- gh-comment-id:6207511074 --> @qiuzan2001 commented on GitHub (Oct 16, 2026): A follow-up on the part you had to find by hand: which `--kv-resident` and expert cache the engine actually loaded, against what you set and what setup writes. [Strata Profile Studio](https://github.com/qiuzan2001/strata-profile-studio) shows the settings as three columns (loaded now, next load, the run config file) with a warning where they differ, and its Compare view puts two profile runs (for example `--kv-resident 32768` against `16384`) against the noise floor measured from same-settings runs on the same PC, per workload and per agent turn, so a 5 % prefill change is judged against the PC's own spread rather than by eye. It reads the reports of `tools/strata_profile.py` (#2660) from `bench/results`.
Author
Owner

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

Thanks for taking the time to report this.

We're resetting the tracker for 0.2.0-beta. There are more than 1,300 open issues and pull requests, too many for us to read properly, so we're closing everything that isn't being worked on right now. Closed here does not mean rejected.

To reopen it takes about two minutes:

  1. Re-test on 0.2.0-beta. It may already be fixed. Write down what you see.
  2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other].
  3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system.
  4. Comment /reopen. A check runs and either reopens the issue or lists what is still missing.

The rules are in CONTRIBUTING.md.

<!-- gh-comment-id:6270971955 --> @Niko1221 commented on GitHub (Oct 19, 2026): Thanks for taking the time to report this. We're resetting the tracker for 0.2.0-beta. There are more than 1,300 open issues and pull requests, too many for us to read properly, so we're closing everything that isn't being worked on right now. Closed here does not mean rejected. To reopen it takes about two minutes: 1. Re-test on 0.2.0-beta. It may already be fixed. Write down what you see. 2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other]. 3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system. 4. Comment `/reopen`. A check runs and either reopens the issue or lists what is still missing. The rules are in [CONTRIBUTING.md](https://github.com/Niko1221/Strata/blob/main/CONTRIBUTING.md).
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#947
No description provided.