Skip to content

fix(mimo): learn target prefill with bounded idle admission - #1285

Merged
Gajesh2007 merged 8 commits into
masterfrom
codex/mimo-media-deadline-accounting
Oct 1, 2026
Merged

Gajesh2007 merged 8 commits into
masterfrom
codex/mimo-media-deadline-accounting

Conversation

@Gajesh2007

@Gajesh2007 Gajesh2007 commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

Summary

Fix native MiMo first-token admission so short-text prefill rates do not stand in for measured native-media target performance. SDK #208 is merged. The submodule is pinned to SDK main commit e31a1732462ff702428692cc758abe4609559b5f; its source tree is identical to the tested candidate 23332c3.

  • Retain native target-prefill observations separately from text, including numeric workload buckets for diagnosis. Admission and the completion receipt share one snapshot; any eligible sample owner, including an ordinary request, can clear a prior failed-bootstrap cooldown only at its own retirement.
  • Use only cold, unpacked, non-preempted observations with exclusive whole-Mac ownership and one continuously observed nominal AC/Automatic power epoch. The actual engine phase starts after media preparation.
  • Retain up to 32 individually timed samples per existing size band. Choose the slowest fresh rate, only inside the actually observed prompt range; new observations cannot rejuvenate old samples. No extrapolation from a tiny prompt to a large media prompt.
  • Pass a target-only rate to the SDK. Existing queued prefill/decode retain their own rates, and changes in ownership, device work or posture invalidate the grant.
  • When native evidence is missing, permit at most one genuinely idle native request to acquire evidence under the original absolute deadline; failed or ineligible attempts back off for 120 seconds per engine. An eligible sample clears the backoff only at actual retirement, allowing new shapes to build an observed range. Retain ownership through post-commit cancellation transfers.
  • Track native encoder preparation as unbounded device activity; a failed prepared/request drain independently retains activity at its actual failure transition, even after preparation ended. Keep memory, cache, trust, cancellation and absolute deadline checks.

Companion coordinator media-token accounting PR #1286 is merged and included in the updated base. This PR does not hardcode a global MiMo token multiplier, change production configuration, bump a version, or publish a provider release.

Production evidence

The original failing cohort included coordinator estimates of 309/1,511 tokens versus provider-prepared counts of 1,095/3,604. One subsequent successful request under the temporary longer SLA had 4,045 prepared tokens and 2.912 seconds of media preparation. Its predictor used 155.136 tokens/sec (26.074 seconds projected target work), while actual target prefill took 4.848 seconds (~834 tokens/sec), and first content arrived at 8.305 seconds. That is one observed sample, not a universal speedup or a calibrated error envelope.

Before

flowchart LR
  A["Image / video / audio"] --> B["Native media preparation"]
  B --> C["Expanded target prompt"]
  T["Short-text isolated EWMA"] --> D["One rate prices all prefill"]
  C --> D
  D --> E["Potential premature deadline refusal"]
  F["Successful media target prefill"] --> G["visionChunks drops rate sample"]
  classDef input fill:#dbeafe,stroke:#2563eb,color:#111827
  classDef process fill:#ede9fe,stroke:#7c3aed,color:#111827
  classDef outcome fill:#fee2e2,stroke:#dc2626,color:#111827
  class A,T input
  class B,C,D,F process
  class E,G outcome
Loading

After

flowchart LR
  A["Owner-sealed native prompt"] --> B["Whole-Mac + posture guard"]
  B --> C{"Fresh observed native range?"}
  C -->|yes| D["SDK prices only target at native rate"]
  C -->|no| E{"Idle + bootstrap permit + capacity?"}
  E -->|yes| F["One observation under original deadline"]
  E -->|no| G["Capacity refusal"]
  D --> H["Real prompt-completion receipt"]
  F --> H
  H --> I["Separate native samples and numeric buckets"]
  H --> J["Release ownership only at real retirement"]
  K["retainAfterFailedDrain"] --> L["Reservation retains shared activity"]
  L -->|invalidate| B
  classDef input fill:#dbeafe,stroke:#2563eb,color:#111827
  classDef process fill:#ede9fe,stroke:#7c3aed,color:#111827
  classDef outcome fill:#dcfce7,stroke:#16a34a,color:#111827
  class A input
  class B,C,D,E,F,K,L process
  class H,I,J outcome
Loading

Validation

  • swift build --target ProviderCore -j 4 and swift build --build-tests -j 4 passed with the signed SDK candidate; the tested candidate 23332c3 and merged main pin e31a173 have identical source trees.
  • Focused provider learner, whole-Mac guard, deadline admission and retirement coverage: 36 tests passed with swift test --skip-build --no-parallel --filter 'nativeMedia|EngineDeadlineRetirementBridgeTests|EngineV2FirstTokenDeadlineAdmissionTests|EngineV2PrefillSamplingTests'.
  • Real native MiMo fixture coverage: 3 tests passed, including bootstrap -> learned same shape -> new shape -> measured interior range; actual target/KV/owner seals; unchanged text EWMA; atomic refusal and original deadline; foreign capability and off-policy compatibility.
  • Broader native encoded-media ingress suite: 11 tests passed in four consecutive runs (the separate audiovisual fixture case was excluded explicitly). The first broader run exposed a tiny-fixture warmed rate above the unchanged 20,000 tokens/sec plausibility ceiling; short synthetic prompts fixed the test premise. No production rate guard was changed.
  • python3 scripts/test-provider-ci-workflow.py: 19 tests passed, including the actual wrapper with a long regex/suite-path selector and preserved nonzero, no-skip and failure-exit checks. CI now explicitly selects all three new provider deadline/learning cases and the complete SDK native-media deadline suite.
  • SDK native media deadline suite: 14 tests passed at 23332c3, including target-versus-queued-text rates, stale/range/guard checks, bootstrap idle/busy/in-flight checks, physical capacity, original-clock expiry, post-commit cancellation and real retirement.
  • Coordinator native-media bucket retention/text-rate isolation regression passed.
  • make docs-impact-check BASE=origin/master, make docs-check (324 files) and git diff --check passed.

