Qwen3.8-27B-MIVFP4e (Native Apple Silicon Metal 4 NAX .miv v2.1)
Pre-quantized, NAX pre-tiled MIVFP4e checkpoint of Qwen/Qwen3.8-27B built for ninfer-metal — a pure C++20 / Objective-C++ / Metal 4 inference suite (zero Python, zero MLX runtime) co-designed for Apple M5+ Silicon (MTLGPUFamilyApple10+, NAX, Compute ICB, and Dual-ANE).
- GitHub & Runtime: https://github.com/scoltzero/ninfer-metal
- Upstream Base Model:
Qwen/Qwen3.8-27B(64layers =48Gated DeltaNet +16Full-Attention,hidden_size=5120,head_dim=256,rotary_dim=64, native262,144context) - Companion SpinQuant $R_1$-Synced DFlash2 Draft Models (all
100%0-ULPVerify-identical):scoltzero/Qwen3.8-27B-MIVFP4e-DFlash2-MIVFP4(Fastest & smallest:1.27 GiB4.5 bpw+ AWQ + FWHT-64,+7.9%–12.7%faster &-2.61 GiBUMA vs BF16)scoltzero/Qwen3.8-27B-MIVFP4e-DFlash2-Q8(High-precision balanced:2.07 GiB8.5 bpw,45.43 dBSQNR,+4.9%–6.1%faster &-1.70 GiBUMA vs BF16,Δ 0.0000avg_acc)scoltzero/Qwen3.8-27B-MIVFP4e-DFlash2(3.58 GiBlosslessdirect_bf16_v1reference draft)
Quantization Methodology (MIVFP4e)
Quantized offline from upstream BF16 using encoder/m5_mivfp4_quantize.py through a 5-stage hardware-co-designed pipeline:
- SpinQuant $R_1 / R_2$ Orthogonal Rotations: Cayley-SGD orthogonal rotations absorbed into residual & value/output paths to suppress activation outliers (with exact $R_1$ persisted in
miv_rotation_basis.safetensorsat zero inference overhead so companionDFlash2draft models and external HF/MLX LoRA adapters project cleanly into rotated coordinates). - AWQ / DuQuant Coupled Channel Smoothing: Offline migration of activation variance across SwiGLU
up_proj <-> down_projand GDNnorm <-> out_projpairs. - Canonical Pad-on-Pack (
K % 64 == 0) & Register-LevelFWHT-64: Incoherence transform aligned to Apple10 NAX tiles with zero zero-pointraoverhead. - Rotated-Domain GPTQ / LDLQ & Simulated-
INT8MACaQ: Hessian-weighted quantization into 4-bitmivfp4_gauss_g64_s16_v1(mivfp4_nax_lane_g64_v2), selectively promoting tiny high-sensitivity projections (gdn_a,gdn_b,attention_v) to homogeneousq8_lane_v2(~4.52 bpw,19.92 dBaggregate SQNR,15.24 GiB/16.36 GBmodel.miv, including embedded Native MTP (15.mivobjects,227.9 MiB) and the losslessly preserved VLM vision tower & merger head (333direct_bf16_v1objects underModelComponent::vision,0.858 GiB/878.8 MiB,0 Btext-mode UMA overhead)). - Single-Copy Tri-State NAX Pre-Tiling: One resident weight copy (
1.0xfootprint) feedsM=1..2coalescedSIMD QMVdecode,M=4..160-ULPW4A16speculative verify (Native MTP&DFlash2), andM>=32INT8xINT8W4A8NAX prefill.
Apple M5 Ultra (Apple10 Metal 4 NAX) Optimizations
- Strict Hardware Compliance: Every Metal 4 NAX attention, RoPE, MTP, DFlash2, and KV page-score kernel is audited on native Apple10 M5 Ultra at
<= 16 KiBstatic threadgroup SRAM (max 15,872 B) and0 Bregister spill. - UMA 2-Tier KV Acceleration (
ActKV-Lite+KVMem): Architecture-awarehybrid_gdn_full_attnadapter keeps all48GDN layersexempt_from_eviction(atomically archived asuma_slabin multi-session NVMe offload), while evicting/offloading cold Full-Attention pages with GPU 40-row tail-ring LSE page scoring, decaying-peak LRFU, physical/logicalKvPagePooldecoupling,PrefillChunkstreaming eviction, and multi-threaded ARM64 NEONSDOTper-dimensionint8Quest NVMe recall. - Tiered
Dynamic YaRN(512K / 1MUltra-Long Context): Exact HF NTK-by-parts overrotary_dim=64with fast-math-immune 48-bit2pirange reduction (<= 256Kstays1.0xbit-exact lossless;512K2.0x;1M4.0x), 64-bitrope_scaling_tier_hashprefix/NVMe cache isolation, native MTP< 2 GiBICB safety, andDFlash2> 256Klocal sliding-window re-anchoring.
Verified Apple M5 Ultra Benchmarks (80-GPU / 256 GiB, affine4_g128)
1. Speculative Decode Comparison (AR vs MTP vs DFlash2 BF16 / Q8 / MIVFP4)
| Speculator | Draft Disk Size | Avg Decode | Peak Decode (Coding / Reasoning / Structured) | Acc / Round (Rate) | Peak UMA | 0-ULP Verify Parity |
|---|---|---|---|---|---|---|
AR (none) |
— | 59.54 tok/s |
59.59 (59.6 / 59.5 / 59.5) |
— | 15.88 GiB |
(T=1 QMV baseline) |
| Native MTP (embedded) | 0 B |
107.78 tok/s |
113.22 (113.2 / 110.2 / 99.9) |
1.75 (48.9%) |
16.27 GiB |
100% (== BF16 == Q8 == MIVFP4) |
DFlash2 (BF16, $R_1$) |
3.585 GiB (3.85 GB) |
110.94 tok/s |
121.03 (121.0 / 116.4 / 95.4) |
2.12 (30.9%) |
20.47 GiB |
100% (3/3 bit-exact) |
DFlash2-Q8 (8.5 bpw, $R_1$) |
2.074 GiB (-42.1%) |
116.38 tok/s (+4.9%) |
125.17 (125.2 / 123.7 / 100.3) |
2.08 (30.3%) |
18.77 GiB (-1.70 GiB) |
100% (3/3 bit-exact) |
DFlash2-MIVFP4 (4.5 bpw, $R_1$) |
1.268 GiB (-64.6%) |
119.71 tok/s (+7.9%) |
127.62 (127.6 / 127.6 / 103.9) |
2.00 (29.1%) |
17.86 GiB (-2.61 GiB) |
100% (3/3 bit-exact) |
2. 512K (2.0x Dynamic YaRN) & 1M (4.0x Dynamic YaRN) Ultra-Long Context (B=16K, R=2K, sink=2)
Context / YaRN / Pool (phys/log pg) |
Spec + KV Mode | T1 Prefill (tok/s) |
T1 Dec | T1 NIAH | T2 TTFT | T2 Dec | T2 NIAH | Peak UMA | Evicted / NVMe / Recall |
|---|---|---|---|---|---|---|---|---|---|
505,626 tok (2.0x, 1,259/8,704) |
dflash2 + actkv_lite |
223.9s (2,258) |
97.2 |
3/3 | 159.4 ms |
180.5 |
3/3 | 21.72 GiB |
7,650 pg / 0 MB / 0 |
505,626 tok (2.0x, 1,259/8,704) |
dflash2 + kvmem_actkv |
235.9s (2,143) |
105.1 |
3/3 | 273.6 ms |
169.5 |
3/3 | 22.28 GiB |
7,682 pg / 8.50 GiB / 32 |
505,626 tok (2.0x, 1,259/8,704) |
mtp + kvmem_actkv |
249.6s (2,026) |
108.5 |
3/3 | 342.5 ms |
134.0 |
3/3 | 18.73 GiB |
7,682 pg / 8.50 GiB / 32 |
1,024,032 tok (4.0x, 1,259/16,896) |
dflash2 + actkv_lite |
453.0s (2,260) |
88.7 |
3/3 | 213.6 ms |
160.6 |
3/3 | 21.75 GiB |
15,750 pg / 0 MB / 0 |
1,024,032 tok (4.0x, 1,259/16,896) |
dflash2 + kvmem_actkv |
479.0s (2,138) |
99.7 |
3/3 | 373.0 ms |
171.3 |
3/3 | 22.58 GiB |
15,782 pg / 17.46 GiB / 32 |
1,024,032 tok (4.0x, 1,259/16,896) |
mtp + kvmem_actkv |
507.1s (2,019) |
104.8 |
3/3 | 434.0 ms |
138.3 |
3/3 | 19.05 GiB |
15,782 pg / 17.89 GiB / 32 |
3. Additional Verified M5 Ultra Highlights
- Single-Stream & Concurrency Peak:
61.01 tok/sAR (15.66 GiBUMA),154.26 tok/sNative MTP,196.75 tok/sDFlash2;B=4aggregate182.91 / 457.92 / 505.57 tok/s(AR / MTP / DFlash2). - 64K / 128K
ActKV-Lite& Multi-Session NVMe:+24.1%64K DFlash2 decode (124.39T1 /157.82 tok/sT2),+22.0%128K MTP decode (109.17 tok/s),100%NIAH (21/21runs); 3-session NVMe archive/restore cuts switchback TTFT6.32x–8.98x(6.545s -> 0.729sAR,6.796s -> 0.770sMTP,100%exact). - 1K–256K Cold Prefill (
W4A8 + Sage2 + MInference):2,882.4 tok/speak at 16K and256Kin107.1s(2,447.1 tok/s,20.18 GiBUMA).
Included Files & Checksums
model.miv(15.24 GiB/16.36 GB,16,359,050,240B) — Single-copy.mivv2.1 NAX-tiled text weights (14.15 GiB) + embedded Native MTP (227.9 MiB) + lossless BF16 VLM vision tower & merger head (878.8 MiB,ModelComponent::vision,0 Btext-mode UMA overhead)- SHA-256:
c1dec49d8851c27e23756ae82ef6396c4a77fa4232d07a6577be37a90f265e3b
- SHA-256:
miv_rotation_basis.safetensors(106.8 MiB,112,003,440B) — Read-only SpinQuant $R_1$, RMSNorm & AWQ basis for syncingDFlash2and HF/MLX LoRA adapters (zero GPU runtime cost)- SHA-256:
9ff1a822c5f70597c6189f67caff763d1286afdea10fda368183ecdb92e489ae
- SHA-256:
model_pack.json,model.miv.conversion.json,model.miv.quantization.json,config.json,generation_config.json,chat_template.jinja,tokenizer.json,tokenizer_config.json,vocab.json,merges.txt,preprocessor_config.json,video_preprocessor_config.json
SpinQuant $R_1$ Pairing Note: This vision-preserved rebuild uses a freshly solved SpinQuant $R_1$ basis (
9ff1a822...). All three companion repositories (DFlash2,DFlash2-Q8,DFlash2-MIVFP4) have been updated in lockstep to match this exactR_1basis — if you update this target checkpoint from an earlier text-only revision, update your companion DFlash2 draft model together.
Usage (ninfer-metal-serve & MIV.app)
# Clone & build ninfer-metal (zero Python / zero MLX runtime)
git clone https://github.com/scoltzero/ninfer-metal.git && cd ninfer-metal
cmake -S . -B build/release -G Ninja -DCMAKE_BUILD_TYPE=Release \
-DOMLX_M5_BUILD_NAX_METALLIB=ON -DOMLX_M5_BUILD_PYTHON=OFF
cmake --build build/release
# Launch with embedded Native MTP (zero extra draft model download required)
./serve/scripts/start_ninfer_serve.sh /path/to/Qwen3.8-27B-MIVFP4e \
--spec-backend mtp --kv-dtype affine4_g128
# Launch 1M Ultra-Long Context with Dynamic YaRN + KVMem + DFlash2-MIVFP4 (or DFlash2-Q8)
./serve/scripts/start_ninfer_serve.sh /path/to/Qwen3.8-27B-MIVFP4e \
--spec-backend dflash2 --draft-dir /path/to/Qwen3.8-27B-MIVFP4e-DFlash2-MIVFP4 \
--max-context 1048576 --kv-dtype affine4_g128 \
--kv-accel-mode kvmem_actkv --actkv-budget-tokens 16384 --actkv-reserve-tokens 2048 \
--kvmem-disk-gb 32 --kvmem-recall-top-pages 16 --rope-scaling-mode dynamic_yarn
Or open the standalone macOS desktop app MIV.app (./miv-app/build-app.sh && open dist/MIV.app), select this model, and pick the 256K / 512K / 1M quick presets on the per-model "KV Acceleration" (KV 加速) subpage.
- Downloads last month
- 439