[GH-ISSUE #4041] [Engine] Layer split auto picks K=32 on 2x RTX 3090 (x16 + x4); K=28 decodes ~10.5% faster at equal acceptance (0.2.2 re-test of #2418) #1746

Closed
opened 2026-11-04 01:53:42 +07:00 by bsakaguchi · 4 comments
Owner

Originally created by @cjmckenna on GitHub (Oct 25, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/4041

A re-test of #2418 on 0.2.2, as the tracker reset asked. The auto split still lands off the best placement on an x16 + x4 pair. Pinning "layer_split": "28" makes decode about 10.5% faster with prompt reads unchanged.

Hardware. 2x RTX 3090 24 GB (sm_86). CUDA0 on the CPU's PCIe 4.0 x16 slot (startup probe 25.6 GB/s); CUDA1 on the CPU's M.2 slot through an OCuLink adapter, PCIe 4.0 x4 (probe 6.3 GB/s). i7-11700KF (8 cores, 7 pool workers), 121 GiB DDR4-3200, Ubuntu 26.04, CUDA 13.3.

Software and config. Strata 0.2.2 (engine 0.1.47) plus PR #3382. Qwen3.8-Flash-Next IQ3_S native pack, --kv int8 --kv-resident 32768, max context 262144, --spec 4 --spec-min-p 0.5 with the MTP layer, parallel 2 with --batch-mtp --batch-groups 1, conversation cache 16 GiB / 10 slots, --short-read 256. layer_split: "auto" picks K=32: CUDA1 runs layers 32-47, and the start line reports link 6.3 GB/s -> miss cost x4.08.

What we saw first. On real traffic, averaged over 168,065 batch decode windows (two requests at once), a window took 21.0 ms. The CUDA0 stage was 9.88 ms of GPU work plus 2.62 ms waiting on CPU-computed expert misses (layers 0-31, 9,108 cache slots, about 285 per layer). The CUDA1 stage was 5.91 ms plus 0.12 ms (layers 32-47, 7,832 slots, about 490 per layer). Nearly all the CPU stall was on CUDA0's side.

Test. Idle server. One restart per arm with "layer_split" pinned, everything else the same. Per arm: solo decode of up to 2,000 tokens after 16K, 98K and 160K-token code prompts, cold and then warm; two concurrent ~90K decodes; cold reads of 30K, 97K and 170K tokens; warm multi-turn follow-ups of +300, +600 and +1,000 tokens. Requests carry no sampling fields (the server's shared defaults, temperature 0.6). Decode is compared at equal draft acceptance and context with a least-squares fit (tok/s ~ arm + acceptance + context), because acceptance moved decode by about 1.1-1.4 tok/s per 0.01 in these runs. Two sweeps on the same evening; the K=32 anchor reproduced (127.7 vs 128.3 tok/s, cold reads within 1%).

K (first layer on CUDA1) decode vs K=32, equal acceptance two requests (tok/s) cold read 30K / 97K / 170K (s) warm follow-ups, total (s)
32 (auto) — 107-108 10.5 / 30.3 / 56.2 11.3
30 +5.3% ± 0.9 111 10.7 / 29.8 / 54.4 10.8
29 +8.0% ± 0.9 118 10.7 / 29.9 / 54.1 11.9
28 +10.4% ± 0.9 / +10.7% ± 1.2 (two sweeps) 111-117 11.7 / 31.3 / 56.5 10.8
27 +13.4% ± 1.3 116 12.6 / 34.5 / 63.0 12.1
26 +14.2% ± 1.2 120 13.0 / 36.5 / 66.5 11.8
25 +15.1% ± 1.2 117 13.9 / 38.9 / 70.9 12.1

Past K=28 decode keeps improving, but more slowly, while cold reads get 12-32% slower (and warm follow-ups about 5-10%). Weighted by where our real traffic spends engine time (decode 67%, warm reads 27%, cold reads 6%), K=28 comes out best at about -7.5%. We run K=28 in production now.

What the code suggests (unconfirmed static reading, not measured). The split model sums the stages' costs and prices CUDA1's misses with the link-scaling rule from #2007, which switches on at a 4x bandwidth gap (split_rules.hpp); our gap is 25.6/6.3 = 4.06x. But in decode most misses on either card are computed by the CPU pool, not streamed over the link: per window here the routed experts were 96.5% VRAM, 0.7% PCIe and 2.8% CPU. So pricing CUDA1's decode misses by its link would over-price them, and push layers (and cache pressure) onto CUDA0. A small change in the startup probe can also flip the choice, since we sit just above the threshold. STRATA_SPLIT_UNIFORM=1 is the existing opt-out; we have not measured what auto picks with it.

What we did not test. Equal cards or three or more GPUs; a single GPU; other models or packs; STRATA_SPLIT_UNIFORM=1 with auto; --trim-stage-weights; quality beyond draft acceptance (a different split changes which experts are resident, so outputs can differ in rounding). One run per arm per sweep.

Question. Would a change that prices decode misses by where they are actually computed (the CPU pool's measured time per expert, as the single-GPU PCIe-share rule already does) rather than by the link be welcome as an opt-in PR? Or would you rather adjust the 4x rule? We can measure a candidate on this box.

Developed with an AI coding assistant; every number above was measured on the machine described here.

Originally created by @cjmckenna on GitHub (Oct 25, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/4041 A re-test of #2418 on 0.2.2, as the tracker reset asked. The auto split still lands off the best placement on an x16 + x4 pair. Pinning `"layer_split": "28"` makes decode about 10.5% faster with prompt reads unchanged. **Hardware.** 2x RTX 3090 24 GB (sm_86). CUDA0 on the CPU's PCIe 4.0 x16 slot (startup probe 25.6 GB/s); CUDA1 on the CPU's M.2 slot through an OCuLink adapter, PCIe 4.0 x4 (probe 6.3 GB/s). i7-11700KF (8 cores, 7 pool workers), 121 GiB DDR4-3200, Ubuntu 26.04, CUDA 13.3. **Software and config.** Strata 0.2.2 (engine 0.1.47) plus PR #3382. Qwen3.8-Flash-Next IQ3_S native pack, `--kv int8 --kv-resident 32768`, max context 262144, `--spec 4 --spec-min-p 0.5` with the MTP layer, `parallel` 2 with `--batch-mtp --batch-groups 1`, conversation cache 16 GiB / 10 slots, `--short-read 256`. `layer_split: "auto"` picks K=32: CUDA1 runs layers 32-47, and the start line reports `link 6.3 GB/s -> miss cost x4.08`. **What we saw first.** On real traffic, averaged over 168,065 batch decode windows (two requests at once), a window took 21.0 ms. The CUDA0 stage was 9.88 ms of GPU work plus 2.62 ms waiting on CPU-computed expert misses (layers 0-31, 9,108 cache slots, about 285 per layer). The CUDA1 stage was 5.91 ms plus 0.12 ms (layers 32-47, 7,832 slots, about 490 per layer). Nearly all the CPU stall was on CUDA0's side. **Test.** Idle server. One restart per arm with `"layer_split"` pinned, everything else the same. Per arm: solo decode of up to 2,000 tokens after 16K, 98K and 160K-token code prompts, cold and then warm; two concurrent ~90K decodes; cold reads of 30K, 97K and 170K tokens; warm multi-turn follow-ups of +300, +600 and +1,000 tokens. Requests carry no sampling fields (the server's shared defaults, temperature 0.6). Decode is compared at equal draft acceptance and context with a least-squares fit (tok/s ~ arm + acceptance + context), because acceptance moved decode by about 1.1-1.4 tok/s per 0.01 in these runs. Two sweeps on the same evening; the K=32 anchor reproduced (127.7 vs 128.3 tok/s, cold reads within 1%). | K (first layer on CUDA1) | decode vs K=32, equal acceptance | two requests (tok/s) | cold read 30K / 97K / 170K (s) | warm follow-ups, total (s) | |---|---|---|---|---| | 32 (auto) | — | 107-108 | 10.5 / 30.3 / 56.2 | 11.3 | | 30 | +5.3% ± 0.9 | 111 | 10.7 / 29.8 / 54.4 | 10.8 | | 29 | +8.0% ± 0.9 | 118 | 10.7 / 29.9 / 54.1 | 11.9 | | **28** | **+10.4% ± 0.9 / +10.7% ± 1.2** (two sweeps) | 111-117 | 11.7 / 31.3 / 56.5 | 10.8 | | 27 | +13.4% ± 1.3 | 116 | 12.6 / 34.5 / 63.0 | 12.1 | | 26 | +14.2% ± 1.2 | 120 | 13.0 / 36.5 / 66.5 | 11.8 | | 25 | +15.1% ± 1.2 | 117 | 13.9 / 38.9 / 70.9 | 12.1 | Past K=28 decode keeps improving, but more slowly, while cold reads get 12-32% slower (and warm follow-ups about 5-10%). Weighted by where our real traffic spends engine time (decode 67%, warm reads 27%, cold reads 6%), K=28 comes out best at about -7.5%. We run K=28 in production now. **What the code suggests (unconfirmed static reading, not measured).** The split model sums the stages' costs and prices CUDA1's misses with the link-scaling rule from #2007, which switches on at a 4x bandwidth gap (`split_rules.hpp`); our gap is 25.6/6.3 = 4.06x. But in decode most misses on either card are computed by the CPU pool, not streamed over the link: per window here the routed experts were 96.5% VRAM, 0.7% PCIe and 2.8% CPU. So pricing CUDA1's decode misses by its link would over-price them, and push layers (and cache pressure) onto CUDA0. A small change in the startup probe can also flip the choice, since we sit just above the threshold. `STRATA_SPLIT_UNIFORM=1` is the existing opt-out; we have not measured what auto picks with it. **What we did not test.** Equal cards or three or more GPUs; a single GPU; other models or packs; `STRATA_SPLIT_UNIFORM=1` with auto; `--trim-stage-weights`; quality beyond draft acceptance (a different split changes which experts are resident, so outputs can differ in rounding). One run per arm per sweep. **Question.** Would a change that prices decode misses by where they are actually computed (the CPU pool's measured time per expert, as the single-GPU PCIe-share rule already does) rather than by the link be welcome as an opt-in PR? Or would you rather adjust the 4x rule? We can measure a candidate on this box. Developed with an AI coding assistant; every number above was measured on the machine described here.
Author
Owner

@coryjett commented on GitHub (Oct 28, 2026):

A counter-datapoint from a symmetric pair, in case it helps pin down what auto should key on: 2x RTX 3090 both on PCIe 3.0 x16 (start-up probes 7.8-9.4 GB/s each, one card per socket of a 2x Xeon E5-2620 v3), Flash-Next IQ3_S, 0.2.7 / engine 0.1.52, --trim-stage-weights, --expert-cache auto, MTP --spec 4. Auto picks K=25 here. One change per arm against the same base (3 runs each):

layer_split (with trim) Short prompts, thinking off / on 32K read Decode after 32K
25 (= auto) +9.1% / +7.8% -3.1% +13.0%
23 +13.0% / +8.3% -12.2% +12.8%
27 +7.4% / +2.8% -10.0% +9.3%
21 +0.1% / +2.9% -16.9% +10.5%

(Percentages against the untrimmed base.) So with equal links auto's point was the best trade: the lower splits buy a little decode at a large cost on prompt reading. Your x16 + x4 pair moving the optimum to K=28 fits a link-aware rule rather than a count-based one. Raw data in #4468 (bench/results/2026-10-28-community-t630-2x3090-pcie3/), section 19 of the log quoted there.

<!-- gh-comment-id:6472754162 --> @coryjett commented on GitHub (Oct 28, 2026): A counter-datapoint from a symmetric pair, in case it helps pin down what auto should key on: 2x RTX 3090 both on PCIe 3.0 x16 (start-up probes 7.8-9.4 GB/s each, one card per socket of a 2x Xeon E5-2620 v3), Flash-Next IQ3_S, 0.2.7 / engine 0.1.52, `--trim-stage-weights`, `--expert-cache auto`, MTP `--spec 4`. Auto picks K=25 here. One change per arm against the same base (3 runs each): | `layer_split` (with trim) | Short prompts, thinking off / on | 32K read | Decode after 32K | |---|---|---|---| | 25 (= auto) | +9.1% / +7.8% | -3.1% | +13.0% | | 23 | +13.0% / +8.3% | -12.2% | +12.8% | | 27 | +7.4% / +2.8% | -10.0% | +9.3% | | 21 | +0.1% / +2.9% | -16.9% | +10.5% | (Percentages against the untrimmed base.) So with equal links auto's point was the best trade: the lower splits buy a little decode at a large cost on prompt reading. Your x16 + x4 pair moving the optimum to K=28 fits a link-aware rule rather than a count-based one. Raw data in #4468 (`bench/results/2026-10-28-community-t630-2x3090-pcie3/`), section 19 of the log quoted there.
Author
Owner

@cjmckenna commented on GitHub (Oct 28, 2026):

Thanks, this is useful, and I think it narrows the question rather than counters it.

Auto is already link-aware: since #2007 it scales a stage's miss cost by its link, but only when one link is at least 4x slower than the fastest (kLinkScaleMin = 4.0 in include/strata/program/split_rules.hpp; a symmetric rig keeps the fitted formula). On your pair (7.8-9.4 GB/s) that rule never fires, so your sweep tests the base formula, and it looks right: auto's K=25 was the best trade. On ours (25.6 vs 6.3 GB/s, a 4.06x gap) the rule fires, multiplies CUDA1's miss cost by 4.08, and moves auto from wherever the base formula would land to K=32, past the best point at K=28.

So the open question is not count-based vs link-aware, but how much the link should weigh in decode, where (on our box) 96.5% of routed experts were in VRAM, 0.7% came over PCIe and 2.8% ran on the CPU. That last part is from our engine log; the reading of how the rule prices it is unconfirmed static analysis.

One difference to keep in mind when comparing the tables: our sweep was 0.2.2 without --trim-stage-weights, yours is 0.2.7 with it. We have since moved production to 0.2.7 with trim and K=28, but have not re-swept the split under trim.

Next on our side, if useful: what auto picks on this box with STRATA_SPLIT_UNIFORM=1, and a short K=26/28/30/32 re-sweep on 0.2.7 with trim, so both data points are on the same release.

Developed with an AI coding assistant; every number above was measured on the machine described in the issue.

<!-- gh-comment-id:6473903577 --> @cjmckenna commented on GitHub (Oct 28, 2026): Thanks, this is useful, and I think it narrows the question rather than counters it. Auto is already link-aware: since #2007 it scales a stage's miss cost by its link, but only when one link is at least 4x slower than the fastest (`kLinkScaleMin = 4.0` in `include/strata/program/split_rules.hpp`; a symmetric rig keeps the fitted formula). On your pair (7.8-9.4 GB/s) that rule never fires, so your sweep tests the base formula, and it looks right: auto's K=25 was the best trade. On ours (25.6 vs 6.3 GB/s, a 4.06x gap) the rule fires, multiplies CUDA1's miss cost by 4.08, and moves auto from wherever the base formula would land to K=32, past the best point at K=28. So the open question is not count-based vs link-aware, but how much the link should weigh in decode, where (on our box) 96.5% of routed experts were in VRAM, 0.7% came over PCIe and 2.8% ran on the CPU. That last part is from our engine log; the reading of how the rule prices it is unconfirmed static analysis. One difference to keep in mind when comparing the tables: our sweep was 0.2.2 without `--trim-stage-weights`, yours is 0.2.7 with it. We have since moved production to 0.2.7 with trim and K=28, but have not re-swept the split under trim. Next on our side, if useful: what auto picks on this box with `STRATA_SPLIT_UNIFORM=1`, and a short K=26/28/30/32 re-sweep on 0.2.7 with trim, so both data points are on the same release. Developed with an AI coding assistant; every number above was measured on the machine described in the issue.
Author
Owner

@cjmckenna commented on GitHub (Oct 28, 2026):

Follow-up with both data points on the same release, as offered. Same box as the issue (2x RTX 3090, CUDA0 link 25.6 GB/s, CUDA1 6.3 GB/s), now Strata 0.2.7 with --trim-stage-weights, --batch 2 --batch-mtp, Qwen3.8-Flash-Next IQ3_S.

What auto picks on 0.2.7:

  • default (link rule fires, CUDA1 miss cost x4.08): K=29, with the engine's own near-tie note for K=32 (25.6 vs 25.9 ms predicted)
  • STRATA_SPLIT_UNIFORM=1: K=26

Pinned sweep, idle box, one restart per arm, order 28 26 30 32 28. Cold = six cold reads 17K-182K, mean vs K=28. Solo decode is a least-squares fit over six seeded runs per arm with draft acceptance as a covariate, since acceptance moved 0.65-0.85 between runs.

K Cold reads vs K=28 Solo decode vs K=28 (equal acceptance)
28 ref ref
26 +12.1% +2.5 tok/s (±1.1)
30 +1.6% -6.9 (±1.2)
32 +8.3% -11.0 (±1.1)
28 again +0.1% -0.2 (±1.2)

So on 0.2.7 with trim, auto lands at K=29, between our two best arms, and the link rule no longer costs us anything. The uniform pick decodes about 2% faster solo but reads prompts 12% slower, which is the trade the link rule exists to avoid on an asymmetric pair. Your symmetric result and ours fit the same picture: the base formula looks right, and the 4x rule now seems right-sized for our gap.

Developed with an AI coding assistant; every number above was measured on the machine described in the issue.

<!-- gh-comment-id:6483793084 --> @cjmckenna commented on GitHub (Oct 28, 2026): Follow-up with both data points on the same release, as offered. Same box as the issue (2x RTX 3090, CUDA0 link 25.6 GB/s, CUDA1 6.3 GB/s), now Strata 0.2.7 with `--trim-stage-weights`, `--batch 2 --batch-mtp`, Qwen3.8-Flash-Next IQ3_S. What auto picks on 0.2.7: - default (link rule fires, CUDA1 miss cost x4.08): **K=29**, with the engine's own near-tie note for K=32 (25.6 vs 25.9 ms predicted) - `STRATA_SPLIT_UNIFORM=1`: **K=26** Pinned sweep, idle box, one restart per arm, order 28 26 30 32 28. Cold = six cold reads 17K-182K, mean vs K=28. Solo decode is a least-squares fit over six seeded runs per arm with draft acceptance as a covariate, since acceptance moved 0.65-0.85 between runs. | K | Cold reads vs K=28 | Solo decode vs K=28 (equal acceptance) | |---|---|---| | 28 | ref | ref | | 26 | +12.1% | +2.5 tok/s (±1.1) | | 30 | +1.6% | -6.9 (±1.2) | | 32 | +8.3% | -11.0 (±1.1) | | 28 again | +0.1% | -0.2 (±1.2) | So on 0.2.7 with trim, auto lands at K=29, between our two best arms, and the link rule no longer costs us anything. The uniform pick decodes about 2% faster solo but reads prompts 12% slower, which is the trade the link rule exists to avoid on an asymmetric pair. Your symmetric result and ours fit the same picture: the base formula looks right, and the 4x rule now seems right-sized for our gap. Developed with an AI coding assistant; every number above was measured on the machine described in the issue.
Author
Owner

@Niko1221 commented on GitHub (Nov 5, 2026):

Thanks for taking the time to report this.

Strata has changed a lot since this was opened, and 0.2.11 is out now, so many older reports no longer apply. We're closing issues older than a week that have had no new reports in the last week. Closed here does not mean rejected.

To reopen it takes about two minutes:

  1. Re-test on 0.2.11. 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:6659882360 --> @Niko1221 commented on GitHub (Nov 5, 2026): Thanks for taking the time to report this. Strata has changed a lot since this was opened, and 0.2.11 is out now, so many older reports no longer apply. We're closing issues older than a week that have had no new reports in the last week. Closed here does not mean rejected. To reopen it takes about two minutes: 1. Re-test on 0.2.11. 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#1746
No description provided.