Repository navigation
fix(fusion): Preserve scaled NVFP4 projections - #705
Merged
davidkoski merged 1 commit intoOct 16, 2026
Merged
Conversation
Reject projections with global scales during fusion preparation. The current fused projection and checkpoint view constructors do not retain those scalars, so keep the original modules and parameters.
davidkoski
approved these changes
Oct 16, 2026
davidkoski
left a comment
Member
There was a problem hiding this comment.
Fix looks good, thank you!
wballard
added a commit
to swissarmyhammer/mlx-swift-lm-old
that referenced
this pull request
Oct 23, 2026
Apply the upstream commits 6e338e5..d02948b as a 3-way patch. CLAUDE.md is excluded. - 1dc19ef fix(fusion): Preserve scaled NVFP4 projections (ml-explore#705) - 11b2eda Add Mellum 2.1 support (ml-explore#697) - 48114ee Read transformers 5 keys in LFM2-VL configs (ml-explore#695) - bb0d5b0 fix loratrain for tiny prompts (ml-explore#683) - d02948b Generate JSON properties in the schema's declared order (ml-explore#718) No conflicts. Mellum makes only KV and sliding-window caches, so the post-merge ArraysCache.advance checks do not apply. Tests: MLXLMTests 874 XCTest and 1717 Swift Testing tests pass. MLXGuidedGenerationTests 70, MLXFoundationModelsTests 374, CXGrammarTests 7, MLXHuggingFaceMacrosTests 5 pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
spokvulcan
added a commit
to spokvulcan/mlx-swift-lm
that referenced
this pull request
Oct 27, 2026
Upstream ml-explore#705 keeps a projection with an NVFP4 global scale out of the fused projections, and tests it with QuantizedLinear(globalScale:). The pinned spokvulcan/mlx-swift (0.31.6 base) has no global scale on QuantizedLinear, so no projection can carry one: this reverts the guard and its test. Fork-only; drops when the pin reaches mlx-swift 0.32.
ximyro
pushed a commit
to ximyro/mlx-swift-lm
that referenced
this pull request
Nov 4, 2026
Brings in ml-explore#622 (exact prefix rewinds in rotating KV caches), ml-explore#619 (streaming detokenizers), ml-explore#698, ml-explore#699, ml-explore#700, ml-explore#701, ml-explore#705, ml-explore#697 and ml-explore#695. Conflicts: AttentionUtils.swift keeps TurboKV telemetry next to upstream's SharedAttentionKVCache; KVCache.swift takes upstream's serialization and rotating-cache view/trim while keeping the fork's TurboQuant state, public cache fields and temporallyOrdered. Follow-ups for upstream behavior the fork had changed: the Qwen2VL audio placeholder no longer indexes content.count - 1 when a tool-call message has no text part, and Gemma4MessageGenerator uses content parts for every non-system role. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.
Fusion preparation currently drops
QuantizedLinear.globalScalefrom the fused projection and its checkpoint views. A scaled NVFP4 projection can therefore change output and lose itsglobal_scalecheckpoint key after preparation.Reject projections with a global scale until the fused representation can preserve it. The original modules keep their output and checkpoint data. The regression covers a scaled first projection and a scaled later projection through the existing Qwen3.5 consumer; it fails on unchanged upstream and passes with only this guard.
Validation: the new regression and existing Qwen3.5 fusion tests passed with normal package/plugin validation. Formatting uses CI's swift-format 603.0.0 and
pre-commit run --all-files.AI usage: Codex assisted with source investigation, implementation, regression tests, and local validation.