[GH-ISSUE #5462] [Engine] 4-card layer split: the expert cache per card falls as cards are added, and --prefill 1024 frees VRAM that the cache does not take #3577

Open
opened 2026-11-07 15:28:27 +07:00 by bsakaguchi · 3 comments
Owner

Originally created by @sean640112 on GitHub (Nov 7, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/5462

Area

[Engine]

Environment

GPUs 4x GeForce RTX 5060 Ti 16 GB (16,311 MiB each, sm_120), no NVLink; nvidia-smi topo -m reports NODE between all of them
CPU / RAM AMD EPYC 7452 (32C, AVX2 only), 123 GiB DDR4-3200
OS / driver Ubuntu 26.04.1, driver 610.57.04
Engine 0.1.57, build 0bdcef4682c5+cuda13.0
Model ISTA-DASLab Qwen3.8-Flash-Next IQ3_S (two shards, 54.82 + 28.80 GB)
Args --expert-cache auto --prefill auto --spec 4 --spec-min-p 0.5 --mtp <mtp>/rt --max-context 131072 --kv int8 --ple-io ram --kv-resident 32768, plus --trim-stage-weights on the split runs
Split gpu [0,1,2,4] (index 3 is an RTX 2060, excluded on purpose), layer_split 12,24,36
Drafting MTP throughout

GPU indices follow nvidia-smi; the split's last card (CUDA3) is the card at index 4.

Why this report

docs/MULTI_GPU.md says a split "can add capacity without adding speed", so a sub-linear decode is not by itself surprising. Two things did surprise me, and both are cheap to check on any multi-card box: the expert cache per card falling with every card added — enough that four cards end up with less total cache than two — and --prefill 1024 freeing about 2.6 GiB of prompt buffers per card without the cache growing into any of it.

1. Expert cache per card falls with every card added

Same machine, same pack, --expert-cache auto, --trim-stage-weights wherever a split exists. One run per configuration; decode is the median of six 256-token greedy requests.

Cards Split Experts cached Cache VRAM Per card Decode, engine Decode, wall clock
1 — 4,388 8.37 GiB 8.37 GiB 92.0 tok/s 85.03 tok/s
2 24 6,691 12.03 GiB 6.02 GiB 97.3 tok/s 88.33 tok/s
4 12,24,36 6,144 10.82 GiB 2.71 GiB 110.7 tok/s 101.28 / 104.45 tok/s
  • Per card the cache falls 8.37 → 6.02 → 2.71 GiB, which is faster than the card count grows, so four cards end up with less total cache than two (10.82 against 12.03 GiB, 6,144 against 6,691 slots). Both split rows carry --trim-stage-weights; on two cards the flag made no difference at all (6,691 / 12.03 GiB either way), so it cannot be what makes the 4-card figure smaller.
  • Decode from one card to four is 1.19x to 1.23x (wall) and 1.20x (engine); one card to two is 1.03x. The one-card path is not a layer split, so this is the comparison a user faces rather than a clean scaling efficiency.

Question 1: is the per-card cache falling that fast expected? --trim-stage-weights should leave each card holding only its own layers' dense weights, i.e. less per card as cards are added, not more. A fixed per-card cost (prompt buffers, context, buffers) explains the direction, but the step from 6.02 to 2.71 GiB per card between two and four cards is what I cannot account for.

2. --prefill 1024 frees the prompt buffers, and the cache does not take the VRAM

Same 4-card configuration, only --prefill changed. Both blocks below are from the engine's own log.

--prefill auto:

strata serve: the prompt path borrows 2011 CUDA0 cache slots (3.53 GiB)
strata serve:   CUDA1 prompt path borrows 1909 of its 6144 slots (3.53 GiB)
strata serve:   CUDA2 prompt path borrows 1775 of its 6144 slots (3.54 GiB)
strata serve:   CUDA3 prompt path borrows 1720 of its 5743 slots (3.54 GiB)

--prefill 1024:

strata serve:   CUDA0 keeps its own prompt buffers (0.90 GiB of 3.21 GiB free): no loan
strata serve:   CUDA1 keeps its own prompt buffers (0.90 GiB of 2.68 GiB free): no loan
strata serve:   CUDA2 prompt path borrows 454 of its 6144 slots (0.90 GiB)
strata serve:   CUDA3 prompt path borrows 444 of its 5743 slots (0.90 GiB)
strata serve:   CUDA0: 2042 MiB of VRAM free with everything loaded
strata serve:   CUDA1: 1502 MiB of VRAM free with everything loaded
--prefill Prompt buffers, per card Experts cached Cache VRAM VRAM free with everything loaded
auto 3.53 GiB 6,144 10.82 GiB — (not logged in that session)
1024 0.90 GiB 6,144 10.82 GiB 2,042 MiB (CUDA0) / 1,502 MiB (CUDA1)

--prefill 1024 works and does what the help says: the buffers fall from 3.53 to 0.90 GiB per card, about 10.5 GiB across four cards. The expert cache stays at exactly 6,144 slots / 10.82 GiB, and about 1.5-2 GB per card is left free. Decode is unchanged (101.09 against 101.28 tok/s wall, within run-to-run spread).

Question 2: is --expert-cache auto meant to grow into VRAM freed this way? If it sizes the cache before the prompt buffers are known, could it re-size (or take the freed room on the next start) — and if not, is --expert-cache N the supported way to use that headroom on a layer split?

3. "parallel": 2 works on a 4-stage layer split

docs/BATCHING.md says "Only a layer split of two stages on two GPUs has been run." On this 4-stage split, with the top-level "parallel": 2, GET /props reported total_slots 2 and one session gave:

Clients Aggregate Per stream
1 86.0 tok/s 86.0
2 130.2 tok/s (+51%) 65.5
4 140.6 tok/s (+63%) 68.1

All three rows come from the same session, so this is a within-configuration comparison.

--trim-stage-weights also does what its help says on four cards: 97.7 → 110.8 tok/s engine (90.18 → 101 tok/s wall), i.e. +13.4%, reproduced with the flag and with STRATA_STAGE_TRIM=1 alike.

4. A note on headroom

In sessions with --prefill auto the engine logs only 459 MiB of VRAM free at the start of this request (below 512 MiB) and warns that decode can fall to a few tok/s (#2065), recommending --vram-reserve-mib 768. --prefill 1024 avoids that entirely (2,042 MiB free). If the default is meant to keep ≥512 MiB, it may be worth either reserving more in --expert-cache auto or suggesting the smaller chunk in that warning.

Validation

Passed — on this box with --kv int8 --kv-resident 32768 --max-context 131072, MTP --spec 4 --spec-min-p 0.5:

  1. Engine starts and serves on 1, 2 and 4 cards; GET /health 200 and GET /v1/models after each start.
  2. Every cache figure is from the start line filling the GPU's expert cache (N experts, X GiB); every VRAM figure is nvidia-smi right after ready:.
  3. The engine's received argv was confirmed in its own log (engine started: …) for each session quoted, so the flags discussed were actually passed.
  4. --trim-stage-weights: 97.7 against 110.8 tok/s engine on the same 4-card config with the flag removed; on 2 cards the flag changed the cache by 0 slots.
  5. "parallel": 2: GET /props total_slots 2, clients 1 / 2 / 4 in one session.
  6. Answer quality, GSM8K test split, first 200 questions, temperature 0, thinking off: 96.50% without --trim-stage-weights, 96.00% with it. One question apart, one run each; at this model size that test is close to saturated, so it rules out a large quality change rather than a small one.

Failed — none.

Not run — vision (--vision no throughout), context above 131,072, and the all-cards split engine, which refuses on four 16 GB cards with each card needs about 21 GiB, has 15 GiB free (expected for this model size; noted only for completeness).

Logs

1 card — GPU0 15,269 MiB

[strata] experts loaded: 46.84 GiB at 2.46 GiB/s (54 s so far)
[strata] filling the GPU's expert cache (4388 experts, 8.37 GiB of VRAM) ...
ready: http://127.0.0.1:18181/v1  (OpenAI: /v1/chat/completions, Anthropic: /v1/messages, context 131072 tokens)

2 cards, split 24, --trim-stage-weights — 15,231 / 15,361 MiB

[strata] layer split across GPUs [0, 1] (24)
[strata] experts loaded: 46.84 GiB at 3.01 GiB/s (104 s so far)
[strata] filling the GPU's expert cache (6691 experts, 12.03 GiB of VRAM) ...
ready: http://127.0.0.1:18181/v1  (OpenAI: /v1/chat/completions, Anthropic: /v1/messages, context 131072 tokens)

4 cards, split 12,24,36, --trim-stage-weights, --prefill auto — 12,911 / 13,451 / 14,377 / 15,361 MiB

[strata] layer split across GPUs [0, 1, 2, 4] (12,24,36)
[strata] experts loaded: 46.84 GiB at 3.86 GiB/s (58 s so far)
[strata] filling the GPU's expert cache (6144 experts, 10.82 GiB of VRAM) ...
ready: http://127.0.0.1:18181/v1  (OpenAI: /v1/chat/completions, Anthropic: /v1/messages, context 131072 tokens)

4 cards, --trim-stage-weights, --prefill 1024 — 13,847 / 14,387 / 14,371 / 15,355 MiB

[strata] filling the GPU's expert cache (6144 experts, 10.82 GiB of VRAM) ...
[strata serve]   CUDA0 keeps its own prompt buffers (0.90 GiB of 3.21 GiB free): no loan
[strata serve]   CUDA0: 2042 MiB of VRAM free with everything loaded
ready: http://127.0.0.1:18181/v1  (OpenAI: /v1/chat/completions, Anthropic: /v1/messages, context 131072 tokens)

4 cards, "parallel": 2 — same cache; total_slots 2

[strata] layer split across GPUs [0, 1, 2, 4] (12,24,36)
[strata] filling the GPU's expert cache (6144 experts, 10.82 GiB of VRAM) ...
ready: http://127.0.0.1:18181/v1  (OpenAI: /v1/chat/completions, Anthropic: /v1/messages, context 131072 tokens)

Happy to attach the complete logs, including the per-request done: lines — say which.

Originally created by @sean640112 on GitHub (Nov 7, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/5462 ### Area [Engine] ### Environment | | | |---|---| | GPUs | 4x GeForce RTX 5060 Ti 16 GB (16,311 MiB each, sm_120), no NVLink; `nvidia-smi topo -m` reports NODE between all of them | | CPU / RAM | AMD EPYC 7452 (32C, AVX2 only), 123 GiB DDR4-3200 | | OS / driver | Ubuntu 26.04.1, driver 610.57.04 | | Engine | **0.1.57**, build `0bdcef4682c5+cuda13.0` | | Model | ISTA-DASLab Qwen3.8-Flash-Next **IQ3_S** (two shards, 54.82 + 28.80 GB) | | Args | `--expert-cache auto --prefill auto --spec 4 --spec-min-p 0.5 --mtp <mtp>/rt --max-context 131072 --kv int8 --ple-io ram --kv-resident 32768`, plus `--trim-stage-weights` on the split runs | | Split | `gpu [0,1,2,4]` (index 3 is an RTX 2060, excluded on purpose), `layer_split 12,24,36` | | Drafting | MTP throughout | GPU indices follow `nvidia-smi`; the split's last card (CUDA3) is the card at index 4. ### Why this report `docs/MULTI_GPU.md` says a split "can add capacity without adding speed", so a sub-linear decode is not by itself surprising. Two things did surprise me, and both are cheap to check on any multi-card box: the expert cache **per card** falling with every card added — enough that four cards end up with **less** total cache than two — and `--prefill 1024` freeing about 2.6 GiB of prompt buffers per card without the cache growing into any of it. ### 1. Expert cache per card falls with every card added Same machine, same pack, `--expert-cache auto`, `--trim-stage-weights` wherever a split exists. One run per configuration; decode is the median of six 256-token greedy requests. | Cards | Split | Experts cached | Cache VRAM | Per card | Decode, engine | Decode, wall clock | |---:|---|---:|---:|---:|---:|---:| | 1 | — | 4,388 | 8.37 GiB | **8.37 GiB** | 92.0 tok/s | 85.03 tok/s | | 2 | 24 | 6,691 | 12.03 GiB | **6.02 GiB** | 97.3 tok/s | 88.33 tok/s | | 4 | 12,24,36 | 6,144 | 10.82 GiB | **2.71 GiB** | 110.7 tok/s | 101.28 / 104.45 tok/s | - **Per card the cache falls 8.37 → 6.02 → 2.71 GiB**, which is faster than the card count grows, so **four cards end up with less total cache than two** (10.82 against 12.03 GiB, 6,144 against 6,691 slots). Both split rows carry `--trim-stage-weights`; on two cards the flag made no difference at all (6,691 / 12.03 GiB either way), so it cannot be what makes the 4-card figure smaller. - Decode from one card to four is **1.19x to 1.23x** (wall) and **1.20x** (engine); one card to two is 1.03x. The one-card path is not a layer split, so this is the comparison a user faces rather than a clean scaling efficiency. **Question 1:** is the per-card cache falling that fast expected? `--trim-stage-weights` should leave each card holding only its own layers' dense weights, i.e. *less* per card as cards are added, not more. A fixed per-card cost (prompt buffers, context, buffers) explains the direction, but the step from 6.02 to 2.71 GiB per card between two and four cards is what I cannot account for. ### 2. `--prefill 1024` frees the prompt buffers, and the cache does not take the VRAM Same 4-card configuration, only `--prefill` changed. Both blocks below are from the engine's own log. **`--prefill auto`:** ``` strata serve: the prompt path borrows 2011 CUDA0 cache slots (3.53 GiB) strata serve: CUDA1 prompt path borrows 1909 of its 6144 slots (3.53 GiB) strata serve: CUDA2 prompt path borrows 1775 of its 6144 slots (3.54 GiB) strata serve: CUDA3 prompt path borrows 1720 of its 5743 slots (3.54 GiB) ``` **`--prefill 1024`:** ``` strata serve: CUDA0 keeps its own prompt buffers (0.90 GiB of 3.21 GiB free): no loan strata serve: CUDA1 keeps its own prompt buffers (0.90 GiB of 2.68 GiB free): no loan strata serve: CUDA2 prompt path borrows 454 of its 6144 slots (0.90 GiB) strata serve: CUDA3 prompt path borrows 444 of its 5743 slots (0.90 GiB) strata serve: CUDA0: 2042 MiB of VRAM free with everything loaded strata serve: CUDA1: 1502 MiB of VRAM free with everything loaded ``` | `--prefill` | Prompt buffers, per card | Experts cached | Cache VRAM | VRAM free with everything loaded | |---|---:|---:|---:|---:| | `auto` | 3.53 GiB | 6,144 | 10.82 GiB | — (not logged in that session) | | `1024` | **0.90 GiB** | **6,144** | **10.82 GiB** | **2,042 MiB (CUDA0) / 1,502 MiB (CUDA1)** | `--prefill 1024` works and does what the help says: the buffers fall from 3.53 to 0.90 GiB per card, about 10.5 GiB across four cards. **The expert cache stays at exactly 6,144 slots / 10.82 GiB, and about 1.5-2 GB per card is left free.** Decode is unchanged (101.09 against 101.28 tok/s wall, within run-to-run spread). **Question 2:** is `--expert-cache auto` meant to grow into VRAM freed this way? If it sizes the cache before the prompt buffers are known, could it re-size (or take the freed room on the next start) — and if not, is `--expert-cache N` the supported way to use that headroom on a layer split? ### 3. `"parallel": 2` works on a 4-stage layer split `docs/BATCHING.md` says "Only a layer split of two stages on two GPUs has been run." On this 4-stage split, with the top-level `"parallel": 2`, `GET /props` reported `total_slots` 2 and one session gave: | Clients | Aggregate | Per stream | |---|---:|---:| | 1 | 86.0 tok/s | 86.0 | | **2** | **130.2 tok/s (+51%)** | 65.5 | | **4** | **140.6 tok/s (+63%)** | 68.1 | All three rows come from the same session, so this is a within-configuration comparison. `--trim-stage-weights` also does what its help says on four cards: **97.7 → 110.8 tok/s** engine (90.18 → 101 tok/s wall), i.e. **+13.4%**, reproduced with the flag and with `STRATA_STAGE_TRIM=1` alike. ### 4. A note on headroom In sessions with `--prefill auto` the engine logs `only 459 MiB of VRAM free at the start of this request (below 512 MiB)` and warns that decode can fall to a few tok/s (#2065), recommending `--vram-reserve-mib 768`. `--prefill 1024` avoids that entirely (2,042 MiB free). If the default is meant to keep ≥512 MiB, it may be worth either reserving more in `--expert-cache auto` or suggesting the smaller chunk in that warning. ### Validation Passed — on this box with `--kv int8 --kv-resident 32768 --max-context 131072`, MTP `--spec 4 --spec-min-p 0.5`: 1. Engine starts and serves on 1, 2 and 4 cards; `GET /health` 200 and `GET /v1/models` after each start. 2. Every cache figure is from the start line `filling the GPU's expert cache (N experts, X GiB)`; every VRAM figure is `nvidia-smi` right after `ready:`. 3. The engine's received argv was confirmed in its own log (`engine started: …`) for each session quoted, so the flags discussed were actually passed. 4. `--trim-stage-weights`: 97.7 against 110.8 tok/s engine on the same 4-card config with the flag removed; on 2 cards the flag changed the cache by 0 slots. 5. `"parallel": 2`: `GET /props` `total_slots` 2, clients 1 / 2 / 4 in one session. 6. Answer quality, GSM8K test split, first 200 questions, temperature 0, thinking off: **96.50%** without `--trim-stage-weights`, **96.00%** with it. One question apart, one run each; at this model size that test is close to saturated, so it rules out a large quality change rather than a small one. Failed — none. Not run — vision (`--vision no` throughout), context above 131,072, and the all-cards split engine, which refuses on four 16 GB cards with `each card needs about 21 GiB, has 15 GiB free` (expected for this model size; noted only for completeness). ### Logs **1 card** — GPU0 15,269 MiB ``` [strata] experts loaded: 46.84 GiB at 2.46 GiB/s (54 s so far) [strata] filling the GPU's expert cache (4388 experts, 8.37 GiB of VRAM) ... ready: http://127.0.0.1:18181/v1 (OpenAI: /v1/chat/completions, Anthropic: /v1/messages, context 131072 tokens) ``` **2 cards, split 24, `--trim-stage-weights`** — 15,231 / 15,361 MiB ``` [strata] layer split across GPUs [0, 1] (24) [strata] experts loaded: 46.84 GiB at 3.01 GiB/s (104 s so far) [strata] filling the GPU's expert cache (6691 experts, 12.03 GiB of VRAM) ... ready: http://127.0.0.1:18181/v1 (OpenAI: /v1/chat/completions, Anthropic: /v1/messages, context 131072 tokens) ``` **4 cards, split 12,24,36, `--trim-stage-weights`, `--prefill auto`** — 12,911 / 13,451 / 14,377 / 15,361 MiB ``` [strata] layer split across GPUs [0, 1, 2, 4] (12,24,36) [strata] experts loaded: 46.84 GiB at 3.86 GiB/s (58 s so far) [strata] filling the GPU's expert cache (6144 experts, 10.82 GiB of VRAM) ... ready: http://127.0.0.1:18181/v1 (OpenAI: /v1/chat/completions, Anthropic: /v1/messages, context 131072 tokens) ``` **4 cards, `--trim-stage-weights`, `--prefill 1024`** — 13,847 / 14,387 / 14,371 / 15,355 MiB ``` [strata] filling the GPU's expert cache (6144 experts, 10.82 GiB of VRAM) ... [strata serve] CUDA0 keeps its own prompt buffers (0.90 GiB of 3.21 GiB free): no loan [strata serve] CUDA0: 2042 MiB of VRAM free with everything loaded ready: http://127.0.0.1:18181/v1 (OpenAI: /v1/chat/completions, Anthropic: /v1/messages, context 131072 tokens) ``` **4 cards, `"parallel": 2`** — same cache; `total_slots` 2 ``` [strata] layer split across GPUs [0, 1, 2, 4] (12,24,36) [strata] filling the GPU's expert cache (6144 experts, 10.82 GiB of VRAM) ... ready: http://127.0.0.1:18181/v1 (OpenAI: /v1/chat/completions, Anthropic: /v1/messages, context 131072 tokens) ``` Happy to attach the complete logs, including the per-request `done:` lines — say which.
Author
Owner

@udqe commented on GitHub (Nov 7, 2026):

Not a four-card story, but both mechanisms you flag run on a two-card pair and this box carries the same log lines; numbers below, verbatim where the engine prints them.

Our shape. 2x RTX 4090 (Ada, sm_89) Windows 11, main engine 0.1.57, fixed --layer-split 22, --expert-cache auto, --prefill auto (chunk reads 8192), two quant arms on the same machine: UD-IQ4_XS-v31 and UD-Q4_K_XL. Different quants and cards from yours, so slot bytes differ - counts and lines, no GiB conversions across quants.

Q2 first, because our box has a knob that settles half of it. The borrow mechanism is exactly present on two cards (IQ4_XS boot, engine's own lines):

strata serve: the prompt path borrows 1908 CUDA0 cache slots (4.21 GiB)
strata serve: CUDA1 prompt path borrows 1786 of its 7126 slots (4.21 GiB)
strata serve: 1704 MiB of VRAM free with everything loaded
strata serve: CUDA1: 1060 MiB of VRAM free with everything loaded

and the Q4_K_XL arm on the same rig borrows 3.85 GiB per card (1316/1321 slots), free 1862/1024 MiB. Two facts this box can pin:

  1. auto does grow the cache into VRAM freed before sizing time. We run an explicit reserve (--vram-reserve-mib 2304 down to 2048 was a deliberate experiment, one variable per boot): 2304 -> 2048 moved the expert cache 5,774 -> 5,867 slots on the IQ4 arm (+93), no WARNING: only ... slots line, quality suite unaffected. So freed VRAM that exists when the search runs is taken - your observation that 2,042/1,502 MiB sit idle is therefore about when the buffer reservation is decided, not about the search being unable to grow at all.
  2. We cannot confirm your ordering hypothesis from here because we never lowered --prefill - chunk 8192 is tuned for our prompt rates (295K cold reads at 75.5 s, 3,908 t/s on this build), and your table shows what giving that up costs. On our box the buffers are paid for out of cache slots (the borrow above: 1,908 slots off CUDA0), so --prefill 1024 would plausibly hand those slots straight back to the cache rather than create the idle-VRAM state you saw - the idle-with-everything-loaded lines look like a four-stage interaction, not a two-stage one.

Q1, the per-card cache question, two-card analogue. Same machine, three fresh boots, only --layer-split varied (20 / 22 / 24): 5,937 / 5,867 / 5,777 slots - a gentle, near-monotone drift of +/-1% per step with the weight balance, no cliff, and the borrow (27% of CUDA1's slots on IQ4) is symmetric across the two cards. So the super-linear fall you measured (8.37 -> 6.02 -> 2.71 GiB per card) has no two-stage counterpart at 16,311 MiB-class cards; whatever charges the stages their cache as cards are added, it looks like it scales with the stage count, not with the pair.

Q3. Nothing to add - we are two-stage with --pipeline-windows 2, a different knob; if a second stream on a two-stage split halves per-card latency headroom, our 1,704/1,060 MiB free would be the first place it shows, and it is already spent by design (that is our --vram-reserve-mib 2048 + --vram-reserve-later-mib 972, adopted deliberately after a WARN-gated sweep).

All quoted lines are from this box's engine logs (boots timestamped in our notes); the split sweep is three same-machine boots, one variable each.

(ai-assisted; all lines pinned in our notes; happy to rerun any arm)

<!-- gh-comment-id:6706433704 --> @udqe commented on GitHub (Nov 7, 2026): Not a four-card story, but both mechanisms you flag run on a two-card pair and this box carries the same log lines; numbers below, verbatim where the engine prints them. **Our shape.** 2x RTX 4090 (Ada, sm_89) Windows 11, main engine 0.1.57, fixed `--layer-split 22`, `--expert-cache auto`, `--prefill auto` (chunk reads 8192), two quant arms on the same machine: UD-IQ4_XS-v31 and UD-Q4_K_XL. Different quants and cards from yours, so slot bytes differ - counts and lines, no GiB conversions across quants. **Q2 first, because our box has a knob that settles half of it.** The borrow mechanism is exactly present on two cards (IQ4_XS boot, engine's own lines): ``` strata serve: the prompt path borrows 1908 CUDA0 cache slots (4.21 GiB) strata serve: CUDA1 prompt path borrows 1786 of its 7126 slots (4.21 GiB) strata serve: 1704 MiB of VRAM free with everything loaded strata serve: CUDA1: 1060 MiB of VRAM free with everything loaded ``` and the Q4_K_XL arm on the same rig borrows 3.85 GiB per card (1316/1321 slots), free 1862/1024 MiB. Two facts this box can pin: 1. **`auto` does grow the cache into VRAM freed before sizing time.** We run an explicit reserve (`--vram-reserve-mib 2304` down to `2048` was a deliberate experiment, one variable per boot): 2304 -> 2048 moved the expert cache 5,774 -> 5,867 slots on the IQ4 arm (+93), no `WARNING: only ... slots` line, quality suite unaffected. So freed VRAM that exists when the search runs is taken - your observation that 2,042/1,502 MiB sit idle is therefore about *when* the buffer reservation is decided, not about the search being unable to grow at all. 2. **We cannot confirm your ordering hypothesis from here** because we never lowered `--prefill` - chunk 8192 is tuned for our prompt rates (295K cold reads at 75.5 s, 3,908 t/s on this build), and your table shows what giving that up costs. On our box the buffers are *paid for out of cache slots* (the borrow above: 1,908 slots off CUDA0), so `--prefill 1024` would plausibly hand those slots straight back to the cache rather than create the idle-VRAM state you saw - the idle-with-everything-loaded lines look like a four-stage interaction, not a two-stage one. **Q1, the per-card cache question, two-card analogue.** Same machine, three fresh boots, only `--layer-split` varied (20 / 22 / 24): **5,937 / 5,867 / 5,777 slots** - a gentle, near-monotone drift of +/-1% per step with the weight balance, no cliff, and the borrow (27% of CUDA1's slots on IQ4) is symmetric across the two cards. So the super-linear fall you measured (8.37 -> 6.02 -> 2.71 GiB per card) has no two-stage counterpart at 16,311 MiB-class cards; whatever charges the stages their cache as cards are added, it looks like it scales with the stage count, not with the pair. **Q3.** Nothing to add - we are two-stage with `--pipeline-windows 2`, a different knob; if a second stream on a two-stage split halves per-card latency headroom, our 1,704/1,060 MiB free would be the first place it shows, and it is already spent by design (that is our `--vram-reserve-mib 2048` + `--vram-reserve-later-mib 972`, adopted deliberately after a WARN-gated sweep). All quoted lines are from this box's engine logs (boots timestamped in our notes); the split sweep is three same-machine boots, one variable each. (ai-assisted; all lines pinned in our notes; happy to rerun any arm)
Author
Owner

@sean640112 commented on GitHub (Nov 7, 2026):

Retracting this report, and replacing it with a smaller one that is actually true.

Both questions came from an arithmetic error on my side. Two things I should have checked before filing:

  • the expert cache N slots, X GiB line I quoted in §1/§2 is CUDA0's own figure, not a total — I divided it by the card count to get "per card";
  • layer_split 12,24,36 is a value I had set myself, not the project's default. setup.py:2424 writes cfg["layer_split"] = cfg.get("layer_split") or "auto".

What was wrong

I reported the boot lines say
per-card cache 8.37 → 6.02 → 2.71 GiB as cards are added those were CUDA0's GiB divided by the card count. CUDA0 is 8.37 → 12.03 → 10.82
four cards hold less cache than two totals are 4,388 / 11,970 / 24,175 slots for 1 / 2 / 4 cards — monotonic
--prefill 1024 frees 2.6 GiB per card and the cache ignores it the prompt-path borrow is 3.53 GiB per card with and without the trim flag; the freed VRAM comes from --trim-stage-weights, and the cards are then at their layer allowance, with nothing left to place

The arithmetic check that settles the first row: 21,144 / 24,576 = 86.0% and 24,175 / 24,576 = 98.4%, which are exactly the residency figures the engine prints on those boots. The allowance is the experts of the layers a card owns — layers 12-23 … 6144 of its 6144 profiled pairs on four cards is layers 24-47 … 12288 of its 12288 on two, so 12 × 512 versus 24 × 512.

What is left worth reporting

Four 5060 Ti 16 GB, IQ3_S, engine's own tok/s on one 320-token request, 5 requests per boot:

layer_split layers per card tok/s (median) last card free
12,24,36 (what I had set) 12/12/12/12 96.3 528 MiB
auto (what setup writes) 11/13/13/11 100.6 528 MiB
13,25,37 13/12/12/11 102.0 528 MiB
14,26,38 14/12/12/10 102.7 1,646 MiB
13,26,39 (amd_four_card.LAYER_SPLIT) 13/13/13/9 97.5 —
15,27,39 15/12/12/9 98.6 —

The 12,24,36 row is two separate boots (96.4 and 96.3) to rule out ordering or warm-up.

  1. auto is 4.5% faster than the flat split I had been using. Whatever the search is doing, it is a good default and my report should have compared against it first.
  2. auto still ends with the last card at 528 MiB free while the first card has 1,248 MiB. The last card also carries the output head and the draft layer, and strata_control/amd_four_card.py says exactly that — LAYER_SPLIT = "13,26,39", commented "the last card also holds the output head, so it takes fewer layers" — but the profile is gated to backend == "hip". Applying the same idea by hand (14/12/12/10) puts 1,646 MiB free on that card and is 2.1% faster than auto on a single boot each, so I would treat that as a hint rather than a result.

Questions

  1. On CUDA, is auto the intended path for four cards, and is 528 MiB free on the last stage expected given the head and the draft layer live there? It comes out the same for every split I tried, including auto.
  2. Is the amd_four_card heuristic meant to be hardware-agnostic? On this rig the exact constant 13/13/13/9 is 3.1% slower than auto while 14/12/12/10 is 2.1% faster, which reads less like "the last card takes fewer layers" and more like "balance the free VRAM across the stages". If that is the real rule, is there a supported way to express it?

What stands from the original report

  • --trim-stage-weights: expert residency 86% → 98.4%, engine 97.7 → 110.8 tok/s (+13.4%) on the 12/12/12/12 split.
  • "parallel": 2 on a four-stage split: aggregate 86.0 → 130.2 → 140.6 tok/s at concurrency 1/2/4 (+63%), where docs/BATCHING.md only covers two stages on two GPUs.

Apologies for the noise, and thanks to @udqe — their two-stage sweep in #5265 is what sent me back to the per-card lines, where the mistake was visible immediately. The rig is free on demand if any of the above is worth re-running.

<!-- gh-comment-id:6708964671 --> @sean640112 commented on GitHub (Nov 7, 2026): **Retracting this report, and replacing it with a smaller one that is actually true.** Both questions came from an arithmetic error on my side. Two things I should have checked before filing: - the `expert cache N slots, X GiB` line I quoted in §1/§2 is **CUDA0's own figure, not a total** — I divided it by the card count to get "per card"; - `layer_split 12,24,36` is a value **I had set myself**, not the project's default. `setup.py:2424` writes `cfg["layer_split"] = cfg.get("layer_split") or "auto"`. ### What was wrong | I reported | the boot lines say | |---|---| | per-card cache 8.37 → 6.02 → 2.71 GiB as cards are added | those were CUDA0's GiB divided by the card count. CUDA0 is 8.37 → 12.03 → 10.82 | | four cards hold less cache than two | totals are 4,388 / 11,970 / 24,175 slots for 1 / 2 / 4 cards — monotonic | | `--prefill 1024` frees 2.6 GiB per card and the cache ignores it | the prompt-path borrow is 3.53 GiB per card with and without the trim flag; the freed VRAM comes from `--trim-stage-weights`, and the cards are then at their layer allowance, with nothing left to place | The arithmetic check that settles the first row: 21,144 / 24,576 = **86.0%** and 24,175 / 24,576 = **98.4%**, which are exactly the residency figures the engine prints on those boots. The allowance is the experts of the layers a card owns — `layers 12-23 … 6144 of its 6144 profiled pairs` on four cards is `layers 24-47 … 12288 of its 12288` on two, so 12 × 512 versus 24 × 512. ### What is left worth reporting Four 5060 Ti 16 GB, IQ3_S, engine's own tok/s on one 320-token request, 5 requests per boot: | `layer_split` | layers per card | tok/s (median) | last card free | |---|---|---:|---:| | `12,24,36` (what I had set) | 12/12/12/12 | 96.3 | 528 MiB | | `auto` (what setup writes) | 11/13/13/11 | 100.6 | 528 MiB | | `13,25,37` | 13/12/12/11 | 102.0 | 528 MiB | | `14,26,38` | 14/12/12/10 | **102.7** | 1,646 MiB | | `13,26,39` (`amd_four_card.LAYER_SPLIT`) | 13/13/13/9 | 97.5 | — | | `15,27,39` | 15/12/12/9 | 98.6 | — | The `12,24,36` row is two separate boots (96.4 and 96.3) to rule out ordering or warm-up. 1. **`auto` is 4.5% faster than the flat split I had been using.** Whatever the search is doing, it is a good default and my report should have compared against it first. 2. **`auto` still ends with the last card at 528 MiB free** while the first card has 1,248 MiB. The last card also carries the output head and the draft layer, and `strata_control/amd_four_card.py` says exactly that — `LAYER_SPLIT = "13,26,39"`, commented "the last card also holds the output head, so it takes fewer layers" — but the profile is gated to `backend == "hip"`. Applying the same idea by hand (14/12/12/10) puts 1,646 MiB free on that card and is 2.1% faster than `auto` on a single boot each, so I would treat that as a hint rather than a result. ### Questions 1. On CUDA, is `auto` the intended path for four cards, and is 528 MiB free on the last stage expected given the head and the draft layer live there? It comes out the same for every split I tried, including `auto`. 2. Is the `amd_four_card` heuristic meant to be hardware-agnostic? On this rig the exact constant 13/13/13/9 is **3.1% slower** than `auto` while 14/12/12/10 is 2.1% faster, which reads less like "the last card takes fewer layers" and more like "balance the free VRAM across the stages". If that is the real rule, is there a supported way to express it? ### What stands from the original report - `--trim-stage-weights`: expert residency 86% → 98.4%, engine 97.7 → 110.8 tok/s (+13.4%) on the 12/12/12/12 split. - `"parallel": 2` on a four-stage split: aggregate 86.0 → 130.2 → 140.6 tok/s at concurrency 1/2/4 (+63%), where `docs/BATCHING.md` only covers two stages on two GPUs. Apologies for the noise, and thanks to @udqe — their two-stage sweep in #5265 is what sent me back to the per-card lines, where the mistake was visible immediately. The rig is free on demand if any of the above is worth re-running.
Author
Owner

@sean640112 commented on GitHub (Nov 7, 2026):

@udqe — replying to your two points directly; the report itself is corrected in the comment above.

Your reserve experiment holds up here. --expert-cache 8000 is refused per card on this rig: … leaves no room for the prompt path's buffers (0 MiB) and the 700 MiB reserve on CUDA0: 5380 slots instead, and 5554 with --vram-reserve-mib 256. Your +93 slots from 256 MiB and my +174 from the same move are the same effect, seen on four cards instead of two.

But the freed-VRAM rule did not apply, for a boring reason: there was nothing left to place. The allowance per card is the experts of the layers that card owns — 6144 of its 6144 profiled pairs on four cards is 12288 of its 12288 on two. With --trim-stage-weights, three of the four cards are already at that ceiling, so the ~2.5 GiB left free cannot become cache. My "2 GB idle" was real, but it was not the allocator declining to use it.

Your 20/22/24 sweep was the control I was missing. It is what sent me back to the per-card lines, where the mistake turned out to be mine: the expert cache N slots, X GiB line is CUDA0's own figure, not a total, and I had divided it by the card count. There is no per-card cliff — totals are 4,388 / 11,970 / 24,175 slots for 1 / 2 / 4 cards. You were right that the curve should not behave the way I described.

One question I cannot answer from my side: on four cards, every split I tried — including auto, which picks 11/13/13/11 — leaves the last stage at 528 MiB free while the first has 1,248 MiB, and that stage also carries the output head and the draft layer. If you know a line that prints the last stage's non-expert allocations, it would close the last gap. Thanks for the time you put into this.

<!-- gh-comment-id:6708964871 --> @sean640112 commented on GitHub (Nov 7, 2026): @udqe — replying to your two points directly; the report itself is corrected in the comment above. **Your reserve experiment holds up here.** `--expert-cache 8000` is refused per card on this rig: `… leaves no room for the prompt path's buffers (0 MiB) and the 700 MiB reserve on CUDA0: 5380 slots instead`, and `5554` with `--vram-reserve-mib 256`. Your +93 slots from 256 MiB and my +174 from the same move are the same effect, seen on four cards instead of two. **But the freed-VRAM rule did not apply, for a boring reason: there was nothing left to place.** The allowance per card is the experts of the layers that card owns — `6144 of its 6144 profiled pairs` on four cards is `12288 of its 12288` on two. With `--trim-stage-weights`, three of the four cards are already at that ceiling, so the ~2.5 GiB left free cannot become cache. My "2 GB idle" was real, but it was not the allocator declining to use it. **Your 20/22/24 sweep was the control I was missing.** It is what sent me back to the per-card lines, where the mistake turned out to be mine: the `expert cache N slots, X GiB` line is CUDA0's own figure, not a total, and I had divided it by the card count. There is no per-card cliff — totals are 4,388 / 11,970 / 24,175 slots for 1 / 2 / 4 cards. You were right that the curve should not behave the way I described. One question I cannot answer from my side: on four cards, every split I tried — including `auto`, which picks 11/13/13/11 — leaves the last stage at 528 MiB free while the first has 1,248 MiB, and that stage also carries the output head and the draft layer. If you know a line that prints the last stage's non-expert allocations, it would close the last gap. Thanks for the time you put into this.
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#3577
No description provided.