Skip to content

[Engine] strata-inkling: --layer-split auto splits by free VRAM only and puts 5 of the 12 looped core layers on the slower card (2 cards slower than 1; per-card counts 21,3 are 11% faster) #7030

Backlog

Description

@Norhiro

Area

[Engine]

Desktop app, Terminal or source?

Source (serve/server.py with the official strata-inkling 0.1.67 package from v0.2.21)

What happened

On an asymmetric pair (RTX 5060 Ti 16 GB + RTX 3060 12 GB), the automatic layer split for Inkling-2-Mini gives the second card L13..23. That includes L13..17, which are part of the looped core (core_start..core_end-1 = L6..17) and run 3 times per token. So the slower card does 21 of the 48 layer visits per token (44%).

With the automatic split, two cards are slower than the 5060 Ti alone, both in decode and in a 27K-token read. If I give the per-card counts by hand (--layer-split 21,3), the whole looped core stays on the 5060 Ti. The 3060 then does 3 of 48 visits. Decode is 11% faster than auto, and the 27K read is 29% faster than auto and 22% faster than one card.

Measured on v0.2.21 (official strata-inkling 0.1.67, Inkling-2-Mini-SQ-15.strata --max-context 32768 --kv fp8 --draft off, temperature 0, same session, one server start per row):

placement load log decode tok/s (6 short prompts) first token, 585 / 5,070 / 27,304-token prompt (s) 12 short questions
5060 Ti alone experts=3072 VRAM / 0 host 47.2-48.2 0.40 / 2.65 / 24.67 12/12
2 cards, --layer-split auto GPU1(L0..12,1664exp) GPU0(L13..23,1408exp) 40.9-42.1 0.64 / 4.34 / 26.90 12/12
2 cards, --layer-split 21,3 GPU1(L0..20,2688exp) GPU0(L21..23,384exp) 45.8-46.8 0.44 / 2.94 / 19.22 12/12

