Skip to content

fix(provider): make typical MTP acceptance a per-model opt-in with an exact default - #1379

Open
davidtai wants to merge 4 commits into
masterfrom
fix/mtp-acceptance-per-model-opt-in
Open

davidtai wants to merge 4 commits into
masterfrom
fix/mtp-acceptance-per-model-opt-in

Conversation

@davidtai

@davidtai davidtai commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Typical MTP acceptance is now a per-model opt-in. The default is exact for every model.

David ruled on 2026-10-07: "do not default to typical, we haven't even benchmarked it yet. It needs to be toggled per model". He chose "per-model only".

This PR reverses the typical default from #1376. After #1376, a model with no setting used typical (delta 0.2). After this PR, a model with no setting uses exact.

  • Only [backend.mtp_acceptance_by_model] with an exact model ID selects a rule ("typical" or "exact"). Every other model uses exact.
  • The global [backend] mtp_acceptance key is retired. It still parses, so old provider.toml files load. It selects no rule. Startup logs one warning that tells the operator to use mtp_acceptance_by_model.
  • An unknown per-model value logs a warning and resolves to exact, as before.
  • A slot that cannot honour typical installs exact, logs one warning with the model ID and the reason, and reports exact in slot posture telemetry. A slot cannot honour typical when MTP is off for the slot, or when its drafter has supportsTargetPrefixAcceptance == false. Native MiMo is in the second case today. The check reads the drafter capability. It does not check the model family or the model name.
  • The benchmark-only DARKBLOOM_MTP_ACCEPTANCE override and its exact default do not change. Default eligible sampled MTP requests to typical acceptance #1376 did not change it either.

Before

flowchart TD
  subgraph Behavior
    A1[sampled request on an MTP slot] --> B1{per-model entry?}
    B1 -->|yes| C1[that rule]
    B1 -->|no| D1{global mtp_acceptance?}
    D1 -->|yes| E1[global rule]
    D1 -->|no| F1[typical, delta 0.2]
    C1 --> G1[CBv2MTPConfig.acceptance]
    E1 --> G1
    F1 --> G1
    G1 --> H1[posture mtp_acceptance = configured rule]
    G1 --> I1[drafter without target-prefix acceptance: sampled rows do not speculate, typical never applies, no warning]
  end
  subgraph Code
    P1[ProviderLoop / StandaloneServer / StartCommand] -->|mtpAcceptance + mtpAcceptanceByModel| Q1[EngineV2SlotFactory.makeProductionBundle]
    Q1 --> R1["MTPAcceptancePolicy.resolve(global:byModel:modelID:)"]
    R1 --> S1[CBv2MTPConfig acceptance set before the drafter is checked]
    Q1 --> T1[native MiMo: nativeMiMoMTPConfig drops the setting]
    U1[StandaloneServer+NativeMiMo] -->|no acceptance table, no loggers| Q1
  end
Loading

After

flowchart TD
  subgraph Behavior
    A2[sampled request on an MTP slot] --> B2{per-model entry?}
    B2 -->|typical| C2{MTP on and drafter supports target-prefix acceptance?}
    B2 -->|exact, unknown, or none| D2[exact]
    C2 -->|yes| E2[typical]
    C2 -->|no| F2[exact + one warning naming model and reason]
    D2 --> G2[posture mtp_acceptance = installed rule]
    E2 --> G2
    F2 --> G2
    K2[global mtp_acceptance in provider.toml] --> L2[ignored + one startup warning naming mtp_acceptance_by_model]
  end
  subgraph Code
    P2[ProviderLoop / StandaloneServer / StartCommand] -->|mtpAcceptanceByModel only| Q2[EngineV2SlotFactory.makeProductionBundle]
    R2["MTPAcceptancePolicy.resolve(byModel:modelID:)"]
    Q2 --> S2[EngineV2SlotFactory.installMTPAcceptance after the drafter is known]
    S2 --> R2
    S2 --> T2["MTPAcceptancePolicy.installation(requested:mtpEnabled:drafter:)"]
    Q2 --> U2[native MiMo contiguous and paged: installMTPAcceptance with the CBv2 binding assistant]
    V2[StandaloneServer+NativeMiMo] -->|mtpAcceptanceByModel + loggers| Q2
    W2[BackendSettings.RetiredCodingKeys mtp_acceptance] --> X2[RetiredKnobWarnings, once in Start.run]
  end
Loading

Changes

  • MTPAcceptancePolicy (provider-swift/Sources/ProviderCore/Inference/MTP/MTPAcceptancePolicy.swift)
    • resolve(byModel:modelID:) has no global input. A model without an entry resolves to exact.
    • Resolution.unrecognizedWarning(modelID:) gives one wording for an unknown value.
    • New installation(requested:mtpEnabled:drafter:) returns Installation(acceptance:fallback:). ExactFallbackReason is mtpOff or noTargetPrefixAcceptance. Installation.fallbackWarning(modelID:) gives the warning text.
    • benchmarkOverride(environment:) does not change.
  • EngineV2SlotFactory.installMTPAcceptance(byModel:into:drafter:modelID:logInfo:logWarning:) (EngineV2SlotFactory+MTP.swift) is the one call per slot. It resolves the model's entry, warns on an unknown value, runs installation, sets CBv2MTPConfig.acceptance, and logs the fallback warning or the existing typical info line.
  • Capability check call sites. Each one is the first point where the slot's drafter exists:
    • Autoregressive slots: EngineV2SlotFactory.makeProductionBundle (EngineV2SlotFactory.swift), after the MTP configuration is built, with assistantHandle?.drafter.
    • Native MiMo, contiguous and paged: makeNativeMiMoBundle and makeNativeMiMoPagedTargetBundle (EngineV2SlotFactory+Native.swift), inside native construction, right after binding.assistant is created. Both builders now receive the per-model table. Before, nativeMiMoMTPConfig dropped the setting. The prefix-cache setup keeps the base configuration; acceptance is not part of the checkpoint identity.
    • StandaloneServer+NativeMiMo.swift now passes mtpAcceptanceConfigByModel and the info and warning loggers.
  • The global key is retired:
    • BackendSettings.mtpAcceptance and StandaloneServerConfig.mtpAcceptance are removed.
    • mtp_acceptance is added to BackendSettings.RetiredCodingKeys: it parses for presence only and is not written back.
    • RetiredKnobWarnings.retiredBackendKeyMessage has its own wording for it. Start.run() emits it once per process, for every serving mode.
    • The factories no longer take an mtpAcceptanceConfig global parameter. ProviderLoop+EngineV2.swift, StandaloneServer.swift, StandaloneServer+MTPUpgrade.swift and StartCommand+Modes.swift pass only the table.
  • The benchmark session (EngineV2Factory+BenchmarkSessionConstruction.swift) maps its mtpAcceptanceConfig (default "exact") to [modelId: value]. --mtp-acceptance and DARKBLOOM_MTP_ACCEPTANCE keep their behaviour.
  • Docs (restamped with scripts/docs-stamp.sh):
    • docs/provider/cli-reference.md: the mtp_acceptance_by_model row, the retired-keys row, and the opt-in and rollback paragraph.
    • docs/reference/configuration.md: the engine and scheduler config rows, and the DARKBLOOM_MTP_ACCEPTANCE row.
    • docs/architecture/inference.md: the MTP acceptance paragraph.
    • docs/reference/telemetry-inventory.md: a new row for engine_v2_slot_posture and its mtp_acceptance field.
    • CHANGELOG.md: a new top Unreleased - per-model MTP acceptance opt-in entry that states the reversal of Default eligible sampled MTP requests to typical acceptance #1376.
  • Tests:
    • New MTPAcceptanceSlotInstallationTests. It builds real slots through EngineV2SlotFactory.makeProductionBundle, using a tiny random-init Gemma-4 target and a construction-only drafter double, and reads the installed rule from the real EngineV2 and from a real posture sample. It loads no model and runs no draft step.
    • MTPAcceptanceConfigTests: Default eligible sampled MTP requests to typical acceptance #1376's tests that expected the typical default now expect exact. The global-precedence tests are now per-model-only tests. New tests cover the global key warning, the capability check and serialization of the retired key.
    • MiMoV26RectangularVerifyPolicyTests: a new test covers the native MiMo configuration through installMTPAcceptance.

Validation

