mlx-optiq
Family guide · Xing4.0

Xing4.0 on Apple Silicon

Xing4.0-29B-A4B is a sparse MoE built on DeepSeek-V3's attention — multi-head latent attention with a compressed KV cache (kv_lora_rank: 512), 64 routed experts and one shared expert, about 4B parameters active per token. What is its own is the hyper-connection: instead of one residual stream running through the network, it carries four in parallel, and every block reads from and writes back to a mix of them decided per layer.

Vendored architecture Stock mlx-lm has no xing4_0 class — support is an unmerged pull request, so a plain install answers Model type xing4_0 not supported. OptiQ ships a vendored, mlx-native port that registers with mlx-lm on import optiq, the same approach used for Laguna and dhara. DeepSeek-V3 supplies the attention, the experts and the decode loop; only the hyper-connection is new code. Call import optiq before mlx_lm.load.

The quant

Modelbf16 sizeOptiQ sizeCompressionPrecision
Xing4.0-29B-A4B-OptiQ-4bit58 GB19.6 GB3.0×5.0-bit mixed

Hello world

hello.pypython
import optiq  # registers the xing4_0 arch with mlx-lm
from mlx_lm import load, generate

model, tok = load("mlx-community/Xing4.0-29B-A4B-OptiQ-4bit")
prompt = tok.apply_chat_template(
    [{"role": "user", "content": "Explain write-ahead logging in two sentences."}],
    tokenize=False, add_generation_prompt=True,
)
print(generate(model, tok, prompt=prompt, max_tokens=300))

Capability Score

Measured on the quant, not inherited from the parent. It is a new family with no scored sibling, so the full six-metric suite was run.

MetricScore
MMLU (5-shot, 1000)71.7%
GSM8K (1000)90.1%
IFEval (strict, prompt-level)61.2%
BFCL-V3 simple74.5%
HumanEval pass@184.8%
HashHop (~8.9k context)18.0%
Capability Score66.71
How hyper-connections work Each layer holds four residual streams instead of one. Before a block runs, a routing matrix — normalised with a handful of Sinkhorn iterations so the mixing stays balanced — decides how to collapse those four into the one input the block sees, and how to scatter its output back across them. The streams let a later layer read a signal an earlier one wrote without it having to survive every intervening block. OptiQ's per-layer sensitivity pass runs over all 395 quantizable tensors, the 64 routed experts included, and the allocation lands at 5.0-bit mixed precision: 58 GB bf16 down to 19.6 GB.