[GH-ISSUE #3849] [Benchmark] --batch loses expert-cache hit rate on 2x RTX 3060 (12 GB): 99% -> 86% #1637

Closed
opened 2026-11-04 01:52:49 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @CaptRauti on GitHub (Oct 23, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/3849

"""## [Benchmark] Concurrency on 2x RTX 3060 (12 GB): --batch loses expert-cache hit rate 99% -> 86%

Full report with numbers: pushed to community-results/fenris-concurrency/ in my fork
(CaptRauti/Strata, branch docs/fenris-concurrency), plus a parametrized benchmark script.

Hardware (maintainers don't have it)

  • Intel Xeon E5-2697 v2, AVX-1 only (no AVX2/AVX-512) — local AVX-floor engine build
  • 2x NVIDIA RTX 3060 12 GB, two different brands, 100 W power limit, 1650 MHz cap
  • 128 GB RAM · 128k context · KV Q4_0 · engine 0.1.45 · Swift 1.5 IQ2_XS (SC117 abliterated)

What I measured (engine-internal, warm) — 2 concurrent streams, 80 tokens

Config Per-stream decode Expert-cache hit avg completion (2 streams)
parallel: 1 (sequential) 62 tok/s 99 % ~1.8 s
parallel: 2 (--batch 2) 40 tok/s 88.5 % ~4.0 s
parallel: 4 (--batch 4, 2 groups x 2) 46 tok/s 86 % ~5.8 s

Finding (why it matters upstream)

--batch N — the engine's stream batching, measured fast on 2x A4000 and 2x RTX 3090 — is
not a win on two 12 GB cards: each slot allocates its own KV copy, which shrinks the
expert cache, so hit rate falls (99 % -> 86-88 %) and PCIe expert reads grow. Sequential
(parallel: 1) has the best single-stream rate AND the best average completion time here.

The likely on-device path to batch speedup on small VRAM is shared/pooled KV across slots
(paged KV), so streams fuse without a per-slot max_context KV reservation.

Not tested: vision under batch, >4 slots, other quant levels. Everything measured same-day
against the running engine (100 W / 1650 MHz).

Originally created by @CaptRauti on GitHub (Oct 23, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/3849 """## [Benchmark] Concurrency on 2x RTX 3060 (12 GB): --batch loses expert-cache hit rate 99% -> 86% Full report with numbers: pushed to `community-results/fenris-concurrency/` in my fork (CaptRauti/Strata, branch `docs/fenris-concurrency`), plus a parametrized benchmark script. ### Hardware (maintainers don't have it) - Intel Xeon E5-2697 v2, **AVX-1 only** (no AVX2/AVX-512) — local AVX-floor engine build - **2x NVIDIA RTX 3060 12 GB**, two different brands, 100 W power limit, 1650 MHz cap - 128 GB RAM · 128k context · KV Q4_0 · engine **0.1.45** · Swift 1.5 IQ2_XS (SC117 abliterated) ### What I measured (engine-internal, warm) — 2 concurrent streams, 80 tokens | Config | Per-stream decode | Expert-cache hit | avg completion (2 streams) | |---|---|---|---| | `parallel: 1` (sequential) | **62 tok/s** | **99 %** | **~1.8 s** | | `parallel: 2` (`--batch 2`) | 40 tok/s | 88.5 % | ~4.0 s | | `parallel: 4` (`--batch 4`, 2 groups x 2) | 46 tok/s | 86 % | ~5.8 s | ### Finding (why it matters upstream) `--batch N` — the engine's stream batching, measured fast on 2x A4000 and 2x RTX 3090 — is **not** a win on two **12 GB** cards: each slot allocates its **own KV copy**, which shrinks the expert cache, so hit rate falls (99 % -> 86-88 %) and PCIe expert reads grow. Sequential (`parallel: 1`) has the best single-stream rate AND the best average completion time here. The likely on-device path to batch speedup on small VRAM is **shared/pooled KV across slots** (paged KV), so streams fuse without a per-slot `max_context` KV reservation. Not tested: vision under batch, >4 slots, other quant levels. Everything measured same-day against the running engine (100 W / 1650 MHz).
Author
Owner

@qni-live commented on GitHub (Oct 25, 2026):

Counter-data from a rig where the expert cache has room: with --batch 4 the hit rate does not drop here, so this supports reading the 12 GB result as a VRAM-budget effect rather than something --batch does on its own.

Setup: 2x RTX PRO 4500 Blackwell (32 GB each), layer split auto (K=25), Strata 0.2.6 (engine 0.1.50), official ISTA IQ3_XXS, strata launch --tune skip defaults: 128K context, int8 KV, MTP, --batch 4. The log shows the cost of --batch and what is left: --batch 4: the slot sessions take 3.85 GiB of VRAM on CUDA0 that the expert cache would otherwise hold, and still expert cache 12288 slots, 17.72 GiB on CUDA0 and 11176 slots (20.24 GiB), 11176 of its 12288 profiled pairs on CUDA1. So the cache keeps (almost) the whole profile even with four slots.

Hit rate: the decode expert cache hit rate lines of one run (73 requests: 1, 2, 4 and 8 clients, 4 rounds each, 800 output tokens) add up to 1,136,659 hits of 1,138,855 lookups = 99.8% with the default (one serial group), and 1,138,579 of 1,140,775 = 99.8% with --batch-groups 2 (pipelined). No drop between 1 and 8 clients.

Throughput (tools/serve_load.py, total tok/s, median of 4 rounds, two passes each):

Clients one serial group (default) --batch-groups auto (2 groups of 2)
1 147 / 146 146 / 146
2 156 / 155 176 / 175
4 211 / 210 263 / 264
8 211 / 211 264 / 264

So batching pays here: 4 clients give 1.4x the single-stream total with the serial group and 1.8x with the pipelined groups (see #4129 for that comparison).

What this does and does not show: it does not reproduce the hit-rate loss. The log line about the slot sessions taking VRAM from the cache is consistent with your mechanism (per-slot KV copies shrinking the cache), but here 3.85 GiB comes out of a cache that still holds the whole profile, so I cannot say what happens when it does not. Different model and quant than yours (IQ3_XXS, not IQ2_XS), different card, idle server, short essay prompts. I did not try a 12 or 16 GB card or a smaller max_context with --batch.

The measurements were run by Claude Code (Anthropic) on my PC; I reviewed the numbers and this comment before posting.

<!-- gh-comment-id:6404394651 --> @qni-live commented on GitHub (Oct 25, 2026): Counter-data from a rig where the expert cache has room: with `--batch 4` the hit rate does not drop here, so this supports reading the 12 GB result as a VRAM-budget effect rather than something `--batch` does on its own. **Setup:** 2x RTX PRO 4500 Blackwell (32 GB each), layer split auto (K=25), Strata 0.2.6 (engine 0.1.50), official ISTA IQ3_XXS, `strata launch --tune skip` defaults: 128K context, int8 KV, MTP, `--batch 4`. The log shows the cost of `--batch` and what is left: `--batch 4: the slot sessions take 3.85 GiB of VRAM on CUDA0 that the expert cache would otherwise hold`, and still `expert cache 12288 slots, 17.72 GiB` on CUDA0 and `11176 slots (20.24 GiB), 11176 of its 12288 profiled pairs` on CUDA1. So the cache keeps (almost) the whole profile even with four slots. **Hit rate:** the `decode expert cache hit rate` lines of one run (73 requests: 1, 2, 4 and 8 clients, 4 rounds each, 800 output tokens) add up to 1,136,659 hits of 1,138,855 lookups = **99.8%** with the default (one serial group), and 1,138,579 of 1,140,775 = **99.8%** with `--batch-groups 2` (pipelined). No drop between 1 and 8 clients. **Throughput** (`tools/serve_load.py`, total tok/s, median of 4 rounds, two passes each): | Clients | one serial group (default) | `--batch-groups auto` (2 groups of 2) | | --- | --- | --- | | 1 | 147 / 146 | 146 / 146 | | 2 | 156 / 155 | 176 / 175 | | 4 | 211 / 210 | 263 / 264 | | 8 | 211 / 211 | 264 / 264 | So batching pays here: 4 clients give 1.4x the single-stream total with the serial group and 1.8x with the pipelined groups (see #4129 for that comparison). **What this does and does not show:** it does not reproduce the hit-rate loss. The log line about the slot sessions taking VRAM from the cache is consistent with your mechanism (per-slot KV copies shrinking the cache), but here 3.85 GiB comes out of a cache that still holds the whole profile, so I cannot say what happens when it does not. Different model and quant than yours (IQ3_XXS, not IQ2_XS), different card, idle server, short essay prompts. I did not try a 12 or 16 GB card or a smaller `max_context` with `--batch`. The measurements were run by Claude Code (Anthropic) on my PC; I reviewed the numbers and this comment before posting.
Author
Owner

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

Thank you for measuring this and writing it up. We are building a Strata website with a page for community benchmarks, and results like these will be added there when it launches, so we are closing this here. If your numbers change with a new version, you are welcome to post them again.

<!-- gh-comment-id:6495729291 --> @Niko1221 commented on GitHub (Oct 29, 2026): Thank you for measuring this and writing it up. We are building a Strata website with a page for community benchmarks, and results like these will be added there when it launches, so we are closing this here. If your numbers change with a new version, you are welcome to post them again.
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#1637
No description provided.