Skip to content

Run Inkling 2 Mini text on MLX - #67

Merged
ekzhang merged 2 commits into
ekzhang:mainfrom
samiamjidkhan:mlx-inkling2
Nov 22, 2026
Merged

ekzhang merged 2 commits into
ekzhang:mainfrom
samiamjidkhan:mlx-inkling2

Conversation

@samiamjidkhan

Copy link
Copy Markdown
Contributor

Inkling 2 Mini text now runs on Apple Silicon through the Engine. Inkling2MlxRunner keeps the checkpoint's NVFP4/MXFP8 experts packed, reproduces the CUDA activation quantizer, and serves paged global and sliding-window attention with prefix reuse and overlapped decode. The recipe gains text_only so the MLX preset rejects images. DSpark speculation is not included, so that checklist step stays open for a follow-up, as do images.

Checked against the CUDA package's model on CPU (only its kernels replaced): on the real checkpoint each visit's attention and experts match within 0.53% relative, with the same greedy tokens (opt-in test, plus ad hoc runs to 2,100 tokens). Kernel tests at Mini's widths match the CUDA CPU references; Engine tests cover byte-exact cache reads, attention against an unsliced reference, cached vs fresh and overlap vs sync parity, and no new kernel variants for unseen lengths or sampling values. MMLU-100: 86 correct.

M4 Max, 8K context: 35.6 / 60.6 / 97.6 / 129.6 / 140.1 tok/s at batch 1/2/4/8/16, about 1.1× to 1.58× llama.cpp (Q4_K_M converted from the same checkpoint); prefill 529–539 tok/s at 4–8K. Long-prompt prefill (316 tok/s at 32K) is the main follow-up.

samiamjidkhan and others added 2 commits November 23, 2026 00:19
Inkling2MlxRunner serves Inkling 2 Mini text through the Engine on one Apple
Silicon GPU, following the CUDA runner's arithmetic.

- Experts stay packed: the checkpoint's NVFP4/MXFP8 bytes are MLX nvfp4/mxfp8
  weights, and a Metal kernel reproduces the CUDA activation quantizer.
- 48 looped layer visits with depth mixes and message controllers.
- Engine cache groups for global KV, sliding-window KV and convolution
  history; chunked prefill, prefix reuse and overlapped decode.
- LiveStates is shared with the Qwen3.5 runner.
- The inkling2 recipe gains text_only; the inkling2-mini-mlx preset uses it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Paged flash-decoding attention with relative bias, window bounds and the
  sink's log-sum-exp; banded and causal prefill attention.
- Fused convolution, depth-mix, RMS norm, routing, expert activation and
  combine kernels, and a BF16 vocabulary GEMV with FP32 output.
- Exactly dequantized per-expert FP32 GEMMs for prefill chunks of 512 or
  more tokens.
- Kernel tests at Mini's widths, multi-page cache tests, a compile-stability
  test and an opt-in real-checkpoint test against the CUDA model on CPU.
- README with validation, MMLU and benchmarks against llama.cpp; NOTICE.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ekzhang

ekzhang commented Nov 22, 2026

Copy link
Copy Markdown
Owner

My man!

@ekzhang
ekzhang merged commit e2f020b into ekzhang:main Nov 22, 2026
4 checks passed
@samiamjidkhan
samiamjidkhan deleted the mlx-inkling2 branch November 23, 2026 06:43
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.

2 participants