An MLX port of Moonshot's 2.78T-parameter multimodal MoE Kimi-K3, featuring 1M-token context and novel attention mechanisms, but requiring over 870GB of memory—currently impossible to run on any existing Apple Silicon Mac.

Stars

27

7-day growth

No data

Forks

1

Open issues

0

License

No data

Last updated

2026-07-28

Why it is worth attention

This repository demonstrates the most extensive porting of a frontier-scale MoE model to MLX, including bit-exact MXFP4 conversion, novel attention residual architecture, a fully validated vision tower, and REAP expert pruning—all documented with rigorous testing despite the model being too large to run on current hardware.

Who it is for

  • MLX and Apple Silicon developers
  • Researchers studying large MoE or attention residual architectures
  • Engineers porting massive models to limited memory ecosystems
  • Practitioners interested in expert pruning and calibration

Use cases

  • Verifying MXFP4 quantization accuracy via bit-exact round-trip
  • Testing REAP pruning with domain-specific calibration on a real 2.78T model
  • Studying the behavior of Kimi Delta Attention and Attention Residuals in MLX
  • Evaluating two-bank expert quantization for memory-constrained inference

Strengths

  • Bit-exact MXFP4 conversion verified end-to-end with zero error
  • Comprehensive 39-test suite covering architecture, vision parity, and wrapper
  • Detailed documentation of porting challenges and design decisions
  • REAP pruning with domain-targeted calibration, validated with generation examples

Considerations

  • No tier fits into any existing Apple Silicon Mac (minimum 870GB vs 512GB max unified memory)
  • Published tiers achieve only 0.14–0.20 tokens/sec, far from interactive use
  • 2-bit and mixed tiers involve double quantization; quality is unverified and may be poor

README quick start

kimi-k3-mlx

MLX (Apple Silicon) port of moonshotai/Kimi-K3 — Moonshot's 2.78T-total / 104B-active native-multimodal MoE, built on Kimi Delta Attention (KDA) and Attention Residuals (AttnRes), with a 1M-token context.

kimi_k3.py is a single, stock-mlx-lm-compatible model definition for the text tower; kimi_k3_vision.py is the vision tower and projector; kimi_k3_vl/ is the mlx-vlm wrapper that joins them. scripts/convert.py is a streaming converter — mlx_lm convert cannot be used here, because it materialises the whole model and K3 is 5.6 TB in bf16.

Read this before planning a deployment. Nothing in this repo runs on a single Mac. The smallest tier is ~870 GB against a 512 GB ceiling on the largest Apple Silicon machine that exists. See Reality check.

Architecture

FeatureDetail
MoE896 routed experts, top-16, moe_intermediate_size=3072; sigmoid router + aux-loss-free e_score_correction_bias; 2 shared experts on every token
Stable LatentMoErouted experts run in a 3584-d latent, not the 7168-d residual: down_proj → experts → RMSNormup_proj
Attention93 layers: 69 KDA + 24 gated MLA, 96 heads, head_dim=128
KDAshort conv (k=4) on q/k/v, low-rank forget gate (f_a/f_b), full-rank output gate, gate_lower_bound=-5.0
MLAq-LoRA rank 1536, kv-LoRA rank 512, NoPE (no rotary at all), sigmoid output gate (g_proj)
AttnResevery 12 layers pushes the residual onto a stack; each sub-layer input is a softmax mixture over that stack, scored by a rank-1 [1, 7168] direction
ActivationSiTU-GLU: β·tanh(g/β)·σ(g) · β_lin·tanh(u/β_lin), β=4, β_lin=25
Dense layerlayer 0 only (first_k_dense_replace=1, intermediate_size=33792)
Vocab163,840 · tiktoken · tie_word_embeddings=False
Source formatrouted experts ship as MXFP4 (weight_packed u8 + e8m0 weight_scale, group 32); everything else bf16

Parameter budget — 97.94% of the model is routed experts:

componentparamsshare
routed experts (MXFP4 in source)2722.7 B97.94%
KDA attention ×6930.6 B1.10%
shared experts12.2 B0.44%
MLA attention ×245.6 B0.20%
latent-MoE up/down4.7 B0.17%
embed + lm_head

Description

MLX port of moonshotai/Kimi-K3 (2.78T multimodal MoE): streaming converter, REAP expert pruning, and per-language expert-overlap analysis

Related repositories

Similar projects matched by category, topics, and programming language.

lopopolo
Featured
lopopolo GitHub avatar

harness-engineering

Harness Engineering is a methodology for improving coding agent outputs by carefully crafting the environment around them—providing curated context, tools, and executable constraints that encode an organization’s nonfunctional requirements and cumulative lessons.

AI & Machine LearningAI Agents
2,390
slvDev
Featured
slvDev GitHub avatar

esp32-ai

A 28.9 million parameter language model runs on an $8 ESP32-S3 microcontroller entirely on-device, generating simple stories at about 9.5 tokens per second.

AI & Machine LearningLarge Language Models
1,960
littledivy
Featured
littledivy GitHub avatar

mimic

mimic captures traffic from any iOS or web app and automatically generates a Python client library that lets you call the app's API like a regular library.

AI & Machine Learning
1,482