All runs are local on Apple Silicon. Heavy steps ran under lockf with DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer. Before each rebuild, the metallib staged inside the .xctest bundles was removed. After each build, scripts/stage-test-metallib.sh "$(swift build --show-bin-path)" ran.

Red on master (f57a6718 sources with the new tests added): 4 of the new tests fail with 16 issues.

  • unconfiguredModelInstallsExact: the engine installed .typical(delta: 0.2), and posture reported typical.
  • drafterWithoutTargetPrefixFallsBackToExact: the engine installed typical, and no warning was logged.
  • mtpOffSlotWarns: no warning was logged.
  • globalKeyIsIgnored: retiredKeysPresent == [], and no warning was logged.

The control tests passed on master: per-model typical with a capable drafter, per-model exact, and an unknown per-model value.

Green with this change:

Check Result
swift build --build-tests (provider-swift) pass
MTPAcceptanceSlotInstallationTests + MTPAcceptanceConfigTests 14/14 pass
MiMoV26RectangularVerifyPolicyTests (native MiMo config) 5/5 pass
Final tree, after the refactor pass: the filter over all suites below Swift Testing 148 tests in 16 suites pass; XCTest 13 run, 3 skipped, 0 failures
MTP and config suites: MTP config keys, MTP beta feature, supported set, EngineV2 production wiring (slot build, re-slicing, routing, runtime guards, KV degrade heartbeat), prefill deadline config, MTP posture telemetry, production benchmark MTP acceptance, provider MTP preparation, MTP re-slice fallback, ProviderLoop assistant upgrade, top-level config and retired-knob tests all pass
EngineV2MTPProductionAdmissionTests 13 run, 3 skipped (they need DARKBLOOM_EXCLUSIVE_NATIVE_GPU_TEST=1), 0 failures
EngineV2KVBackendGateTests (not touched by this PR) 22 tests fail with kernel_preflight: missing SwiftPM resource pagedattention.metal. The same 22 tests fail with the same 60 issues on unchanged master f57a6718 (a separate detached build). This is the test-bundle resource staging problem, not this change.
make docs-check 356 files OK
make docs-impact-check BASE=origin/master coverage OK

Not run:

  • The native MiMo fixture suites (MiMoV26ManagedSlotTests and related). They need MIMO_V26_SERIAL_NATIVE_TESTS and local MiMo fixtures. The native call sites are covered by the build and by the installMTPAcceptance test on nativeMiMoMTPConfig.
  • The radix-engine benchmark package was not built. It calls makeBenchmarkSession(mtpAcceptanceConfig:) and MTPAcceptancePolicy.parse, and both signatures do not change.

Refactor Pass

