Skip to content

Accept dense JANGH gate and up banks in named mmap - #21

Merged
jjang-ai merged 3 commits into
mainfrom
claude/dense-jangh-gate-up-mmap
Oct 7, 2026
Merged

jjang-ai merged 3 commits into
mainfrom
claude/dense-jangh-gate-up-mmap

Conversation

@jjang-ai

@jjang-ai jjang-ai commented Oct 7, 2026

Copy link
Copy Markdown

Change

Allow named mmap regions for dense JANGH gate/up/down projection banks, including the language_model. prefix used by dense Qwen bundles. Previously those names were rejected while K2 down-projection names were accepted.

The change retains layer-index validation, the one-expert constraint, packed/scales dtype and byte-length checks, and routed-bank matching.

Validation

Source: 0b94c12cbd4040407f9426306ba43bcec8d1feb9, mlx/io/safetensors.cpp.

Executed locally on Apple Silicon through the integrated Swift runtime: JANGHDenseNamedMmapTests.testDenseNamesRetainMappedOwnershipAndRejectInvalidBanks passed. It checks accepted dense names, mapped ownership/lifetime, invalid prefixes and indices, expert count, dtype and truncated byte spans. Local receipt: /Users/eric/vmlx-private-evidence/qwen-spec-review-20261007/engine-tests002.log (the named-mmap test passes; the larger invocation separately has an unrelated cache regression and test-runner metallib failures, which are being addressed in the Swift integration).

This is a loader-name fix. It does not claim model generation, cache or performance qualification; those remain in the downstream Swift/app integration.

Eric added 3 commits October 7, 2026 00:01
The named-region mmap admitted one-expert dense JANGH banks only for
down_proj (K2-Horizon). Qwen3.8-27B-JANGH2 is a dense qwen3_5 model whose
MLP gate_proj, up_proj and down_proj are all jangtq2 banks, stored under
the VLM prefix language_model.model.layers.N.mlp.*. Those names were
rejected, so the bundle could not load.

The dense pattern now accepts gate/up/down with an optional
language_model. prefix. Layer indices still reject leading zeros and
overflow, and routed experts keep their own pattern.
@jjang-ai
jjang-ai merged commit 5aba1ef into main Oct 7, 2026
10 checks passed
@jjang-ai

jjang-ai commented Oct 7, 2026

Copy link
Copy Markdown
Author

Merged as 5aba1ef. The merged tree is identical to tested head cda1b47.

SOURCE EVIDENCE: mlx/io/safetensors.cpp accepts only the dense gate/up/down namespaces and keeps the one-expert/rank/dtype constraints. tests/load_tests.cpp covers both namespaces, all three projections, packed/scales, invalid names and invalid bank shapes. The dense test is now explicitly included in fork-runtime-contracts.yml.

LIVE EVIDENCE: fork CPU runtime contracts passed all 15 selected cases. Lint, Fedora aarch64/x86_64 and ASAN/UBSAN passed. Local macOS JANGHDenseNamedMmapTests also passed against this implementation through the Swift C API. macOS jobs in GitHub were skipped, not counted as passes.

This proves the mapping contract; it does not claim full Osaurus model qualification, which continues in osaurus-ai/vmlx-swift#565.

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