Repository navigation
Add Mixtral (sparse MoE) model - #378
Merged
Merged
Conversation
Port of mlx-lm's mixtral.py: Mistral-style attention (GQA, RoPE, no bias) with a sparse MoE block — gate (no bias) → top-k → softmax over the selected expert logits → SwitchGLU. Mirrors the in-tree PhiMoE structure; differs in using RMSNorm (not LayerNorm), plain RoPE (not SuScaled), bias-free projections, and optional tied embeddings. sanitize() stacks per-expert w1/w2/w3 (weight/scales/biases) into switch_mlp.gate_proj/down_proj/up_proj, so both full-precision and pre-quantized Mixtral checkpoints load. Registered as "mixtral". Tests (MixtralTests): forward-pass logits shape on a synthetic 1-layer config, and sanitize() expert-stacking shape/key remap. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
Author
|
End-to-end validation (real weights). Loaded
Byte-exact match including the quantized expert-stacking sanitize path. |
dkgv
pushed a commit
to dkgv/mlx-swift-lm
that referenced
this pull request
Jul 30, 2026
Port of mlx-lm's mixtral.py: Mistral-style attention (GQA, RoPE, no bias) with a sparse MoE block — gate (no bias) → top-k → softmax over the selected expert logits → SwitchGLU. Mirrors the in-tree PhiMoE structure; differs in using RMSNorm (not LayerNorm), plain RoPE (not SuScaled), bias-free projections, and optional tied embeddings. sanitize() stacks per-expert w1/w2/w3 (weight/scales/biases) into switch_mlp.gate_proj/down_proj/up_proj, so both full-precision and pre-quantized Mixtral checkpoints load. Registered as "mixtral". Tests (MixtralTests): forward-pass logits shape on a synthetic 1-layer config, and sanitize() expert-stacking shape/key remap. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
div0-space
pushed a commit
to LibraxisAI/mlx-swift-lm
that referenced
this pull request
Nov 29, 2026
Brings ml-explore#378 up to the SDK the provider pins for 0.10.12. No conflicts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
div0-space
pushed a commit
to LibraxisAI/mlx-swift-lm
that referenced
this pull request
Nov 29, 2026
…d-buffers No conflicts: ml-explore#398 touches none of ml-explore#378's files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
div0-space
pushed a commit
to LibraxisAI/mlx-swift-lm
that referenced
this pull request
Nov 29, 2026
…-command-buffers CBv2: Nemotron 3.5 plain decode commits by operation count; complete checkpoints stay native
div0-space
pushed a commit
to LibraxisAI/mlx-swift-lm
that referenced
this pull request
Nov 29, 2026
…ed-row-reads ml-explore#378 (Nemotron 3.5 Lightning: plain decode commits by operation count; complete checkpoints stay native) merged at 19:11Z. Its four files are disjoint from this branch's; Lightning's checkpoints now stay native, so they do not take the coded path this branch changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
div0-space
pushed a commit
to LibraxisAI/mlx-swift-lm
that referenced
this pull request
Nov 29, 2026
…t-batched-row-reads CBv2: a lossy checkpoint export reads rows in batches and codes them on several cores (same bytes). Merged by an agent with the owner's approval (11-10) after the independent review (review-stream-tail.md: approve, merge after ml-explore#378 as a merge commit); Fork Tests 42882853010 on 781c382: success, all 10 shards.
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.
Proposed changes
Adds the Mixtral sparse-MoE architecture (
model_type: "mixtral") to MLXLLM — a port of mlx-lm'smixtral.py. This covers the Mixtral-8x7B / 8x22B family, which currently has no Swift implementation.Structure mirrors the in-tree
PhiMoE: Mistral-style attention (GQA, RoPE, bias-free) with a sparse MoE block —gate(no bias) → top-k → softmax over the selected expert logits →SwitchGLU. It differs from PhiMoE in usingRMSNorm(notLayerNorm), plainRoPE(not SuScaled), bias-free projections, and optional tied embeddings.sanitize()stacks the per-expertw1/w2/w3tensors (weight/scales/biases) intoswitch_mlp.gate_proj/down_proj/up_proj, so both full-precision and pre-quantized Mixtral checkpoints load.Tests (
MixtralTests, runs without downloading a model): forward-pass logit shape on a synthetic 1-layer config, andsanitize()expert-stacking shape/key remap. Verified viaxcodebuild test ... -only-testing:MLXLMTests/MixtralTests→ 2 tests, 0 failures, TEST SUCCEEDED.Checklist
pre-commit run --all-filesto format my code / installed pre-commit prior to committing changes