Skip to content

perf(mimo): default-on decode kernels and target-only adaptive serial MTP - #1282

Merged
Gajesh2007 merged 2 commits into
masterfrom
claude/mimo-decode-kernels-mtp
Oct 1, 2026
Merged

Gajesh2007 merged 2 commits into
masterfrom
claude/mimo-decode-kernels-mtp

Conversation

@jonathan308

@jonathan308 jonathan308 commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Two native MiMo V2.6 decode fixes, both output-identical:

  1. Default-on short-forward decode kernels (+6.3% short / +5.5% 4K decode, every request). The SDK already ships three MiMo decode kernels: fused residual/RMS norms, distinct-expert MXFP4 decode and the FP32 router GEMV. Each matches the stock operation it replaces for one-request 1–7-row shapes and falls back everywhere else. They were exact-1 opt-ins that no LaunchAgent forwarded, so production decode never used them. The pinned SDK now enables them by default. This PR forwards the three rollbacks (0/false/no/off) to the launchd provider job.
  2. Stable MTP-on decode for greedy requests. Native MiMo verifies drafts serially: every draft column costs one ordinary [1, 1] target forward. An adaptive serial round therefore cannot commit tokens faster than target-only decode. The adaptive controller still sometimes locked onto depth-3 serial rounds for a whole process, and greedy decode fell to 25–27 tok/s. nativeMiMoMTPConfig now sets the SDK's new allowsAdaptiveSerialRounds: false. MTP stays enabled and active with live assistant history, but adaptive plans no longer launch serial rounds. Explicit rectangular verification (opt-in) keeps adaptive depth.

Based on current master b1c14ed8 (includes #1272, #1280, #1281, #1285, #1286 and #1287). SDK: Layr-Labs/mlx-swift-lm#206 (kernels) → Layr-Labs/mlx-swift-lm#207 (MTP knob, stacked), both now merged. This PR pins mlx-swift-lm main 1ee8675a, which contains #206, #207 and #219 (landed through Layr-Labs/mlx-swift-lm#246) and #245.

Evidence

M3 Ultra (60-core GPU), 256 GiB, EigenLabs/MiMo-V2.6-Flash-MOPD-MLX-4bit-mtp@bb37ffc7, Release build of this branch (darkbloom 0.9.13, SHA256 e18c32e8…, source-matched mlx.metallib 38ceb8a1…), start --local --foreground on loopback, default concurrency, residency default from #1272. Every row below is a fresh server process. Temperature 0, reasoning off, 256 completion tokens, cold prompts (unique nonce, cached_tokens = 0). Decode is HTTP-derived: (completion_tokens − 1) / (last − first streamed token).

This change on master 08653fc2 (includes #1280 prefix caching and #1281 media fix)

Rebased onto 08653fc2 (SDK pin 52d689a = #207 on SDK main with #205). Release darkbloom SHA256 5c977cff…, same metallib, fresh server per row, prefix_cache_status = ready. With Gaj's media fix, all eight media cases are admitted on this 256 GiB host, so the kernels now have a full multimodal A/B.

Since these measurements, the branch was rebased onto 1e4b2d88 and then onto b1c14ed8. #1286 changes only coordinator code, docs and the changelog, not provider-swift. The SDK commits were also reformatted for the lint job: swift-format line wrapping only, token-identical apart from a trailing comma in one test's array literal.

Config Greedy 10 Reasoning-on 8 Media 8 (image PNG/JPEG, audio ×3, video+AAC, silent video, image+audio) Short decode 4K decode MTP counters
MTP off, three rollbacks =0 10/10 reference reference (all 200) 42.11 / 42.12 / 42.20 40.78 / 40.62 / 40.57 —
MTP off, defaults (kernels on) 10/10 8/8 8/8 identical 44.56 / 44.45 / 44.54 (+5.6%) 42.76 / 42.82 / 42.37 (+4.9%) —
MTP auto (default) 10/10 8/8 8/8 identical 39.38 / 39.54 / 39.58 37.84 / 37.77 / 37.92 0 rounds, 6,783 seeds, adaptive_serial_suppressed 6,782

The tables below were measured before the rebase, on #1272's head plus this change with prefix caching off (binary e18c32e8…).

Decode kernels (MTP off), same binary, interleaved rollback/default pairs

Pair Rollback (=0 ×3) short Default short Rollback 4K Default 4K
1 42.54 / 42.69 / 42.68 44.13 / 44.25 / 44.31 41.05 / 41.01 / 41.12 42.21 / 42.39 / 42.52
2 42.04 / 42.04 / 42.03 45.09 / 45.12 / 44.81 40.40 / 40.43 / 40.23 42.97 / 42.27 / 42.61
3 41.99 / 41.90 / 41.96 45.39 / 45.30 / 45.29 40.35 / 40.38 / 40.21 43.55 / 43.40 / 43.48
mean 42.21 44.85 (+6.3%) 40.58 42.82 (+5.5%)

An earlier binary (same SDK kernels via environment) measured 41.8 → 45.4 short and 40.5 → 43.2 at 4K, and each kernel alone was also output-identical. Norms alone gave +4.4%, experts +6.7% and the router +4.5%.

MTP auto (default) before and after

Process Short decode 4K decode MTP counters (whole run)
Before, fresh process (kernels on) 27.41 / 26.71 / 26.58 25.32 / 24.95 / 26.51 depth 3, 1,205 serial rounds, 3,566 proposed, 63% accepted
Before, fresh process (#1272 binary, kernels off) 26.21 / 26.17 / 25.27 23.60 / 25.96 / 25.61 depth 3, 550 serial rounds
After, fresh process 1 39.59 / 39.81 / 39.50 37.63 / 37.68 / 37.93 0 rounds, 7,088 seeds, adaptive_serial_suppressed 7,087
After, fresh process 2 39.32 / 39.38 / 39.43 37.64 / 37.77 / 37.61 0 rounds, 7,038 seeds, adaptive_serial_suppressed 7,037

A third "before" process on the older binary declined every offer and decoded at 37.8 tok/s without the kernels. So the before behavior depended on the process, while the after behavior is stable. MTP-on greedy decode still pays the persistent-history seed step (about 10% below MTP off) because MTP stays on by default. Sampled requests (temperature > 0) were never eligible for MiMo MTP (no target-prefix acceptance) and are unaffected by item 2.

Output identity

Check Result
Greedy, 8 short prompts + 5K and 9K-token ledger prompts, 256 tokens, vs the MTP-off kernels-off reference 10/10 identical, MTP off and MTP auto, both fresh MTP processes
Reasoning on (enable_thinking=true), 8 prompts, 512 tokens, content AND reasoning SHA-256 vs the same binary with the three rollbacks 8/8 identical (MTP off; MTP auto ×2)
Audio (WAV PCM8 22.05 kHz mono, PCM16 24 kHz mono, F32 48 kHz stereo) vs rollback 3/3 identical, all 200
Image / video Before the rebase, 503 in every configuration on this 256 GiB host (pre-existing over-estimate, fixed by SDK #205 / #1281). On the rebased commit all image, video and image+audio cases return 200 and are identical with the kernels on and off (table above).

Before

flowchart TD
  A["Greedy MiMo request, mtp_mode = auto"] --> B["Adaptive marginal policy"]
  B -->|"first depth-0 cost sample inflated"| C["h ≈ 0: depth-3 serial rounds for the process lifetime"]
  C --> D["4 target forwards per round: 25–27 tok/s"]
  B -->|"cost sampled cleanly"| E["declines offers, seeds history: ~38 tok/s"]
  F["Any decode step"] --> G["Stock norms, router matmul and SwitchGLU (kernels opt-in, never forwarded)"]
  classDef bad fill:#fee2e2,stroke:#991b1b,color:#111827
  class C,D,G bad
Loading

After

flowchart TD
  A["Greedy MiMo request, mtp_mode = auto"] --> B["nativeMiMoMTPConfig: allowsAdaptiveSerialRounds = false"]
  B --> C["Adaptive plans stay target-only; MTP active, history live"]
  C --> D["39–40 tok/s short, stable across processes"]
  E["Any decode step (1–7 rows, one request)"] --> F["Fused norms + distinct-expert MXFP4 + router GEMV, bit-identical to stock"]
  F --> G["+6.3% short / +5.5% 4K; rollbacks forwarded to launchd"]
  classDef good fill:#dcfce7,stroke:#166534,color:#111827
  class C,D,F,G good
Loading

Unchanged: explicit fixedDraftTokens still runs serial rounds (qualification oracle), rectangular opt-in keeps adaptive depth, mtp_mode = off still disables MTP, batched decode (B > 1) and prefill keep the stock kernels, and no weights, quantization, KV format, sampler or output handling change.

Requalified on master b1c14ed8 (includes #1285, which pins SDK #208)

Full stack: #1282 + #1289 + #1299, with SDK #206/#207/#219/#245 rebased onto SDK main e31a1732. Fresh server per run, on the same M3 Ultra. The reference is clean master b1c14ed8 with MTP auto.

Check Full stack, MTP off vs MTP auto Full stack vs master
20 prompts × 512 tokens, reasoning off 20/20 identical 20/20 identical
5K / 9K / 20K-token prompts 3/3 3/3
Reasoning on, 8 × 512 (content and reasoning) 8/8 8/8
Media (image PNG/JPEG, audio ×3, video+AAC, silent video, image+audio) 8/8, all 200 8/8, all 200
API surface (15 cases) and 4 solo prompts 19/19 19/19
4-way concurrent batch 4/4 3/4 (see note)

Note on the concurrent row: master's own two builds differ on the same prompt, and each run produced one stable output over three concurrent repeats. This is batch composition, not a regression.

Decode tok/s (256 tokens) Short 4K 20K 50K
master b1c14ed8, MTP auto 37.3 35.8 32.7 —
Full stack, MTP off 45.3 43.4 38.1 —
Full stack, MTP auto (default) 49.9 46.3 40.7 34.1

MTP auto on the full stack: 7,659 rounds, 13,660 tokens proposed, 73.8% accepted.

Rollback

  • Kernels: DARKBLOOM_MIMO_FUSED_DECODE_NORMS=0, DARKBLOOM_MIMO_DECODE_EXPERTS=0, DARKBLOOM_MIMO_DECODE_ROUTER_GEMV=0 (each independent, forwarded to the launchd provider job).
  • MTP: revert this PR's nativeMiMoMTPConfig line (SDK default allowsAdaptiveSerialRounds: true restores the previous controller behavior).

Test plan

  • swift build -c release --product darkbloom --force-resolved-versions and ./scripts/fetch-metallib.sh release; darkbloom --version 0.9.13.
  • swift build --build-tests --force-resolved-versions with the source-matched metallib staged into every test bundle.
  • LaunchAgentEnvironmentTests|LaunchAgentServicePlistTests|LaunchAgentRestartTests|WatchdogAgentPlistTests|excludesInferenceControls: 31 passed, including the new forwardsMiMoDecodeKernelRollbacksToProviderJob.
  • MiMoV26RectangularVerifyPolicyTests: 4 passed, including the new testNativeMTPConfigKeepsAdaptiveSerialPlansTargetOnly.
  • MTPConfigTests|MiMoV26NormalEntrypointTests: 20 swift-testing + 8 XCTest passed. testSelectedSidecarNormalInspectionBindsRealHeaderWithoutClaimingPayloadAuthentication is fixture-gated (MIMO_V26_MANAGED_AUDIO_FIXTURE_ROOT from prepare-mimo-audio-fixtures.py, CI's audio job) and was not run locally.
  • CI-equivalent native MiMo gates through scripts/run-nested-suite.sh (fails on zero executed or any skip): residency (5), residency host fault, launchd, wired device context (cpu-retire, gpu-retire, cpu-retire-foreign, one fresh process each), startup, memory admission, media admission, complete prefix (asymmetric fixtures), retained fault. All passed.
  • SDK suites on the pinned stack: see the SDK PRs.
  • Full model: tables above (fresh process per row).

🤖 Generated with Claude Code

@vercel

vercel Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
d-inference Ready Ready Preview Oct 1, 2026 5:35pm UTC
d-inference-console-ui-dev Ready Ready Preview Oct 1, 2026 5:35pm UTC
d-inference-landing Ready Ready Preview Oct 1, 2026 5:35pm UTC
eigen-homepages-darkbloom Ready Ready Preview Oct 1, 2026 5:35pm UTC

Request Review

@jonathan308
jonathan308 force-pushed the claude/mimo-decode-kernels-mtp branch from e8b01af to 3bbac81 Compare September 30, 2026 20:41
@jonathan308
jonathan308 force-pushed the claude/mimo-decode-kernels-mtp branch from 3bbac81 to c7021ac Compare October 1, 2026 00:31
… MTP

Pin mlx-swift-lm to the stack that enables the exact MiMo short-forward
decode kernels by default and adds `CBv2MTPConfig.allowsAdaptiveSerialRounds`.

- Forward the three kernel rollbacks (`DARKBLOOM_MIMO_FUSED_DECODE_NORMS`,
  `DARKBLOOM_MIMO_DECODE_EXPERTS`, `DARKBLOOM_MIMO_DECODE_ROUTER_GEMV`,
  `0`/`false`/`no`/`off`) to the launchd provider job, so an installed
  provider can restore the stock path.
- Build every native MiMo MTP config through `nativeMiMoMTPConfig`, which
  keeps adaptive plans target-only under serial-target scoring. Each serial
  draft column costs one ordinary target forward, so those rounds could only
  slow decode (25-27 tok/s when the controller locked onto depth 3). MTP stays
  constructed and active with live assistant history; the rectangular opt-in
  keeps adaptive depth.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Threat model review — advisory

Reviewed head 7b401cec6013 against base b1c14ed896e8.

Review not completed for this head. Previous findings are superseded, not confirmed resolved.
Scan incomplete: one or more configured reviewers did not finish; completed reviewers' findings are shown below

Reviewers: anthropic/claude-opus-5.5: incomplete (review unavailable); openai/gpt-6-astra: incomplete (review unavailable)

Scan incomplete: 1 file(s) could not be fully read as text. Binary, Git LFS and submodule changes require manual review.
Affected files: libs/mlx-swift-lm

Models: anthropic/claude-opus-5.5, openai/gpt-6-astra. Findings require human validation; this review never requests changes or blocks merging.

mlx-swift-lm main now contains #206, #207 and #219 (landed through #246) and
#245. Pin it instead of the stacked SDK branch commit. The pinned tree is
identical to the SDK validated with this stack.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Gajesh2007
Gajesh2007 merged commit 8029598 into master Oct 1, 2026
25 of 28 checks passed
@Gajesh2007
Gajesh2007 deleted the claude/mimo-decode-kernels-mtp branch October 1, 2026 18:18
jonathan308 added a commit that referenced this pull request Oct 1, 2026
#1282 and #1299 were squash-merged into master, so this PR's copy of #1282
conflicted. Conflicts resolved to #1289's versions of configuration.md,
LaunchAgent.swift and its tests, and MiMoV26RectangularVerifyPolicyTests.swift
(master changed each by exactly #1282's diff; the auto-merge had duplicated
testNativeMTPConfigKeepsAdaptiveSerialPlansTargetOnly). CHANGELOG keeps master
and adds this PR's section. The net diff against master is exactly #1289's
reviewed change; the SDK pin stays at mlx-swift-lm main 1ee8675a.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch was successfully deployed

4 active deployments
Preview – d-inference — 7b401cec Deployed Oct 1, 2026 by vercel[bot]
Preview – eigen-homepages-darkbloom — 7b401cec Deployed Oct 1, 2026 by vercel[bot]
Preview – d-inference-console-ui-dev — 7b401cec Deployed Oct 1, 2026 by vercel[bot]
Preview – d-inference-landing — 7b401cec Deployed Oct 1, 2026 by vercel[bot]
benchmarks — 7b401cec Deployed Oct 1, 2026 by jonathan308 via E2E Benchmarks #2072
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants