Repository navigation
runtime: learn batch acceptance from the current request - #690
Conversation
There was a problem hiding this comment.
Verdict: CLEAN: No must-fix defect found in the changed code.
Non-blocking
⚠ Complete the GPU dispatch evidence: crates/gpu-gates/src/bin/shared/serve_seats/rounds.rs:309.
For S active slots at depth d, the old pack used ceil(S / floor(MAX_ROWS / (1 + d))) verifies. The new pack uses 1 + width rows per window, changing pass count and row geometry. Supply the owning Qwen and GLM GPU gate outputs and an interleaved timed A/B with both commit hashes and command output. The reported host gate does not exercise this dispatch.
⚠ Force the zero-depth state transition: crates/app/src/mtp.rs:649.
Removing the new zero-depth refresh record leaves every added host test unchanged. Extend the existing MTP gate to force depth zero followed by positive depth on each slot, then compare tokens and draft-store state with the reference path. This catches lost refresh state before it reaches serving requests.
Checked
Duplicates: 8 new items and 2 API edits checked by Grep; no duplicate owner. Dryer reported 0 pairs; gpu-gates was excluded and checked manually.
Complexity: Batch::choose is new at 25, with validation, endpoint exploration and greedy pricing as split boundaries. pass_rows_one_pass rose 15→23 through selection and packing; app::mtp::pass_slots rose 15→19 through zero-depth branches. GLM slots_skipping 32→36, slots_flow_together 40→43 and slots_sampled 28→30 add count-error propagation.
Silent failure: 7 sites followed. Five draft-count reads return named errors for malformed counts; absent pairs mean no proposals. The maximum-width fallback is unreachable after the nonempty guard. The existing cache-count sentinel reaches explicit expected-count assertions.
Tests: static inspection ties assertions to width.rs line 536 (interpolation), line 952 (acceptance update), and reset calls at lines 852/1265/1402. Dropping those operations contradicts the assertions. The added host tests do not call app::mtp::pass_slots or its zero-depth hooks.
Gates: no tolerance or pin relaxed in the diff.
Adversarial checks: empty/invalid profiles are refused; endpoint readings bracket interpolation; packing makes progress within MAX_ROWS; singleton verifies retain the Pass arena; request entries reset acceptance.
Escape catalog: no matching pattern. No new unsafe block.
Notes
Tests were not rerun during validation. The PR supplies no GPU gate output or explicit base hash for its timing arms.
Card check: needs-gpu. This pull request changes crates/app/src/mtp.rs, crates/gpu-gates/src/bin/gate_glm5next_serve.rs, crates/gpu-gates/src/bin/gate_qwen38_serve.rs … and carries no gate run on a card (CONTRIBUTING's evidence list); a maintainer adds gpu-verified after one.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
|
The review is done and the contribution check passed, so I'm merging this. |
여러 요청이 동시에 MTP draft를 쓸 때 verify 폭을 요청 하나가 아니라 batch 전체의 비용으로 고르게 해서, 동시 요청 네 건의 처리량을 높입니다.
Part of #565.
What and why
With MTP drafting, each verify step checks a proposal of several draft ids per request. When four requests draft at once, the verify rows of all four requests share one step, but the width of each proposal was chosen as if its request ran alone. A deep proposal that looks cheap for one request costs more once the rows of every active request share the step.
This PR makes the width rule see the whole batch.
runtime::width::Batchincrates/runtime/src/width.rsowns the rule. It weighs the conditional acceptance of each proposal position against the measured wall time of the whole round, indexed by the total rows the round selects, and prices the active round before the serving owner packs its verify calls.Batch::choosetakes the active slots and nothing about prompt rows, because a round's cost is read by its verify rows alone. Qwen supplies the supported widths0..=WIDTHand GLM supplies1..=WIDTH, which keeps the current two-row restriction of its NextN window. The rule has no model branch and no rank special case.before_stepand recording path, so the draft state stays valid without inventing optional proposal probabilities.The
BLOOMERY_MTP_WIDTHlever description now separates the single-sequence prefix cut from the batch proposal-depth selection. Its default,cost, is unchanged.The GLM serve gate reads its draft counts through the shared
draft_countshelper, which returns a named failure when a count is missing or malformed instead of reading it as zero.Release notes: Changed: batched MTP drafting picks each request's proposal width from the cost of the whole batch.
Code shape
runtime::widthserves Qwen and GLM, and both lifecycle entries call one reset helper. A removal test exists for each caller.WidthErrorfailures that selection and observation propagate.cargo fmtis clean on what I touched.Duplication found or removed (
path:line), or "none": none. The five draft-count reads in the GLM serve gate now use the onedraft_countsowner.What I ran
Head
c6724e76f, on top of main.GPU Evidence
On an NVIDIA GB10:
The width rule is host code, and its owning gate runs on the host:
The width tests alone:
The new batch assertion fails first when the interpolated cost is replaced by the lower endpoint:
The contribution check at the first tier finished clean:
Throughput
The checkpoint is
nvidia/Qwen3.8-Flash-Next-FP4-Localatb9ce18a6887e18c089fdea8509a33e63429a3300, served directly from its folder with an external shared-head Q8_0 MTP draft file (SHA2565ff54097406a905cf3a724c709124ceb0e3e10235ee862298969e91c96fa96e6). The base arm is main, the head arm adds this PR's width commits, and a draft-off arm runs the head binary withBLOOMERY_DRAFT=off. Both draft arms use the same environment and arguments:Each arm loads its server once and runs one group per concurrency. A request sends a 4096-id window of a code corpus and generates 128 ids at temperature 0, with no RAM cache. Concurrency is 1, 2 and 4, and each request at a concurrency takes the next window. Throughput is all generated ids divided by the group makespan, from the first request sent to the last token received, so it includes prompt time and excludes model load. Release binaries are built with
cargo oxide build --arch sm_121, and the GPU is idle apart from the server for each arm.C@4 group throughput changed by +2.31% against baseline and -0.46% against draft off. It rose from 12.3425 to 12.6280 tok/s, and draft off reaches 12.6863 tok/s.
At one request, throughput is effectively unchanged (-0.09%). At two requests it fell from 12.8597 to 12.7323 tok/s (-0.99%).
At four concurrent requests, the four requests proposed 292 draft ids with the head against 523 with the base (-44.17%).
All 1792 greedy token ids of the base and head arms equal the ids of the draft-off arm.
This is a single observation without a confidence interval, so the changes are point estimates and no significance is claimed.
What I ran into
This does not block the PR. At four concurrent requests the head is still 0.46% below draft off, and at two requests it is 0.99% below the base. A window of zero depth still refreshes the MTP state through
before_step, which a draft that is truly off does not do. That work is a possible contributor to the remaining gap, and I did not time it by itself. No GLM hardware run covers the batch rule or the changed reads in the GLM serve gate, and the host cases cover one, two and four active slots and the supported width bounds.Hardware
One NVIDIA DGX Spark (GB10), driver 595.84, CUDA 13.3, with CUDA 13.3.1 in the build image.
AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.