[PR #2738] [CLOSED] batch-mtp: split the solo MTP budget across batch slots — multi-GPU multi-stream tuning (agent concurrency) #4235

Closed
opened 2026-11-07 15:34:14 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/2738
Author: @superlee-terry
Created: 10/16/2026
Status: ❌ Closed

Base: main ← Head: feat/batch-mtp-pr


📝 Commits (3)

  • 55fff53 batch-mtp: proposals per slot = ceil(spec/batch) — the solo MTP budget splits across slots (spec 3 + 2 slots = 2 drafts each; 3+ slots = 1); chain-verified keep, 1+D rows per slot per window, startup note on the extra draft K/V
  • a3ca15f batch-mtp: D = ceil(MTP budget / batch) — use --mtp-max-t/--spec as given, not the suffix-draft spec+2 bump (the bumped spec is the verifier's window, not the drafter's)
  • b5ea610 monitor: show every parallel request - the Model state card renders one row per batch slot (reading progress / decoding tokens+tok/s+elapsed / idle-held), plus solo-path, waiting-for-slot and queued counts; the single progress bar only ever showed the newest request (#465)

📊 Changes

4 files changed (+73 additions, -12 deletions)

View changed files

📝 serve/web/app.css (+11 -0)
📝 serve/web/app.js (+25 -0)
📝 serve/web/index.html (+1 -0)
📝 src/program/generate.cpp (+36 -12)

📄 Description

What

Two commits on --batch-mtp plus one Monitor-tab improvement, aimed at multi-GPU (layer split) + multi-stream serving:

  1. batch-mtp: proposals per slot = ceil(MTP budget / batch) — the solo MTP budget is split across the batch slots (spec 3 + 2 slots → 2 drafts each; 3+ slots → 1). Chain-verified keep, 1 + D rows per slot per window, and a startup note about the extra draft K/V/graph memory.
  2. batch-mtp: D uses the MTP budget as given (--mtp-max-t, else --spec) — not the suffix-draft spec+2 bump. The bumped spec is the verifier's window, not the drafter's budget; without this, --spec 3 --batch 2 silently drafts 3 per slot.
  3. monitor: show every parallel request — the Model state card renders one row per batch slot (reading progress / decoding tokens+tok/s+elapsed / idle-held tokens), plus solo-path, waiting-for-slot and queued counts. The single progress bar only ever showed the newest request.

Why — the real-world scenario

This is a tuning pass for agent workloads: connecting a local Strata endpoint to agent frameworks (Hermes, Claude Code, etc.). A large task gets split into sub-agents that fire concurrent requests; with the stock configuration those requests queue serially, and once --batch is on, --batch-mtp on a layer split is gated off (helper expert caches) and each slot drafts only 1 proposal per window — so MTP is effectively disabled exactly when concurrency arrives, and per-stream decode collapses (measured: 1 stream 74 tok/s → 2 streams ~21 tok/s each on the pipelined default).

The commits make the MTP budget follow the concurrency: 1 stream keeps the full solo budget (solo path, untouched), 2 streams split it 2+2, 3 streams run 1 each inside the kVerifyMaxT = 8 window. This is the 2×RTX 3090 / ≤3 streams corner of the design space (the window cap makes D>1 at 3 streams impossible: 3 slots × 3 rows = 9 > 8, and raising the cap touches GMAX in the grouped-MoE kernels).

Measured on 2× RTX 3090, layer split auto, IQ3_S, --batch 3 --batch-mtp --batch-groups 1 --spec 3 --vram-reserve-mib 1024

Natural-stop long-form requests (~1500-token answers, finish=stop, not length-truncated):

streams before (pipelined default) after (batch-mtp serial windows)
1 74.1 tok/s (solo) 74.1 tok/s (solo path unchanged)
2 ~42 agg 66.4 agg (31.8 / 36.8 per stream)
3 — 88.8 agg (30.0 / 29.0 / 34.3)

Official tools/strata_bench.py --clients 3 on the production instance: 82.7 tok/s aggregate, 0 errors, TTFT p50 1.06 s / p95 1.74 s. MTP acceptance rose 59.8% → 67.2% (spec 4 → 3). Single-stream costs are within noise (agent decode 109.5 → 107.0); 4K prefill −9% is the 3 slot sessions' 1.37 GiB expert-cache tax, which is the documented --batch cost.

D=2 at 2 streams was measured four independent times: net zero (acceptance decay cancels the extra draft cost) — the split formula keeps D=2 available where it helps (single-GPU builds, higher acceptance) and clamps to 1 at 3+ streams where the window demands it.

Notes

  • No behaviour change without --batch-mtp; the solo path is untouched.
  • The window-cap clamp (D ≤ 8//batch − 1) is deliberate: 3 streams × D=2 overflows kVerifyMaxT and measured −19% (window rotation starves the third slot).
  • The Monitor rows read the existing /metrics live.slots (slots_view()); pure frontend, no engine ABI change.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/2738 **Author:** [@superlee-terry](https://github.com/superlee-terry) **Created:** 10/16/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feat/batch-mtp-pr` --- ### 📝 Commits (3) - [`55fff53`](https://github.com/Niko1221/Strata/commit/55fff53ab51596d441052d21876a30a12d09cff9) batch-mtp: proposals per slot = ceil(spec/batch) — the solo MTP budget splits across slots (spec 3 + 2 slots = 2 drafts each; 3+ slots = 1); chain-verified keep, 1+D rows per slot per window, startup note on the extra draft K/V - [`a3ca15f`](https://github.com/Niko1221/Strata/commit/a3ca15f36b2eed4732a0e9e1f2d6fa894727bbce) batch-mtp: D = ceil(MTP budget / batch) — use --mtp-max-t/--spec as given, not the suffix-draft spec+2 bump (the bumped spec is the verifier's window, not the drafter's) - [`b5ea610`](https://github.com/Niko1221/Strata/commit/b5ea610196ff0e36b894eadb40512205fe0105b6) monitor: show every parallel request - the Model state card renders one row per batch slot (reading progress / decoding tokens+tok/s+elapsed / idle-held), plus solo-path, waiting-for-slot and queued counts; the single progress bar only ever showed the newest request (#465) ### 📊 Changes **4 files changed** (+73 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `serve/web/app.css` (+11 -0) 📝 `serve/web/app.js` (+25 -0) 📝 `serve/web/index.html` (+1 -0) 📝 `src/program/generate.cpp` (+36 -12) </details> ### 📄 Description ## What Two commits on `--batch-mtp` plus one Monitor-tab improvement, aimed at **multi-GPU (layer split) + multi-stream serving**: 1. **`batch-mtp`: proposals per slot = ceil(MTP budget / batch)** — the solo MTP budget is split across the batch slots (spec 3 + 2 slots → 2 drafts each; 3+ slots → 1). Chain-verified keep, `1 + D` rows per slot per window, and a startup note about the extra draft K/V/graph memory. 2. **`batch-mtp`: D uses the MTP budget as given** (`--mtp-max-t`, else `--spec`) — not the suffix-draft `spec+2` bump. The bumped spec is the verifier's window, not the drafter's budget; without this, `--spec 3 --batch 2` silently drafts 3 per slot. 3. **monitor: show every parallel request** — the Model state card renders one row per batch slot (reading progress / decoding tokens+tok/s+elapsed / idle-held tokens), plus solo-path, waiting-for-slot and queued counts. The single progress bar only ever showed the newest request. ## Why — the real-world scenario This is a tuning pass for **agent workloads**: connecting a local Strata endpoint to agent frameworks (Hermes, Claude Code, etc.). A large task gets split into **sub-agents that fire concurrent requests**; with the stock configuration those requests queue serially, and once `--batch` is on, `--batch-mtp` on a layer split is gated off (helper expert caches) and each slot drafts only 1 proposal per window — so MTP is effectively **disabled exactly when concurrency arrives**, and per-stream decode collapses (measured: 1 stream 74 tok/s → 2 streams ~21 tok/s each on the pipelined default). The commits make the MTP budget follow the concurrency: 1 stream keeps the full solo budget (solo path, untouched), 2 streams split it 2+2, 3 streams run 1 each inside the `kVerifyMaxT = 8` window. This is the 2×RTX 3090 / ≤3 streams corner of the design space (the window cap makes D>1 at 3 streams impossible: 3 slots × 3 rows = 9 > 8, and raising the cap touches `GMAX` in the grouped-MoE kernels). ## Measured on 2× RTX 3090, layer split auto, IQ3_S, `--batch 3 --batch-mtp --batch-groups 1 --spec 3 --vram-reserve-mib 1024` Natural-stop long-form requests (~1500-token answers, `finish=stop`, not `length`-truncated): | streams | before (pipelined default) | after (batch-mtp serial windows) | | --- | --- | --- | | 1 | 74.1 tok/s (solo) | 74.1 tok/s (solo path unchanged) | | 2 | ~42 agg | **66.4 agg** (31.8 / 36.8 per stream) | | 3 | — | **88.8 agg** (30.0 / 29.0 / 34.3) | Official `tools/strata_bench.py --clients 3` on the production instance: **82.7 tok/s aggregate, 0 errors**, TTFT p50 1.06 s / p95 1.74 s. MTP acceptance rose 59.8% → 67.2% (spec 4 → 3). Single-stream costs are within noise (agent decode 109.5 → 107.0); 4K prefill −9% is the 3 slot sessions' 1.37 GiB expert-cache tax, which is the documented `--batch` cost. D=2 at 2 streams was measured four independent times: **net zero** (acceptance decay cancels the extra draft cost) — the split formula keeps D=2 available where it helps (single-GPU builds, higher acceptance) and clamps to 1 at 3+ streams where the window demands it. ## Notes - No behaviour change without `--batch-mtp`; the solo path is untouched. - The window-cap clamp (`D ≤ 8//batch − 1`) is deliberate: 3 streams × D=2 overflows `kVerifyMaxT` and measured −19% (window rotation starves the third slot). - The Monitor rows read the existing `/metrics` `live.slots` (`slots_view()`); pure frontend, no engine ABI change. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:34:14 +07:00
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#4235
No description provided.