Skip to content

perf: run B=1 MTP by default for all targets (incl. batch-capable 31B) - #159

Merged
inureyes merged 1 commit into
mainfrom
perf/b1-mtp-default-on-all-targets
Jun 4, 2026
Merged

inureyes merged 1 commit into
mainfrom
perf/b1-mtp-default-on-all-targets

Conversation

@inureyes

@inureyes inureyes commented Jun 4, 2026

Copy link
Copy Markdown
Member

Summary

Run the singleton (B=1) MTP speculative-decoding burst by default for every MTP target, including batch-capable ones such as Gemma 4 31B. Previously B=1 MTP was declined by default for batch-capable targets and gated behind MLXCEL_ENABLE_MTP_B1, based on an earlier "B=1 is slower" calibration.

Why

Apple Silicon (M5 Max) measurement shows B=1 MTP is profitable, with byte-identical output at temperature 0:

Target Drafter classic tok/s MTP B=1 tok/s speedup
Gemma 4 31B (gemma4) gemma-4-31B-it-assistant-bf16 ~26 ~31–37 ~1.2–1.4x
Gemma 4 Unified 12B (gemma4_unified) gemma-4-12B-it-assistant-4bit ~39 ~74 ~1.87x

The gain is smaller than the ~3x reported on an idle H100 (Apple Silicon decode is bandwidth-bound), but it is consistently above 1.0x.

Change

  • mtp_b1_burst_enabled() now defaults to on; MLXCEL_ENABLE_MTP_B1=0 (or false/no/off) opts out, for lower-bandwidth Apple Silicon where the B=1 verify forward may not pay for itself.
  • Dropped the supports_batching() gate from the scheduler decline, so the decline fires only when B=1 MTP is explicitly disabled.
  • The batched B>1 path is unchanged (still off by default; open greedy-parity gap on the 31B).

Verification (real models, M5 Max)

  • 31B, default (no env var): MTP burst engages → 36.6 tok/s; MLXCEL_ENABLE_MTP_B1=0: declines to classic → 26.6 tok/s; 1.38x, output byte-identical.
  • 12B Unified path unchanged (already default-on).
  • cargo fmt/clippy --lib/check clean; release build links.

Docs

  • New report: docs/benchmark_results/gemma4-mtp-speculative-decoding.md (12B Unified, 31B, and external H100/vLLM reference numbers, with the hardware analysis).
  • Updated docs/environment-variables.md (MLXCEL_ENABLE_MTP_B1 is now default-on / opt-out) and docs/benchmarks.md.

The singleton (B=1) MTP burst was declined by default for batch-capable
targets (e.g. Gemma 4 31B) behind MLXCEL_ENABLE_MTP_B1, from an earlier
"B=1 is slower" calibration. Apple Silicon (M5 Max) measurement shows B=1
MTP is profitable there with byte-identical output at temperature 0:
~1.2-1.4x on the 31B + bf16 assistant and ~1.87x on the 12B Unified pair.

Flip mtp_b1_burst_enabled() to default-on (opt out with
MLXCEL_ENABLE_MTP_B1=0) and drop the supports_batching() gate from the
scheduler decline, so B=1 MTP runs by default for every MTP target. The
batched B>1 path stays off by default (unchanged greedy-parity gap).

Add a Gemma 4 MTP speculative-decoding report (12B Unified, 31B, and the
external H100/vLLM reference numbers) and update the env-var docs.
@inureyes inureyes added type:performance Performance improvements area:models Model architectures, weights, loading, metadata priority:medium Medium priority labels Jun 4, 2026
@inureyes
inureyes merged commit 1d3d470 into main Jun 4, 2026
4 checks passed
@inureyes
inureyes deleted the perf/b1-mtp-default-on-all-targets branch June 4, 2026 15:38
@inureyes inureyes added this to the 0.1 milestone Jun 21, 2026
@inureyes inureyes self-assigned this Aug 31, 2026
@inureyes inureyes added the status:done Completed label Sep 6, 2026
be-free-snowboy pushed a commit to freestylejs/snowbrain-mlxcel that referenced this pull request Oct 27, 2026
lablup#159)

The singleton (B=1) MTP burst was declined by default for batch-capable
targets (e.g. Gemma 4 31B) behind MLXCEL_ENABLE_MTP_B1, from an earlier
"B=1 is slower" calibration. Apple Silicon (M5 Max) measurement shows B=1
MTP is profitable there with byte-identical output at temperature 0:
~1.2-1.4x on the 31B + bf16 assistant and ~1.87x on the 12B Unified pair.

Flip mtp_b1_burst_enabled() to default-on (opt out with
MLXCEL_ENABLE_MTP_B1=0) and drop the supports_batching() gate from the
scheduler decline, so B=1 MTP runs by default for every MTP target. The
batched B>1 path stays off by default (unchanged greedy-parity gap).

Add a Gemma 4 MTP speculative-decoding report (12B Unified, 31B, and the
external H100/vLLM reference numbers) and update the env-var docs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:models Model architectures, weights, loading, metadata priority:medium Medium priority status:done Completed type:performance Performance improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant