Skip to content

update(inkling2): pick DSpark verify width by measured throughput - #3417

Merged
inureyes merged 3 commits into
mainfrom
update/issue-3410-inkling2-dspark-followups
Nov 24, 2026
Merged

inureyes merged 3 commits into
mainfrom
update/issue-3410-inkling2-dspark-followups

Conversation

@inureyes

Copy link
Copy Markdown
Member

Inkling 2 Small lost 10% on prose with DSpark because an 8-row verify round costs about 130 ms against a 52 ms decode step. #3280 made the Inkling 2 verify block equal decode at every width from 1 to 16, so the round loop can now choose a width per round without changing the text.

Changes

  • Acceptance-aware verify width (mlxcel_core::drafter::dflash::width_policy). Each round takes the width with the most expected tokens per measured millisecond. Expected tokens come from per-position acceptance estimates and cost from per-width round times. Width 1 means classic decode, and drafting is re-tried after 8 classic steps. A width's first round is not used as a cost sample because it includes kernel compilation. The policy applies only to targets that return true from SpeculativeTarget::exact_at_every_verify_width (Inkling 2 today). MLXCEL_DFLASH_ADAPTIVE_WIDTH=0 keeps the fixed width.
  • Classic steps inside the round loop are pipelined like classic decode (classic_steps.rs). Their hidden rows feed the next draft. The CLI DFlash line now reports classic_steps.
  • The grouped expert matvec now also runs in unlooped Small verify forwards. At 8 rows it takes 129 ms instead of 150 ms, with identical argmax digests.
  • Item 2: the server DFlash burst prefills Inkling 2 using the --prefill-chunk-size partition (DFlashTargetModel::prefill_burst calls Inkling2Model::prefill_speculative_planned). The CLI still uses MLXCEL_PREFILL_CHUNK.
  • Item 3: the per-row affine 4-bit attention projections on Mini 4-bit cost at most 4.1 ms (7.7%) per 8-row round, and the block stays exact. I documented this instead of adding a quantized kernel.

Results (M3 Ultra, 256 greedy tokens, --show-reasoning, ABAB)

Small classic before (fixed 8, main) after (adaptive)
prose 19.3 tok/s 0.90x 1.12x
code 19.2 tok/s 1.54x 1.58x
  • Drafter-on text matches classic byte for byte on Small and Mini.
  • On Small with the grouped kernel, the per-visit diagnostic finds 0 differing logits at widths 2, 4 and 8, and also after an 1100-token prompt.
  • Mini shows no regression.
  • Full tables: docs/benchmark_results/inkling2-dspark-followups-m3ultra-2026-11-25.md.

Tests

  • models::inkling2::speculative::tests::round_tests::the_burst_prefill_follows_the_server_chunk_size: a 40-token prompt at chunk 16 produces the same bytes as the classic chunked prefill and differs from the old one-forward prefill.
  • classic_steps_keep_the_text_and_feed_the_drafter_every_row covers classic steps.
  • 10 width-policy unit tests, plus a grouped-gate test.
  • Passing locally: the inkling selector (176), dflash, speculative_burst, coverage_tests, the mlxcel-core drafter::dflash tests, clippy, fmt and the contract scripts.

Closes #3410

Inkling 2 Small lost 10% on prose with DSpark: an 8-row verify round costs about 130 ms against a 52 ms decode step, and prose emits about 2.3 tokens per round. Because the Inkling 2 verify block equals decode at every width from 1 to 16, the round loop may now choose each round's width.

- New `ExpectedThroughputWidth` policy (mlxcel-core `drafter::dflash::width_policy`): per-position acceptance estimates and per-width measured round cost pick the width with the most expected tokens per millisecond, down to classic decode, and re-try drafting after 8 classic steps. The first round at each width is not a cost sample (kernel compilation). Enabled only for targets that declare `exact_at_every_verify_width`; `MLXCEL_DFLASH_ADAPTIVE_WIDTH=0` keeps the fixed width.
- Classic steps run pipelined like classic decode (`classic_steps`), and their hidden rows feed the next draft.
- The grouped expert matvec now serves unlooped Small verify forwards too (8 rows: 129 ms against 150 ms, digests identical).
- The server DFlash burst prefills Inkling 2 in the `--prefill-chunk-size` partition through `DFlashTargetModel::prefill_burst`.
- Mini 4-bit per-row attention projections cost at most 4.1 ms per 8-row round; documented, no new kernel.

Small, 256 greedy tokens, ABAB: prose 1.12x classic (was 0.90x), code 1.58x (was 1.54x), text byte-identical. Per-visit diagnostic on Small with the grouped kernel: 0 differing logits at widths 2, 4, 8 and after 1100 tokens. Numbers in docs/benchmark_results/inkling2-dspark-followups-m3ultra-2026-11-25.md.

Closes #3410
@inureyes inureyes added status:review Under review type:enhancement New features, capabilities, or significant additions labels Nov 24, 2026
@inureyes inureyes added status:done Completed and removed status:review Under review labels Nov 24, 2026
@inureyes
inureyes marked this pull request as ready for review November 24, 2026 23:09
@inureyes
inureyes merged commit 6d275c1 into main Nov 24, 2026
15 checks passed
@inureyes
inureyes deleted the update/issue-3410-inkling2-dspark-followups branch November 24, 2026 23:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status:done Completed type:enhancement New features, capabilities, or significant additions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

perf: Inkling 2 DSpark follow-ups: Small verify cost and server prefill chunk

1 participant