Skip to content

Add Mellum 2.1 support - #697

Merged
davidkoski merged 1 commit into
ml-explore:mainfrom
aleroot:mellum2.1
Oct 16, 2026
Merged

davidkoski merged 1 commit into
ml-explore:mainfrom
aleroot:mellum2.1

Conversation

@aleroot

@aleroot aleroot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Proposed changes

This adds support for JetBrains Mellum 2.1 , a 12B-total / 2.5B-active MoE model built for coding agents. It mixes full-attention and sliding-window layers, and dense and sparse feed-forward layers.

Shared change (QuantizedVocabularyProjection.swift)

  • The quantized vocabulary projection now accepts 6-bit weights as well as 4 and 8. The 6-bit community checkpoint needs this to use the fast path. Qwen3PrefillLogitsTests now also covers 6 bits.

Performance

Tested on a MacBook Pro M4 Pro with 24 GB, macOS 26.6.2, on AC power, at commit d7f68bc. The model is [mlx-community/Mellum2.1-12B-A2.5B-Thinking-6bit](https://huggingface.co/mlx-community/Mellum2.1-12B-A2.5B-Thinking-6bit), built in Release. Prompts are real Swift source from this repo. Each run uses greedy decoding for 256 tokens on a fresh cache, after one warm-up. Each figure is the median of 3 runs.

Prompt tokens Time to first token Prefill Decode Peak memory
128 0.16 s 802 tok/s 98.7 tok/s 10.05 GB
1,024 0.84 s 1,212 tok/s 95.4 tok/s 10.37 GB
4,096 3.58 s 1,144 tok/s 90.4 tok/s 10.45 GB
16,384 16.0 s 1,024 tok/s 84.9 tok/s 10.65 GB

These use the default GenerateParameters, which prefill in 512-token chunks. Setting parameters.prefill.stepSize = 2048 makes prefill about 2–6% faster at 1k–4k tokens (1,291 and 1,170 tok/s) and cuts time to first token to 0.79 s and 3.50 s. The 128-token prompt is not affected.

Loading from the page cache takes about 2 s, and the weights occupy 9.9 GB once loaded.

Youtube Video showcasing the model

Checklist

Put an x in the boxes that apply.

  • I have read the CONTRIBUTING document
  • I have run pre-commit run --all-files to format my code / installed pre-commit prior to committing changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the necessary documentation (if needed)

AI usage

  • I have read this PR description in full and approve it as my own, and it
    accurately describes the code changes.
  • AI usage disclosure:

@davidkoski davidkoski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change looks good, thank you!

@davidkoski
davidkoski merged commit 11b2eda into ml-explore:main Oct 16, 2026
4 checks passed
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>
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants