perf: Batched DFlash2 drafting for concurrent Raon-1 mini requests
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- rust
- Ambito
- backend-api-design, performance
Direzione di ricerca
Read the batched Qwen 3.5 path in src/server/batch/dflash_target.rs, the Raon speculative forward in src/models/raon1_mini_speculative.rs, and the sampling checks in src/server/batch/speculative_burst.rs. First establish whether batched verify can meet the 2-row width-3 cost gate while staying bit-identical to single-row decode; also investigate per-row token history in src/lib/mlxcel-core/src/speculative/mtp/target.rs. Done means both preconditions hold, exactness and sampling tests pass, and either benchmarks show the required throughput win or a benchmark document records the result.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem / Background
Concurrent Raon-1 mini requests decode classically: the DFlash2 burst is B = 1 only, so with a drafter loaded two or more queued requests never share a speculative window. #3458 item 3 asked for batched DFlash2 and PR #3461 dropped it on measurement (docs/benchmark_results/raon-perf-m3ultra-2026-11-26.md, section 7, M3 Ultra):
| Rows | Batched decode step (ms) | Exact verify, width 3 (ms) | Width 5 (ms) |
|---|---|---|---|
| 1 | 21.8 | 35.7 | 46.7 |
| 2 | 23.7 | 50.7 | 72.4 |
| 4 | 28.2 | 79.7 | over the 16-row limit |
A batched decode step costs 9% more for two rows than one; an exact verify block costs 42 to 59% more. The ceiling on batched drafting (rows * tokens emitted per verify / verify time, solo acceptance, draft cost free) is 13 to 22% below classic batched decode at four rows (110 to 123 against 141 tok/s) and 3 to 15% above it at two rows and width 3, a margin the draft cost (about 2 ms per row per round) and the uniform accept of the batched round loop consume. This issue records the two preconditions under which the work is worth doing, and is closed either by a measured win or by a recorded measurement.
Current Behavior
impl DFlashTargetModel for crate::models::Raon1MiniModelinsrc/server/batch/dflash_target.rs:444returnsfalsefromsupports_batched(), so the scheduler collects no window and a window that reaches the batched gate declines to classic decode.Raon1MiniModel::forward_speculative(src/models/raon1_mini_speculative.rs:146) asserts B = 1 (:160). In a verify block (2 torow_invariant::MAX_ROWS= 16 rows) every row is formed alone so it equals its decode step bit for bit: RDA projections throughrow_invariantproducts with the conv and delta-rule recurrence stepped per position (RaonDeltaAttention::forward_recording), MLA as one decode-shaped attention per position (:189), mHC, router and SiTU MLPs throughrow_invariantproducts (row_scope,:81). OffMLXCEL_RAON_ROW_INVARIANT, each dense weight is read once per row, which is why verify cost grows almost linearly with rows.sampling_config_eq(src/server/batch/speculative_burst.rs:3127) requires!needs_token_history()on both configs because the batched path samples each row's first bonus with an empty history (prefill_and_seed_batched,run_dflash_batched_on_targetatdflash_target.rs:980). Since #3459 the server applies the checkpoint'spresence_penalty1.5 by default (src/server/startup.rs:2185), which makesSamplingConfig::needs_token_history()(src/lib/mlxcel-core/src/generate.rs:1765) true, so default-setting Raon requests would never join a batched window even ifsupports_batched()weretrue.
Preconditions to revisit
- A cheaper exact multi-row verify. A verify block of B rows whose cost grows like a batched decode step, not like B separate steps, while each row stays bit-identical to its decode step. Candidates: the row-invariant matvec kernel (
src/lib/mlxcelverse/kernels/row_invariant_matvec.cpp) made fast enough to be the default for RDA, mHC and the SiTU MLPs, or a batched RDA and MLA verify that matches the per-position decode form. Gate: a probe (as in section 7) shows a 2-row width-3 verify at or under 1.2x the 1-row verify. - Per-row token history in batched windows. Thread each row's token history through the batched round loop (
MtpTarget::prefill_and_seed_batched,src/lib/mlxcel-core/src/speculative/mtp/target.rs:501, and the batched DFlash runner) so penalty-bearing rows sample like their B = 1 burst, then drop the two!needs_token_history()clauses fromsampling_config_eq. This is shared with the Qwen 3.5 batched path and must keep its existing tests green.
Do not flip supports_batched() for Raon until both hold. Precondition 2 is independently useful and may land alone.
Scope
In scope: the two preconditions, a B > 1 Raon verify forward and rollback, the drafter side, supports_batched() -> true, the measurement.
Out of scope: the B = 1 burst, the DFlash2 default width (3, raon_dflash2::DEFAULT_VERIFY_WIDTH), prefill batching for drafting (rows stay prefilled alone for exactness).
Implementation Notes
- Reuse: the Qwen 3.5 batched burst (
supports_batched() == truepath indflash_target.rs) for windowing, per-row rollback and accept;compare_block_against_chain/mtp_exactness_gatefor the exactness probe at B > 1. - Constraints: greedy drafted text must equal plain decode for every row; a row whose exactness probe fails declines to classic decode, never to a non-exact verify.
- Edge cases: rows of unequal prompt length (current window collection requires equal lengths), rows at different reasoning efforts (alpha is per cache; a window must not mix alphas unless steering is per row), a row finishing mid-window.
Acceptance Criteria
- Either: at 2 and 4 concurrent requests (
mlxcel-server --parallel 4 --model-draft models/raon-1-mini-dflash2, 128 tokens each, the section 7 client) aggregate tok/s beats classic batched decode of the same binary on the short prose, code and long prompts, with the server's defaultpresence_penaltyof 1.5 in force; or a benchmark doc underdocs/benchmark_results/records the measurement that justifies closing this issue. - Greedy text of every row in a batched burst equals plain decode of that prompt (server check over the three prompts at 2 and 4 rows).
- Test: with precondition 2, a batched window of two rows carrying
presence_penalty = 1.5produces the same tokens as two B = 1 bursts (fails today becausesampling_config_eqrefuses the window). - Test: the Raon B > 1 verify forward equals stacked B = 1 decode steps bit for bit on the tiny steered model (
raon1_mini::steering_tests::steered_model). - Integrated: the scheduler routes concurrent Raon requests with a DFlash2 drafter through the batched burst by default, not behind a test-only path.
Verification
make test-fast FILTER=speculative_burst
make test-fast FILTER=raon1_mini
make test-fast FILTER=dflash_target
make verify-fmt verify-clippy
Benchmark on Apple Silicon under the host GPU lock, arms interleaved, with uptime per table as in the section 7 run. Pass: batched drafting above classic batched decode at both 2 and 4 rows, text equal.
- Lingua principale
- Rust
- Stelle
- 505
- Fork
- 81
- Merge medio
- 14h 2m
- PR unite (30g)
- 448
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di lablup/mlxcel
-
area:core priority:high status:ready type:security
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
priority:medium status:ready type:security
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
I maintainer di solito rispondono entro 1 giorno
-
area:models modeltype:text priority:medium status:in-progress type:bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 57/100
I maintainer di solito rispondono entro 1 giorno
-
area:models priority:low status:ready type:test
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
I maintainer di solito rispondono entro 1 giorno
-
area:models modeltype:omni priority:medium status:ready type:bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di lablup/mlxcel
Issue simili
-
area:ui effort:medium enhancement P7 source:agent
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
marketing
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
Read a requested CodeRabbit PR review's findings with `coderabbit pullrequest --show-threads`Apertadocumentation priority: low tech-debt
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
nledford/Ladderback#1823 ·
I maintainer di solito rispondono entro 1 giorno
-
psmux-resurrect: restoring a session with a numeric name puts its windows into the wrong session (`new-window -t 4` is read as window 4)Forse già presa @ealwanlee l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
psmux/psmux-plugins#47 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 87/100
I maintainer di solito rispondono entro 1 giorno