Moonlight-16B-A3B-Instruct — APEX GGUF
MoE-aware, mixed-precision APEX quantizations of moonshotai/Moonlight-16B-A3B-Instruct (16B total / ~3B active, DeepSeek-V2/V3-style MoE: 64 routed + 2 shared experts, MLA attention).
APEX assigns quantization precision per tensor role and per layer instead of uniformly — keeping always-active shared experts and edge layers high-precision while compressing the sparse routed-expert middle layers hard. The result is near-full-precision quality at a fraction of the size.
Quality gate (retrofit, added after initial publish): independently re-verified with a fresh bf16 baseline conversion — both quants hold at ~1.01× the fp PPL, consistent with the original measurements below, plus a real-generation coherence check (both pass). No tool-calling test: Moonlight's chat template has no tool-call handling at all, and there's no tool-use special tokens or mention of it in the model card — a genuine capability gap in the base model (it's a Muon-optimizer research release), not a broken template or a quant defect. See GATE.md for full results.
Results
Perplexity on wikitext-2-raw (test split, 200 × 512-token windows), measured with
llama-perplexity. Lower is better.
| File | Size | BPW | PPL | Δ vs F16 |
|---|---|---|---|---|
| F16 (reference baseline) | 30 GB | 16.0 | 8.836 | — |
| APEX-i-quality | 12 GB | 5.99 | 8.916 | +0.90% |
| APEX-handroll | 11 GB | 5.40 | 8.959 | +1.38% |
Both tiers hold within ~1% of full-precision perplexity at ~2.6× smaller. Coherent in English and on code prompts; ~85 tok/s generation on a single modern GPU.
Which file to pick
- APEX-i-quality (12 GB) — highest quality; edge/near routed experts at Q6_K/Q5_K, middle at IQ4_XS, shared experts Q8_0, attention Q6_K. Uses a diverse ("I") imatrix.
- APEX-handroll (11 GB) — same recipe, but the routed down projections are pinned to IQ4_NL (see Method). ~8% smaller for +0.05 PPL — the better size/quality trade on this architecture.
Usage (llama.cpp)
llama-cli -m Moonlight-16B-A3B-Instruct-APEX-handroll.gguf -ngl 999 -p "Hello"
# or serve an OpenAI-compatible endpoint:
llama-server -m Moonlight-16B-A3B-Instruct-APEX-handroll.gguf -ngl 999 --host 0.0.0.0 --port 8081
Requires a llama.cpp build recent enough to support the deepseek2 architecture
and the kimi-k2 pre-tokenizer (Moonlight shares Moonshot's tiktoken tokenizer).
Method & notes
APEX is a bit-allocation recipe over stock llama-quantize --tensor-type-file
(no kernel/format changes). Two architecture-specific adaptations were required
for Moonlight that the stock APEX profiles do not handle:
- MLA attention tensors. Moonlight uses Multi-head Latent Attention, so its
attention projections are named
attn_q,attn_kv_a_mqa,attn_k_b,attn_v_b,attn_output— not the usualattn_q/k/v. The generated config was patched to assign precision to the real MLA tensors (otherwise the KV projections silently keep the base type). - Non-256-divisible expert dim (1408). Moonlight's routed-expert intermediate
size is 1408, which K-quants (Q6_K/Q5_K/IQ4_XS require 256-divisibility) cannot
quantize — they fall back to Q8_0, wasting bits on the largest tensors. The
handroll tier pins routed
ffn_down_expsto IQ4_NL (a block-32 4-bit type) to compress them properly. This is the difference between the two tiers.
Baseline: quantized from
gabriellarson/Moonlight-16B-A3B-Instruct-GGUF's
F16 conversion. Calibration imatrix built from Bartowski's calibration_datav3
(diverse chat/code/reasoning text).
Reproduce
Full recipe with exact commands, pinned tool versions, the tensor-type configs,
and the config-generation/patch scripts is in REPRODUCE.md.
Bundled: generate_config.sh, patch_moonlight_config.py,
configs/moonlight_*.txt, and the imatrix — so the whole pipeline is
reproducible without any private dependency.
Attribution & licenses
All components are MIT-licensed; see LICENSE and NOTICE.
- Base model: Moonshot AI (@moonshotai) — Moonlight-16B-A3B-Instruct (MIT)
- F16 GGUF conversion: gabriellarson (@gabriellarson) — source GGUF (MIT-derived)
- Quantization engine: llama.cpp by the ggml authors (@ggml-org · github) (MIT)
- APEX recipe & toolkit: Ettore Di Giacinto / LocalAI (@mudler) — localai-org/apex-quant (MIT)
- Calibration data: Bartowski (@bartowski) — calibration_datav3
This is an unofficial community quantization and is not affiliated with or endorsed by Moonshot AI.