Skip to content

Prepare paged checkpoints and observed forward receipts for 0.9.0 - #141

Merged
Gajesh2007 merged 12 commits into
mainfrom
release/0.9.0-validation
Sep 7, 2026
Merged

Gajesh2007 merged 12 commits into
mainfrom
release/0.9.0-validation

Conversation

@Gajesh2007

@Gajesh2007 Gajesh2007 commented Sep 6, 2026 •

Copy link
Copy Markdown
Member

This prepares native paged KV storage, complete prefix checkpoints and recurrent/MTP state handling for the 0.9.0 provider. Allocation-aware reserves, storage ownership and asynchronous retirement share explicit contracts; diagnostics record actual completed target-forward axes so requested batch width cannot stand in for executed width.

Completed-forward receipts survive MTP rollback and cost sampling, scopes are rejected while readback is pending, and the fixtures exercise real tiny-model KV state. The Swift dependency includes the FP32-partial SDPA fix and pins the merged core and C bridge revisions.

Before

flowchart LR
  Request[Request] --> Logical[Logical token reservation]
  Logical --> State[KV and recurrent state]
  State --> Reuse[Partial checkpoint reuse]
  Step[Target forward] --> Guess[Requested axes used as execution evidence]
  Pin[Previous Swift pin] --> Partial[Low-precision SDPA partial storage]
Loading

After

flowchart LR
  Request[Request] --> Reserve[Allocator-aware reserve and settlement]
  Reserve --> State[Typed KV segments and recurrent ownership]
  State --> Checkpoint[Complete checkpoint adoption or rollback]
  State --> Retire[Retire owned work before refund]
  Step[Completed target forward] --> Receipt[Observed axes and scoped forward receipt]
  Receipt --> MTP[Retain through rollback and cost sampling]
  Pin[Reviewed Swift pin] --> Partial[FP32 SDPA partial storage]
Loading

Source and validation

  • Earlier tested publication: 138abee8eea74b7cc72805f4e10195ba4dad4b71, Swift pin d1d40d0ee2de101c5d9a04eb66d9e1b4299c6074. Reversing this single package revision recovers the exact native source tree at f2d79145e040bbc28c6e0e355a19bc8923a70434; no native implementation/test bytes differ from the reviewed candidate.
  • Fresh canonical native SwiftPM compilation against the reviewed candidate core/Swift and fresh metallib passed all 13 existing Qwen D256 precision cases with no skips or tolerance changes. The tests retain original-query FP32 reference bounds, boundary/GQA fault rejection and exact fixed/segmented placement assertions. The scope is synthetic B1/QL1, not whole-model trajectory equivalence.
  • Candidate provider integration passed 93 focused functions across eight suites, including 50 analytic SDPA subcases. Complete dependency/source/compiled-graph/resource identities and owned process retirement were checked. Historical evidence remains associated with its original source.
  • The current default serving cohort is five paged models, with default SSD caching limited to the three Qwens. That provider policy and the Gemma QAT ordinary/serial verifier fix live in parent PR #851, not this native package-pin append. Gemma 8-bit is outside this release validation cohort.

Remaining release validation

Real-model backend/MTP trajectory diagnostics, cache integrity, B2/B4 concurrency, quality and sustained/lifecycle checks retain their separate outcomes. Exact generated wording is diagnostic, not a universal release gate. The D256 precision pass does not relabel a failed full-model trajectory comparison as passing. This native PR is ready for review; remaining release-wide validation is tracked in parent PR ml-explore#851. Signing/package-distribution work is separate.

Companions: core PR #16 and Swift PR #21.

Evidence: candidate D256 precision report, published with the companion parent update.

Merged dependency pins

Current signed HEAD 85e3cfe67fbe721d86683bb2b8bd17f7ddffe2dd pins merged Swift 37572f1f10a6c485ac4cc254cad63e8242643a6f from Swift PR #21. The merged Swift tree is exactly e79138e9e2dc6d705084c5d3cf365cebac3c8bd3, identical to tested Swift 80981062b21ba8ccf4fff40f715dab495b38fb07, including its core/C gitlinks. This append changes only the Package.swift revision; reversing that replacement recovers the previous native tree exactly. No inference implementation or test bytes change, and model tests were not rerun for this pin-only append.

Signed publication snapshot of reviewed source 32206d90ff69b4f42bb7703a18ac88e317358b8a. Original milestone history remains preserved locally. Only dependency publication pins differ: Package.swift.
Append-only signed publication of reviewed source 30ca217c5072c727d0eff29dc92789af5e98f2c9. Preserves the existing publication parent and original milestone history. Only reviewed dependency pins are replaced with their signed publication equivalents.
@Gajesh2007 Gajesh2007 changed the title Prepare 0.9.0 paged KV, complete checkpoints and numerical diagnostics Prepare 0.9.0 paged checkpoints and corrected quantized runtime pins Sep 6, 2026
Append-only signed publication of reviewed source ba5c03ea0ef495aca02c99c7a2dd2b7a32bc7668. Preserves the existing publication parent and original milestone history. Only reviewed dependency pins are replaced with their signed publication equivalents.
@Gajesh2007 Gajesh2007 changed the title Prepare 0.9.0 paged checkpoints and corrected quantized runtime pins Prepare 0.9.0 paged checkpoints and recurrent teacher peak accounting Sep 6, 2026
@Gajesh2007 Gajesh2007 changed the title Prepare 0.9.0 paged checkpoints and recurrent teacher peak accounting Prepare paged checkpoints and observed forward receipts for 0.9.0 Sep 6, 2026
@Gajesh2007
Gajesh2007 marked this pull request as ready for review September 6, 2026 21:39
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 6, 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-09-06T21:48:40.697216Z 138abee Draft marked ready
ℹ️ 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.