A dedicated refactor subagent reviewed the first version (0d7cc882). Its change is in 92b21f82. It changes no behaviour.

  • It removed duplicated logic. The per-model lookup and the unknown-value warning were in two places: the autoregressive factory and the native MiMo dispatcher. installMTPAcceptance now takes the per-model table and does both, so each slot makes one call. Both native MiMo builders take the table. On native MiMo, the unknown-value warning now comes after the CBv2 binding exists. The text and the count (one per slot) do not change.
  • It fixed one wrong test comment (PolicyDrafter) and re-wrapped one doc comment in ProviderConfig.swift.
  • It found no remaining reference to resolve(global:, BackendSettings.mtpAcceptance or config.mtpAcceptance in provider-swift or scripts/benchmarks, no dead parameters, and no duplicated warning text. It kept the names Installation, ExactFallbackReason and installation(requested:mtpEnabled:drafter:) without change.
  • Validation on the final tree: the provider-swift test build passed, and the focused filter passed (Swift Testing 148/148; XCTest 13 run, 3 skipped, 0 failures). make docs-check and make docs-impact-check BASE=origin/master passed.
  • Left open on purpose: docs/design/typical-mtp-acceptance.md is a design record with a frozen body, and it still describes the global key. The older Unreleased - typical MTP acceptance CHANGELOG bullet from Default eligible sampled MTP requests to typical acceptance #1376 is kept as written; the new top entry states the reversal.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

davidtai and others added 2 commits October 7, 2026 06:03
… exact default

David ruled on 2026-10-07: "do not default to typical, we haven't even
benchmarked it yet. It needs to be toggled per model." This reverses the
typical default from #1376.

- Every model resolves to exact unless [backend.mtp_acceptance_by_model]
  names its exact model id. MTPAcceptancePolicy.resolve no longer takes a
  global value.
- The global [backend] mtp_acceptance key is retired: it still parses,
  selects nothing, and RetiredKnobWarnings logs one startup warning that
  names mtp_acceptance_by_model.
- Capability check at the point where the slot's drafter is known
  (MTPAcceptancePolicy.installation, EngineV2SlotFactory.installMTPAcceptance):
  a typical rule installs exact with one warning when MTP is off for the slot
  or the drafter does not declare supportsTargetPrefixAcceptance. The
  autoregressive factory checks the loaded assistant; both native MiMo
  constructions (contiguous and paged) check their CBv2 binding's assistant,
  and the standalone native MiMo load now passes the per-model table and
  loggers. Posture telemetry reports the installed rule.
- The benchmark session maps its requested rule onto its one model, so
  DARKBLOOM_MTP_ACCEPTANCE and --mtp-acceptance keep the exact default.
- Docs: cli-reference, configuration, inference architecture, telemetry
  inventory row for engine_v2_slot_posture, CHANGELOG entry.

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

Refactor pass. The per-model lookup and the unknown-value warning were
written twice, in the autoregressive factory and in the native MiMo
dispatcher. installMTPAcceptance now takes the per-model table and does
the lookup, the warning, the capability check and the typical info line
in one call per slot. Both native MiMo builders take the table. Fix one
test comment and re-wrap one doc comment. No behaviour change.

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

vercel Bot commented Oct 7, 2026

Copy link
Copy Markdown

Deployment failed for project d-inference with the following error:

You don't have permission to create a Preview Deployment for this Vercel project: d-inference.

View Documentation: https://vercel.com/docs/accounts/team-members-and-roles

@davidtai
davidtai requested a review from Gajesh2007 October 7, 2026 11:22
@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Threat model review — advisory

Reviewed head 3ea54a61df47 against base c93380daba52.

Review not completed for this head. Previous findings are superseded, not confirmed resolved.
Service returned HTTP 409; no automatic paid retry

Models: budgeted Sonnet / selective Opus / selective Sol 6.1. Findings require human validation; this review never requests changes or blocks merging.

Coverage: 6/129 source units; cross-file integration pending. 0 selected depth batch(es) pending. All threat definitions indexed; relevant full definitions selected. Unchanged callers are not scanned.

Cost this run: $0.0000 reported, $0.0000 reserved with unknown cost; 0 paid request(s), 0 reused batch(es), 0 provider cache-hit tokens.

Saved findings and earlier report · Historical findings are not confirmed resolved.

Bedrock: 2 request(s), 102275 input / 1363 output tokens; 0 request(s) with unknown usage. OpenRouter backup used 0 time(s). Dollar amounts above cover OpenRouter only; AWS billing is reconciled separately.

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

vercel Bot commented Oct 9, 2026

Copy link
Copy Markdown

Deployment failed for project eigen-homepages-darkbloom with the following error:

You don't have permission to create a Preview Deployment for this Vercel project: eigen-homepages-darkbloom.

View Documentation: https://vercel.com/docs/accounts/team-members-and-roles

@vercel

vercel Bot commented Oct 9, 2026

Copy link
Copy Markdown

Deployment failed for project darkbloom-status with the following error:

You don't have permission to create a Preview Deployment for this Vercel project: darkbloom-status.

View Documentation: https://vercel.com/docs/accounts/team-members-and-roles

@vercel

vercel Bot commented Oct 9, 2026

Copy link
Copy Markdown

Deployment failed for project d-inference-landing with the following error:

You don't have permission to create a Preview Deployment for this Vercel project: d-inference-landing.

View Documentation: https://vercel.com/docs/accounts/team-members-and-roles

@vercel

vercel Bot commented Oct 9, 2026

Copy link
Copy Markdown

Deployment failed for project d-inference-console-ui-dev with the following error:

You don't have permission to create a Preview Deployment for this Vercel project: d-inference-console-ui-dev.

View Documentation: https://vercel.com/docs/accounts/team-members-and-roles

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

This branch was successfully deployed

No deployments
benchmarks — 3ea54a61 Deployed Oct 9, 2026 by davidtai via E2E Benchmarks #2504
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