Repository navigation
Preserve MiMo paged histories through rollback and phase transfer - #344
Closed
jonathan308 wants to merge 3 commits into
Closed
jonathan308 wants to merge 3 commits into
jonathan308 wants to merge 3 commits into
Conversation
javiech1
pushed a commit
to javiech1/mlx-swift-lm
that referenced
this pull request
Oct 24, 2026
… Gemma3 / Qwen2VL / LFM2VL / Pixtral / Mistral3) (Layr-Labs#344) Honor windowSize for chunked prefill in 6 MLXVLM models Single-pass prefill allocates transient buffers proportional to prompt length; chunking to windowSize=512 reduces peak memory from ~17.7 GB to ~5.1 GB on an 8k-token Gemma4 prompt (Layr-Labs#336). Extends the Gemma4/Layr-Labs#337 loop pattern to remaining single-pass models: - FastVLM, Gemma3, Qwen2VL, LFM2VL: embed-only path - Pixtral, Mistral3: inputIds + inputsEmbeds path Deferred (need non-trivial tensor slicing): Qwen25VL, GlmOcr, Qwen35, Qwen3VL, Paligemma.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MiMo cluster paging previously covered plain target decode only. This draft gives the model-owned target cache a checked rollback/transfer contract and makes the trained assistant history policy explicit, so speculative and phase execution can retain paged storage without changing standalone defaults.
The target cache preserves physical full/sliding storage, write index and absolute offset. A rollback must remove a valid suffix of the last complete append. Transfer validates every incoming layer before installing fresh recipient owners. Assistant copies and accepted-prefix compaction detach actual page roots; the contiguous prefix checkpoint codec rejects paged state. Tests exercise unequal K/V widths, wrapped sliding histories, subsequent drafts and ownership release.
Depends on SDK #343, targeting its immediate branch
fix/cluster-independent-history-batching. The provider integration is a separate child of d-inference #1567.Before
After
Validation: 10 actual SDK CPU tests in three suites passed. The combined provider test closure passed 11 Runtime CPU tests in four suites, including actual four-layer BF16 affine8/MXFP4 target continuation and phase handoff. SDK, Runtime, fresh VLM, Worker and Qualification modules compiled. Two older unquantized BF16 routed-target cases were excluded from CPU because the pinned GatherMM CPU implementation lacks that operation; no GPU pass is inferred.
Canonical targeted suites include
MiMoV26IndependentHistoryTestsandMiMoV26MTPPagedHistoryTestsunderTests/MLXLMTests/Integration/MiMo/; the SDK test-layout checker passes. The recorded checks used isolated compiled closures with an explicit CPU device, not a claim that ordinaryswift testavoids Metal. Reproduction entry point on a configured Mac:Two reciprocal independent reviews cover the initial implementation and the other author's completion changes. They found and fixed an underpriced verification-window allowance in the provider integration and leave no unresolved source/refactor finding. Frozen SDK patch SHA-256:
a0812d6cd82350f5108f9df9cf31d3c5a580e75c4eb4919b2338e451a3fa61d2.Draft limitation: this is source/CPU validation. The complete 173GB artifact, installed c06 worker, both-host GPU execution, JACCL phase handoff, retirement observations and useful throughput remain unqualified. Numeric comparisons, standalone SDK defaults and GLM-specific code are unchanged; shared compatibility is not inferred from excluded-model testing.
Publication follow-up: signed head
ebdc2d49258bfd5e267034db0b33d8c81f538f03merges the formatted parent and retains all six reviewed MiMo file postimages transformed only by the SDK formatter. GitHub formatting and fork checks pass; full build/test and full-artifact hardware gates remain separate.