@Gajesh2007
Gajesh2007 merged commit 6aa60ee into main Sep 7, 2026
3 checks passed
@Gajesh2007
Gajesh2007 deleted the release/0.9.0-validation branch September 7, 2026 03:48
davidtai added a commit that referenced this pull request Sep 9, 2026
Brings #139 (GPT-OSS prefill pruning, fused experts, per-request timing) and
#141 (paged checkpoints, complete-checkpoint prefix reuse, observed forward
receipts) onto the Qwen 3.8 Flash-Next runner branch. Every conflict keeps
both sides: main's new parameters and fields are threaded through the
branch's keep-mask and MTP-audit paths, and the branch's parameters are
threaded through main's new call sites.

Conflicts and resolutions

- Package.swift: keep the branch's sibling-checkout `mlxSwiftDependency`
  helper and move main's pinned mlx-swift revision 37572f1f into its remote
  fallback. Every product and target from both sides is retained.
- Libraries/MLXLMCommon/Load.swift: keep both new protocols — the branch's
  `WeightNameFiltering` and main's `IncrementalCheckpointMaterializing`.
- Libraries/MLXLLM/Models/Qwen35MTPTopTwo.swift: keep main's delegation to
  the shared `cbv2TopTwoRows` and keep the branch's `public` access level,
  which the out-of-fork Qwen 3.8 model files need.
- Libraries/MLXLMCommon/ContinuousBatchingV2/AttentionV1.swift: one merged
  signature per call layer — `keepMask` (branch) beside `metadata`/`packet`
  (main) on `updateAndAttend`, `updateAndAttendRow` and `attend`, threaded
  through every call site.
- Libraries/MLXLMCommon/ContinuousBatchingV2/LayerCacheV2.swift: pass both
  `keepMask` and the observation handles to `CBv2AttentionV1.updateAndAttend`.
  A keep-masked forward now refuses the capture by name
  (`keep_masked_attention_not_replayable`) instead of beginning one: the
  replay reference in `CBv2AttentionReplay` attends the whole retained KV
  with no mask, so a sparse keep mask can never replay from its receipt.
- Libraries/MLXLMCommon/ContinuousBatchingV2/CBv2Contracts.swift: keep the
  branch's prefix-outcome documentation and add main's `pagedStorage` field
  to `CBv2CapacitySnapshot`, including its initializer parameter and store.
- Libraries/MLXLMCommon/ContinuousBatchingV2/EngineLoopV2.swift: take main's
  resident prefix preview plan, `adoptedHybridTokens`, paged-stage capacity
  skip, per-row diagnostic and attention confirmations, chained-step
  `forwardShapes`, and `pagedStorage` gauge, all beside the branch's
  per-request timing stamps.
- Libraries/MLXLMCommon/ContinuousBatchingV2/EngineV2.swift: take main's
  hybrid and complete prefix-cache lookup routing inside the branch's timed
  `makePrefixLookup`.
- Libraries/MLXLMCommon/ContinuousBatchingV2/SchedulerV2.swift: keep the
  branch's `enqueuedNanos` and main's `reserveFullSequenceTokens` on
  `CBv2ScheduledRequest.init` and on `enqueue`.
- Libraries/MLXLMCommon/ContinuousBatchingV2/MTP/EngineLoopV2+MTP.swift:
  call the now-throwing `mtpBuildRoundGraph` with `try`.
- Libraries/MLXLMCommon/ContinuousBatchingV2/MTP/EngineLoopV2+MTPExecution.swift:
  make `mtpBuildRoundGraph` throwing and call `multimodalChunkForward` with
  `try`, as main does.
- Libraries/MLXLMCommon/ContinuousBatchingV2/MTP/EngineLoopV2+MTPFinalize.swift:
  keep the branch's round-audit comment above the shared `mtp.recordRound`
  call that carries the audit record.
- Libraries/MLXLMCommon/ContinuousBatchingV2/MTP/EngineLoopV2+MTPTargetVerification.swift:
  take main's per-column evaluation-target list, which adds the logit
  diagnostic targets, and keep the branch's host-sync counter after it.

Manifest capability decode

#141 added `supportsRecurrentCheckpointReuse` and `requiresNativePagedKV` to
`CBv2ModelCapabilities`. The branch's Engine Protocol v1 manifest fixture,
`Tests/MLXRunnersTests/Resources/engine-wire-v1-adapter.manifest.json`, is
pinned byte for byte against benchd and states only the six engine flags the
v1 wire shape froze (`RunnerManifest.canonicalJSON` still emits exactly
those six). The synthesized decoder therefore refused the pinned file and
`MockRunner` trapped. `CBv2ModelCapabilities` now has an explicit
`init(from:)` that keeps the six frozen flags mandatory and defaults any
flag added after the freeze. The fixture bytes and every digest are
unchanged.

BenchLoad fix

`Sources/BenchLoad/main.swift` carried an `@main` type but is named
`main.swift`, which makes the module a top-level-code module.
`xcodebuild build-for-testing` rejected it with "'main' attribute cannot be
used in a module that contains top-level code". The file holds no top-level
statements, so it is renamed to `Sources/BenchLoad/BenchLoadMain.swift` —
the same shape `Sources/BenchCBv2/BenchCBv2Main.swift` already uses. No
behaviour change.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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