Tests use synthetic tiny BF16 native fixtures and a source-matched metallib, not a full-size MiMo production benchmark. Native tests preserve real physical/allocator/OS observations and normal memory floors; only the nominal power-history input is controlled for deterministic admission. Hosted CI and review remain separate gates.

Native fixture selection, after building and staging the source-matched metallib (set MIMO_V26_SERIAL_LOAD_FIXTURES to the directory produced by scripts/prepare-mimo-provider-fixtures.py):

MIMO_V26_SERIAL_NATIVE_TESTS=1 swift test --skip-build --no-parallel --filter 'MiMoV26EncodedMediaIngressTests/(testNativeIdleBootstrapLearnsRealTargetRateAndKeepsTextRateIsolated|testNativePreparedSealReachesRealAtomicDeadlineRejectionWithoutLosingCharge|testTypedDeadlineGatePreservesRawTextAndOffPolicyAndRefusesForeignCapability)'

The SDK merge dependency is resolved. The branch includes current d-inference master (1e4b2d885), with both changelog entries retained. Hosted checks for the latest head still determine merge readiness.

Both initial review findings were fixed in signed commit a391babc0, with regressions for ordinary-sample retirement ownership and snapshot consistency. The final 36 focused tests and 11 native ingress cases passed after those fixes.

The previous provider CI failure was mktemp: File name too long for the expanded native filter. run-nested-suite.sh now uses a fixed temporary-file prefix and passes the original filter unchanged; no test selection or success/skip gate is weakened.

Latest review follow-up

  • b79c693a6 binds late media-drain failures to their own retained shared activity, with the real SDK failure callback covered after preparation ends.
  • Native online measurements use explicit five-second nominal AC/Automatic posture plus current exclusive device ownership. They do not borrow the reviewed text catalog's 20-second recovery proof; that text policy remains unchanged. Both policies have regression coverage.
  • On this head: swift build --build-tests -j 4 passed; 64 Swift Testing + 12 XCTest cases passed in the focused deadline/media-reservation selection; 11 native media ingress cases passed. make docs-impact-check BASE=origin/master, make docs-check (324 files), and git diff --check passed.
  • The previous head was approved and CI-green. This follow-up needs its fresh hosted checks and review before merge.

Telemetry and rollout

native_media_prefill is an additional closed workload phase. No prompt text, media bytes, URLs, token IDs or cache keys are retained. The bootstrap uses existing not_attempted / unmeasured_prefill diagnostic vocabulary, carries actual bounded token work and omits any fabricated predicted duration or rate. Go ingestion accepts those existing fields; there is no new profiler wire field or database migration.

SDK #208 is merged and pinned. A provider release is required to activate the new learner/admission path. Older coordinators discard only the unknown workload diagnostic phase. Production SLA changes and later release qualification are separate operations.

@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 12:50am UTC
d-inference-console-ui-dev Ready Ready Preview Oct 1, 2026 12:50am UTC
d-inference-landing Ready Ready Preview Oct 1, 2026 12:50am UTC
eigen-homepages-darkbloom Ready Ready Preview Oct 1, 2026 12:50am UTC

Request Review

@Gajesh2007
Gajesh2007 marked this pull request as ready for review September 30, 2026 21:34
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-01T00:54:27.980253Z b79c693 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Threat model review — advisory

Reviewed head b79c693a61ba against base 1e4b2d885c38.

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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 98083de158

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Gajesh2007

Copy link
Copy Markdown
Member Author

@codex review

Please review final head a391babc0. Both findings from the prior review are fixed and covered by focused regressions. The intervening test commit also made the tiny native fixture stable after kernel warmup and added the native deadline cases to CI selections. SDK #208 remains the merge dependency.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: a391babc0d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

jonathan308
jonathan308 previously approved these changes Sep 30, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3f1fde8709

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Gajesh2007
Gajesh2007 merged commit ef394c1 into master Oct 1, 2026
37 checks passed
@Gajesh2007
Gajesh2007 deleted the codex/mimo-media-deadline-accounting branch October 1, 2026 01:06

This branch was successfully deployed

4 active deployments
Preview – d-inference — b79c693a Deployed Oct 1, 2026 by vercel[bot]
Preview – d-inference-landing — b79c693a Deployed Oct 1, 2026 by vercel[bot]
Preview – eigen-homepages-darkbloom — b79c693a Deployed Oct 1, 2026 by vercel[bot]
Preview – d-inference-console-ui-dev — b79c693a Deployed Oct 1, 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.

3 participants