The engine numbers the 5060 Ti as GPU1 here (CUDA's default order is fastest first). The server config uses "gpu": [1, 0] and "gpu_order": "as_given", so the 5060 Ti is stage 0 in both 2-card rows. All experts are in VRAM in every row (0 host), so the difference is only where the layers are.

The pattern is the same on a v0.2.20 source build with #6958, #6960 and #6982 added. That build decodes faster, but the ratios are the same: one card 64.5-66.5 tok/s, auto 54.5-56.6, 21,3 62.7-64.6. In the 27K read, auto takes 33.98 s, one card 23.36 s and 21,3 20.33 s. Earlier I swept the split on that build: 18,6 gave 60.6-62.3 tok/s, 20,4 gave 61.6-63.4 and 21,3 gave 62.0-63.7. Each layer of the looped core that moved to the 5060 Ti helped.

Why (reading ink_runner.cuh, v0.2.21 = current main d46f5f2)

In the ls_active block, the branch commented Automatic VRAM-weighted partition gives each stage n_phys * usable[s] / tot_u layers. Here usable[s] is the stage's free VRAM minus its overhead. It then clamps later stages to what fits fully in VRAM. Two things it does not use:

  1. How often a layer runs. The 12 core layers run 3 times per token, and the 12 prelude/coda layers run once. The expert loader already knows this: the comment at vram_load_order says "3x looped core layers ... are ALWAYS prioritized", and there is the kw = 3.0 weight for the core. The split does not use it.
  2. How fast each card is. With 16 GB and 12 GB free, the split is about 13 : 11 layers, whatever the speed of the cards.

On a layer split the stages work one after another for each token, so the time per token is about the sum over stages of (visits on that stage × time per visit on that card). The auto split gives the slower card 44% of the visits.

Expected

--layer-split auto should give a split at least as fast as one card when everything fits in VRAM. Two possible ways (I have not written a patch):

  • Count visits instead of layers when sizing the stages (core layers count 3), and keep the looped core together on stage 0 when it fits.
  • Or fill stage 0 (the first card in the given order) up to its VRAM budget first, in layer order, and give the remaining layers to the later stages. On this pair that gives 21,3, the fastest split I measured. It would also keep the current rule that later stages must fit fully in VRAM, since host-RAM experts only run on stage 0 ([Engine] strata-inkling CUDA: refuse a layer split when a later GPU's experts would go to host RAM #6986).

A simpler stopgap would be a log line when auto puts core layers on a stage other than 0, saying that --layer-split takes per-card counts (and see #6809 for the server's layer_split form).

Smallest steps that reproduce it

Two unequal NVIDIA cards with the faster card first:

strata-inkling --serve --native Inkling-2-Mini-SQ-15.strata --max-context 32768 --kv fp8 --draft off --layer-split auto
strata-inkling --serve --native Inkling-2-Mini-SQ-15.strata --max-context 32768 --kv fp8 --draft off --layer-split 21,3

(With serve/server.py: "gpu": [<fast>, <slow>], "gpu_order": "as_given", and --layer-split in args.) Compare the Loaded ... GPUx(L..) line and decode tok/s.

Reproduction status

Reproduced every time (the same results on v0.2.20 earlier today and on v0.2.21 tonight).

Strata version

v0.2.21 (d46f5f2), strata-inkling 0.1.67 official package (eada4591cef1, archs 75;80;86;89;120). Also a v0.2.20 source build with #6958, #6960 and #6982 (sm_86+120).

Graphics card, memory and system

RTX 5060 Ti 16 GB (sm_120, PCIe 3.0 x8) + RTX 3060 12 GB (sm_86, PCIe 3.0 x16), on different CPU root ports. i7-7800X (X299), 93 GB RAM, Linux (Fedora 45), driver 615.71.09 with P2P enabled. Earlier today I measured the same split with P2P off (STRATA_CUDA_PEER_PINNED=1). It was within 0.6% and gave the same answers, so the result does not depend on P2P.

Model, size and settings

Inkling-2-Mini-SQ-15.strata, --max-context 32768 --kv fp8 --draft off, no Vision shard, temperature 0.

Answers: all 12 questions are correct in every row. On 7 longer prompts, 21,3 and one card give the same text on 5/7. Auto matches either of them on 1/7.

Related

I can test a patch on this pair (decode on 7 prompts, the three reads, the 12 questions, with P2P on and off).

Activity

  1. Niko1221 commented on Nov 24, 2026

    @Niko1221
    Owner

    Thank you, this is a clear report and the table makes it easy to follow. We read the code and it matches what you describe.

    What the code does. In ink_runner.cuh the automatic split gives each later card a share of the 24 layers in proportion to its free VRAM, clamped to the layers whose experts fit entirely on that card, and it takes them from the end of the layer list. It does not count how often a layer runs and it does not look at card speed. With your 16 GB + 12 GB pair that gives the 3060 L13..23. That holds L13..17 of the looped core (15 visits) and the 6 coda layers, so 21 of the 48 layer visits per token, as you counted. It also puts three stage boundaries inside the core loop, where 21,3 has one boundary per token.

    Is it by design? The VRAM-only rule is a capacity rule: a later card has to hold all of its experts, because experts in RAM only run on the first card (#6986). Nobody tuned it for speed. With one request the stages run one after another, so a slower card can only add time, and splitting is a way to fit more, not a way to go faster. The Qwen engine already predicts this and prints a "FEWER CARDS" line (0.2.21). The Inkling engine has neither.

    What to do now. Your --layer-split 21,3 in the run config args is the right workaround on this pair, with the faster card first in the gpu list. One card with --gpu N and no layer split is the other option.

    What we plan to do. Change the automatic split along the lines you suggested: count the looped core layers three times, fill the first card up to its budget before giving anything to the next card, and give the later cards the layers with the fewest visits first. If the whole model fits on the first card, use only that card and say so in the log. A split also gives more room for the K/V cache, so we plan to keep a way to ask for the current spread. We also plan to port the "FEWER CARDS" line. This is not done yet, and we cannot say yet which release it will be in.

    We would be glad to have your help testing it. We will use your two-card pair as one of the checks, with P2P on and off, plus an equal pair and a three-card case. Only the placement changes, so the answers must match.

  2. Norhiro commented on Nov 24, 2026

    @Norhiro
    ContributorAuthor

    Thank you for reading it so closely, and for the plan. Yes, I'll test it on this pair.

    One data point for the "if the whole model fits on the first card, use only that card" rule. On this pair, SQ-15 at --max-context 32768 --kv fp8 fits on the 5060 Ti alone with all 3,072 experts in VRAM. But the K/V does not:

    [InkCUDA] Auto Host KV Offload (kv_fmt=1, 1.33 GiB free VRAM): global KV = 6400 VRAM + 26368 mapped host tokens (424.9 MiB host RAM, max_ctx=32768)
    

    With --layer-split 21,3 that line does not appear. On v0.2.21 + #6958:

    placement decode, 6 short prompts (tok/s) decode, 8K-token document prompt (tok/s) first token, 27,304-token prompt (s)
    5060 Ti alone 68.1 47.8 22.60
    2 cards, 21,3 65.5 64.8 19.65

    So one card wins by 4% on short prompts, and the split wins once the prompt is past the K/V that fits in VRAM. If "fits" counts the K/V for --max-context too, the rule would choose the split here. Your plan to keep a way to ask for the current spread covers the other case.

    When the patch is ready, I'll run the same set as in the issue: decode on the 7 prompts, the three reads (585 / 5,070 / 27,304 tokens) and the 12 questions. I'll run it with P2P on and with P2P off (STRATA_CUDA_PEER_PINNED=1), and compare the Loaded ... GPUx(L..) line and the output text against 21,3 and one card. I can test both card orders. I only have this one pair, so I can't do the equal pair or the three-card case.

  3. Norhiro commented on Nov 26, 2026

    @Norhiro
    ContributorAuthor

    A data point for when you work on this: I re-ran the issue's set on v0.2.22 (official strata-inkling 0.1.69 linux-x86_64-cuda-cuda13, the 0.2.22 server.py). I also re-ran v0.2.21 (0.1.67) in the same session so the two can be compared directly. The pair, model and settings are the same as in the issue: RTX 5060 Ti 16 GB + RTX 3060 12 GB with P2P on, Inkling-2-Mini-SQ-15.strata --max-context 32768 --kv fp8 --draft off, temperature 0, one server start per row.

    As expected, since the release notes don't list this issue, the automatic split is unchanged. The #7093 fix in 0.2.22 changes the peer clamp, but on this pair every expert fits in VRAM in every row (0 host), so the clamp does not move anything.

    placement version load log decode tok/s (7 prompts) first token, 585 / 5,070 / 27,304-token prompt (s) 12 short questions
    5060 Ti alone 0.2.22 experts=3072 VRAM / 0 host 46.1-48.2 0.40 / 2.65 / 24.27 12/12
    2 cards, --layer-split auto 0.2.22 GPU1(L0..12,1664exp) GPU0(L13..23,1408exp) 40.6-42.1 0.64 / 4.32 / 26.74 12/12
    2 cards, --layer-split 21,3 0.2.22 GPU1(L0..20,2688exp) GPU0(L21..23,384exp) 44.5-46.7 0.44 / 2.94 / 19.22 12/12
    5060 Ti alone 0.2.21 same 46.1-48.2 0.40 / 2.64 / 24.29 12/12
    2 cards, --layer-split auto 0.2.21 same 40.5-42.0 0.64 / 4.33 / 26.80 12/12
    2 cards, --layer-split 21,3 0.2.21 same 44.5-46.7 0.44 / 2.94 / 19.22 12/12

    The two versions give the same numbers to within 0.5%. So 0.2.22 can serve as the baseline for your patch. The offer to test still stands: when the patch is ready I'll run this set with P2P on and off and in both card orders.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions