Skip to content

provider: Gemma 4 coupled MTP drafting switch (off by default); re-pin mlx-swift-lm - #2828

Merged
jonathan308 merged 4 commits into
devfrom
gemma4/mtp-coupled-switch
Dec 2, 2026
Merged

jonathan308 merged 4 commits into
devfrom
gemma4/mtp-coupled-switch

Conversation

@jonathan308

@jonathan308 jonathan308 commented Dec 2, 2026 •

Copy link
Copy Markdown
Collaborator

What changes

  • libs/mlx-swift-lm moves to the SDK main merge commit 01abffbe1f (Layr-Labs/mlx-swift-lm PR feat(tools): enforce Gemma tool choices at inference #561). It adds
    CBv2MTPCoupledStepDrafter, which Gemma4CBv2MTPDrafter adopts. Only this pin moves: libs/mlx (72dffa2d)
    and libs/mlx-swift (b1c94d29) are unchanged, so the metallib is unchanged.
  • Gemma4MTPCoupledPolicy (new): DARKBLOOM_GEMMA4_MTP_COUPLED sets CBv2MTPConfig.coupledProposals for Gemma 4's
    drafter only, in EngineV2SlotFactory.makeProductionBundle beside Inkling 2's switch.
  • The LaunchAgent forwards the key; docs/reference/configuration.md, docs/architecture/inference.md and a
    changelog fragment describe it.

Default and switch

  • Off by default (Gemma4MTPCoupledPolicy.coupledByDefault = false). Inkling 2's coupled drafting is also off by
    default in production, and Gemma takes the SDK's step-drafter branch, not Inkling's block-drafter branch, so the
    default stays off until it is measured.
  • DARKBLOOM_GEMMA4_MTP_COUPLED: 1, true, yes, on enable; 0, false, no, off disable (trimmed, any
    case); other values keep the default. Never on for another drafter.
  • Output is the same with it on or off: exact acceptance commits only the target's draws. Only acceptance, and so
    speed, can move. Greedy rows, rows under a grammar and typical acceptance are unaffected.

Before / after

flowchart LR
  subgraph Before
    A1[sampled Gemma 4 row] --> B1[drafter proposes argmax]
    B1 --> C1[exact verify keeps the draft if it equals the keyed target draw]
  end
  subgraph After
    A2[sampled Gemma 4 row] --> K2{DARKBLOOM_GEMMA4_MTP_COUPLED}
    K2 -- off, default --> B2[drafter proposes argmax]
    K2 -- on --> D2[drafter proposes the keyed race of the verify draw]
    B2 --> C2[exact verify: same output]
    D2 --> C2
  end
Loading
flowchart LR
  subgraph Before
    F1[makeProductionBundle] --> M1[mtpConfig: coupledProposals false for Gemma]
  end
  subgraph After
    F2[makeProductionBundle] --> P2[Gemma4MTPCoupledPolicy.coupledProposals]
    P2 --> M2[mtpConfig.coupledProposals]
    M2 --> E2[EngineV2 plain-drafter branch: coupled draftStep when a selection exists]
  end
Loading

Tests

  • Gemma4MTPCoupledSwitchTests: the key, the off default, the pinned SDK's Gemma4CBv2MTPDrafter adopting
    CBv2MTPCoupledStepDrafter, no coupling without a Gemma 4 drafter, and the LaunchAgent forwarding the key.
  • EngineV2BenchmarkMTPAcceptanceTests: a benchmark session on a tiny Gemma 4 target and assistant has
    mtpEffectiveConfig.coupledProposals == false by default and true with DARKBLOOM_GEMMA4_MTP_COUPLED= ON ,
    with exact acceptance in both.
  • The SDK PR's engine test runs a real Gemma 4 pair with coupling on and off and gets the same tokens.

Validation

  • CI on this PR is the test run; no local provider build. swiftc -parse passes on the changed Swift files;
    scripts/changelog.py check passes with the base's fragments plus this one.

Limitations

  • The acceptance and speed gain on Gemma 4 is not measured on hardware here. A follow-up A/B at temperature 0.7 and
    1.0 decides the default.

Refactor pass

One independent review read of the diff before the commit (lean release mode); no separate refactor pass was run.


Prove it works
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Re-pin libs/mlx-swift-lm to the SDK main commit that adds
CBv2MTPCoupledStepDrafter, which Gemma4CBv2MTPDrafter adopts: in a round
with coupled proposals, a sampled row proposes the keyed race its verify
draw runs at that output index instead of the draft's argmax. Only the
mlx-swift-lm pin moves; mlx and mlx-swift are unchanged.

DARKBLOOM_GEMMA4_MTP_COUPLED turns it on for Gemma 4's drafter
(Gemma4MTPCoupledPolicy; 1/true/yes/on, 0/false/no/off; off by default),
as DARKBLOOM_INKLING_MTP_COUPLED does for Inkling 2 Mini. Output is the
same with it on or off: exact acceptance commits only the target's draws,
so only acceptance can move. The LaunchAgent forwards the key.

Tests: the policy's default, its Gemma-only rule and the LaunchAgent key;
a benchmark session built on a tiny Gemma 4 pair has coupling off by
default and on with the key set.
@jonathan308 jonathan308 added the run-ci Trigger one-shot PR CI run (auto-removed when run starts) label Dec 2, 2026
@vercel

vercel Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
d-inference-landing Ready Ready Preview Dec 2, 2026 2:10am UTC
darkbloom-status Ready Ready Preview Dec 2, 2026 2:10am UTC
eigen-homepages-darkbloom Ready Ready Preview Dec 2, 2026 2:10am UTC

Request Review

@github-actions github-actions Bot removed the run-ci Trigger one-shot PR CI run (auto-removed when run starts) label Dec 2, 2026
@jonathan308 jonathan308 added the run-ci Trigger one-shot PR CI run (auto-removed when run starts) label Dec 2, 2026
@github-actions github-actions Bot removed the run-ci Trigger one-shot PR CI run (auto-removed when run starts) label Dec 2, 2026
@jonathan308
jonathan308 changed the base branch from fix/kv-regrow-floors-dev to ink-engine/inkling-mtp-fixes December 2, 2026 01:53
libs/mlx-swift-lm moves to the mlx-swift-lm main that carries the
prefix-checkpoint stride (DARKBLOOM_PREFIX_CHECKPOINT_STRIDE, default all)
and Inkling 2's MTP-round command buffers (DARKBLOOM_INKLING2_MTP_CB_OPS,
default 400; 0 keeps MLX's defaults). No other SDK change rides the move.

LaunchAgent forwards both SDK-read keys (inferencePassthroughEnvKeys), so an
operator's rollback reaches a background provider. The configuration
reference gets a row for each key.

Tests: SDKInklingSpeedSwitchesTests (each key is forwarded when set and
absent when unset).
Brings in the base branch's head, the KV regrow floors work with its
sub-floor switch and that switch's LaunchAgent key, so this branch's tests
run on it. The merge is clean: nothing is resolved by hand.
Brings in the base branch's head so this branch is up to date with it. Both
sides add rows at the same place in docs/reference/configuration.md (after
DARKBLOOM_INKLING_MTP_COUPLED): the resolution keeps every row from both
sides. Every other file merges cleanly.
@jonathan308
jonathan308 changed the base branch from ink-engine/inkling-mtp-fixes to dev December 2, 2026 02:08
@jonathan308 jonathan308 added the run-ci Trigger one-shot PR CI run (auto-removed when run starts) label Dec 2, 2026
@github-actions github-actions Bot removed the run-ci Trigger one-shot PR CI run (auto-removed when run starts) label Dec 2, 2026
@jonathan308 jonathan308 added the run-ci Trigger one-shot PR CI run (auto-removed when run starts) label Dec 2, 2026
@github-actions github-actions Bot removed the run-ci Trigger one-shot PR CI run (auto-removed when run starts) label Dec 2, 2026
@jonathan308
jonathan308 merged commit c6e8f33 into dev Dec 2, 2026
44 of 63 checks passed

This branch was successfully deployed

3 active deployments
Preview – d-inference-landing — 1be13f79 Deployed Dec 2, 2026 by vercel[bot]
Preview – eigen-homepages-darkbloom — 1be13f79 Deployed Dec 2, 2026 by vercel[bot]
Preview – darkbloom-status — 1be13f79 Deployed Dec 2, 2026 by vercel[bot]
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.

1 participant