Skip to content

perf: per-hardware default for the B=1 MTP burst (M1 Ultra measurements) - #216

Merged
inureyes merged 2 commits into
mainfrom
fix/issue-165-mtp-b1-per-hardware-default
Jun 11, 2026
Merged

inureyes merged 2 commits into
mainfrom
fix/issue-165-mtp-b1-per-hardware-default

Conversation

@inureyes

Copy link
Copy Markdown
Member

Closes #165

Measurements (Apple M1 Ultra, 128 GB)

Block size 4, temperature 0, 160 decode tokens, streamed through the release server. Decode tok/s = (N - 1) / (T_N - T_1): the MTP burst path emits tokens in lumps, so inter-token client timing is unusable there; a 1-token request (T_1) absorbs the prefill cost identically in both modes.

31B + bf16 assistant (gemma-4-31b-it-4bit + gemma-4-31B-it-assistant-bf16): consistent regression.

Prompt classic tok/s MTP B=1 tok/s speedup
explain speculative decoding 18.2 15.6 0.86x
hash table 18.2 17.4 0.96x
Romeo and Juliet summary 18.1 13.7 0.75x
TCP vs UDP 18.0 16.3 0.91x

12B Unified + 4-bit assistant: still profitable (~1.1 to 1.4x on prompts with stable prose; this local checkpoint produces degenerate output on some prompts, which were excluded).

The issue hypothesized memory bandwidth as the discriminator, but the M1 Ultra has datacenter-class bandwidth (~800 GB/s) and still regresses: the real discriminator is GPU compute generation. The drafter forward plus the K-wide verify forward do not pay for themselves on pre-M5 GPU cores.

Change: per-hardware default

mtp_b1_burst_enabled now takes the target's batching capability and defaults per hardware (pure decision core mtp_b1_default, unit-tested as a decision table):

  • Non-batchable targets (the 12B Unified family, whose only decode path is B=1): default on everywhere (measured profitable on both chip classes).
  • Batch-capable targets (the 31B): default on only on M5+ (the existing hardware::get_hardware().has_neural_accelerator generation signal); pre-M5 falls back to classic decode.
  • MLXCEL_ENABLE_MTP_B1 remains an explicit override in BOTH directions (any non-0/false/no/off value forces on; those values force off).

Live verification on this M1 Ultra with the new build, no env set: the 31B serves at classic speed (18.7 to 19.2 tok/s, decline log fires), the 12B Unified keeps MTP speed (45.5 / 38.1 tok/s).

Byte-identity note

Temperature-0 outputs on M1 Ultra are NOT always byte-identical between classic and MTP (several word-choice-level divergences). This is the evaluation-path fp jitter documented during #203: the MTP verify computes logits through a [1, K] forward while classic uses [1, 1] steps, and near-tie argmaxes flip more readily on this GPU class (the same runs were byte-identical on M5 Max). Documented in the benchmark page; output quality is unaffected.

Docs

  • docs/benchmark_results/gemma4-mtp-speculative-decoding.md: new M1 Ultra section (methodology, tables, default policy, jitter note), summary-table defaults updated.
  • docs/environment-variables.md: MLXCEL_ENABLE_MTP_B1 entry rewritten for the per-hardware default.

Acceptance criteria

  • Measured on an M1-class chip for both pairs (classic vs MTP tok/s): done, tables above.
  • Default adapts per hardware with no silent regression for pre-M5 chips: done, live-verified.
  • MLXCEL_ENABLE_MTP_B1 remains an explicit override: yes, both directions, covered by the decision-table unit test.

@inureyes inureyes added type:performance Performance improvements priority:medium Medium priority area:models Model architectures, weights, loading, metadata labels Jun 11, 2026
@inureyes
inureyes merged commit 317a15f into main Jun 11, 2026
@inureyes
inureyes deleted the fix/issue-165-mtp-b1-per-hardware-default branch June 11, 2026 02:33
@inureyes inureyes added this to the 0.2 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
…ts) (lablup#216)

* perf: per-hardware default for the B=1 MTP burst (M1 Ultra measurements)

* docs: qualify the 26B-A4B default with the per-hardware policy
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.

perf: validate B=1 MTP default-on on lower-bandwidth Apple Silicon (M1/M2)

1 participant