[GH-ISSUE #723] Design question before we build: two lanes on a peer pair that help each other ("mutual help") — welcome upstream, or keep it in a fork? #329

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

Originally created by @q8atnight on GitHub (Oct 4, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/723

Hi Niko — a design question before we write code, not a PR.

Context. Thanks again for merging the peer tier as --peer-device (#531). On our box (2× RTX 3090 + NVLink, IQ3_S, 262K, Ryzen 3950X, 121 GB DDR4) we now run an experiment along the lines of #127: when a second request arrives, the helper card stops being the lead's peer and becomes its own one-card engine (both processes share the MAP_SHARED arena); once it has been idle for a while it goes back to being the peer. Each process still serves exactly one sequence, as in your design.

What we measured on real agent traffic (two coding-agent chats at 60–98K context with tool calls, not a synthetic bench):

mode decode per chat expert-cache hit
one chat, lead + peer (--peer-device) 110–160 t/s 0.98
two chats, two independent one-card lanes lead ~75–80, other ~55–65 t/s 0.74–0.89

So the two lanes together are only ~15 % faster than one chat on the peer pair, and each chat runs at roughly half speed. That matches what you wrote in #97 ("two at once would roughly halve each"). The loss comes from the cache split: each lane only has its own card's cache, so 11–26 % of the expert work falls back to the CPU. CPU was ~70 % idle at the same time; the misses look bandwidth-bound.

The idea ("mutual help"). Keep two processes with one sequence each, but leave the peer tier on in both directions: each lane is the other's --peer-device. The two caches hold different experts (deduplicated), so each lane computes an expert on whichever card has it, and both see roughly the peer-pair coverage instead of the CPU fallback. No batching, no shared decode loop; the cost is that each card's GPU time is shared between two sequences, plus the peer sync in both directions. With 3+ cards (72+ GB) all experts would fit on the GPUs, but pairwise peering doesn't scale past an NVLink pair. So the long-term version would probably be one shared expert pool sliced across all cards, which comes close to the multi-slot engine you decided against in #465 / #249.

Questions:

  1. Would a bidirectional peer tier (two lanes, each the other's peer, deduplicated caches) fit your plans for upstream, if it stays opt-in, byte-identical by default and gated like #531? Or would you rather keep the peer tier strictly lead → helper?
  2. For more than two cards: do you see Strata staying at "one sequence per process, one process per card", with any cross-card sharing at the expert-tier level? Or would you consider a shared multi-card expert pool at some point? If it's a clear no, we'll keep that part in our fork and won't come back with it as a PR.

We'll measure first on our side (real-workload bench, then a 2-card prototype) and only come back with numbers.

Originally created by @q8atnight on GitHub (Oct 4, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/723 Hi Niko — a design question before we write code, not a PR. **Context.** Thanks again for merging the peer tier as `--peer-device` (#531). On our box (2× RTX 3090 + NVLink, IQ3_S, 262K, Ryzen 3950X, 121 GB DDR4) we now run an experiment along the lines of #127: when a second request arrives, the helper card stops being the lead's peer and becomes its own one-card engine (both processes share the `MAP_SHARED` arena); once it has been idle for a while it goes back to being the peer. Each process still serves exactly one sequence, as in your design. **What we measured on real agent traffic** (two coding-agent chats at 60–98K context with tool calls, not a synthetic bench): | mode | decode per chat | expert-cache hit | |---|---|---| | one chat, lead + peer (`--peer-device`) | 110–160 t/s | 0.98 | | two chats, two independent one-card lanes | lead ~75–80, other ~55–65 t/s | 0.74–0.89 | So the two lanes together are only ~15 % faster than one chat on the peer pair, and each chat runs at roughly half speed. That matches what you wrote in #97 ("two at once would roughly halve each"). The loss comes from the cache split: each lane only has its own card's cache, so 11–26 % of the expert work falls back to the CPU. CPU was ~70 % idle at the same time; the misses look bandwidth-bound. **The idea ("mutual help").** Keep two processes with one sequence each, but leave the peer tier on in both directions: each lane is the other's `--peer-device`. The two caches hold different experts (deduplicated), so each lane computes an expert on whichever card has it, and both see roughly the peer-pair coverage instead of the CPU fallback. No batching, no shared decode loop; the cost is that each card's GPU time is shared between two sequences, plus the peer sync in both directions. With 3+ cards (72+ GB) all experts would fit on the GPUs, but pairwise peering doesn't scale past an NVLink pair. So the long-term version would probably be one shared expert pool sliced across all cards, which comes close to the multi-slot engine you decided against in #465 / #249. **Questions:** 1. Would a bidirectional peer tier (two lanes, each the other's peer, deduplicated caches) fit your plans for upstream, if it stays opt-in, byte-identical by default and gated like #531? Or would you rather keep the peer tier strictly lead → helper? 2. For more than two cards: do you see Strata staying at "one sequence per process, one process per card", with any cross-card sharing at the expert-tier level? Or would you consider a shared multi-card expert pool at some point? If it's a clear no, we'll keep that part in our fork and won't come back with it as a PR. We'll measure first on our side (real-workload bench, then a 2-card prototype) and only come back with numbers.
Author
Owner

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

The idea is interesting: a helper card that turns into its own engine on the second request. We welcome it as an opt-in, off by default, gated the same way as the peer pair in #531. Please bring numbers first: single request speed unchanged, and the cost to the first card when the second request starts.

<!-- gh-comment-id:6037761378 --> @Niko1221 commented on GitHub (Oct 7, 2026): The idea is interesting: a helper card that turns into its own engine on the second request. We welcome it as an opt-in, off by default, gated the same way as the peer pair in #531. Please bring numbers first: single request speed unchanged, and the cost to the first card when the second request starts.
Author
Owner

@q8atnight commented on GitHub (Oct 7, 2026):

Thanks — numbers first, as asked, and the PR is up: #1461 (opt-in, off by default; without the flags/config block the output is word for word v0.1.40.3 on our gates).

On 2x RTX 3090 + NVLink, IQ3_S, 262K:

  • single request speed unchanged: stock --peer-device 1 110.8 / 104.2 / 103.2 t/s decode, 2,846 t/s prefill (50K) vs the pair serving one request 119.4 / 102.8 / 103.7, 2,844 (n = 6, alternating restarts);
  • cost to the first card when the second request starts: its decode goes 102-112 → 72-77 t/s for the 4.7 s the helper needs to wake (card 2's experts come from the CPU meanwhile), 82-87 while both run, back to 94-104 afterwards; its stream never pauses (longest gap 0.07 s). The second request's first token: 4.7 s + its prompt.
  • two requests at once: 151-160 t/s together vs 99 one after the other.

And the honest counter-case: unsloth Q4_K_XL on a layer split gains nothing (the split already uses both cards' bandwidth for one chat). Details in the PR.

<!-- gh-comment-id:6048462050 --> @q8atnight commented on GitHub (Oct 7, 2026): Thanks — numbers first, as asked, and the PR is up: #1461 (opt-in, off by default; without the flags/config block the output is word for word v0.1.40.3 on our gates). On 2x RTX 3090 + NVLink, IQ3_S, 262K: - **single request speed unchanged:** stock `--peer-device 1` 110.8 / 104.2 / 103.2 t/s decode, 2,846 t/s prefill (50K) vs the pair serving one request 119.4 / 102.8 / 103.7, 2,844 (n = 6, alternating restarts); - **cost to the first card when the second request starts:** its decode goes 102-112 → 72-77 t/s for the 4.7 s the helper needs to wake (card 2's experts come from the CPU meanwhile), 82-87 while both run, back to 94-104 afterwards; its stream never pauses (longest gap 0.07 s). The second request's first token: 4.7 s + its prompt. - two requests at once: 151-160 t/s together vs 99 one after the other. And the honest counter-case: unsloth Q4_K_XL on a layer split gains nothing (the split already uses both cards' bandwidth for one chat). Details in the PR.
Author
Owner

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

Thanks for the report. To keep the tracker current we are closing issues older than three days: 0.1.44 is out with a long list of fixes, and many older reports are covered by it or by 0.1.43.1.

If this still happens on 0.1.44, please leave a comment here with your engine log (and the version line it prints), and we will reopen it. A new issue that links this one works too.

<!-- gh-comment-id:6155956318 --> @Niko1221 commented on GitHub (Oct 13, 2026): Thanks for the report. To keep the tracker current we are closing issues older than three days: [0.1.44](https://github.com/Niko1221/Strata/releases/tag/v0.1.44) is out with a long list of fixes, and many older reports are covered by it or by 0.1.43.1. If this still happens on 0.1.44, please leave a comment here with your engine log (and the version line it prints), and we will reopen it. A new issue that links this one works too.
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#329
No description provided.