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).


Quantization Methodology (MIVFP4e)

Quantized offline from upstream BF16 using encoder/m5_mivfp4_quantize.py through a 5-stage hardware-co-designed pipeline:

  1. 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.safetensors at zero inference overhead so companion DFlash2 draft models and external HF/MLX LoRA adapters project cleanly into rotated coordinates).
  2. AWQ / DuQuant Coupled Channel Smoothing: Offline migration of activation variance across SwiGLU up_proj <-> down_proj and GDN norm <-> out_proj pairs.
  3. Canonical Pad-on-Pack (K % 64 == 0) & Register-Level FWHT-64: Incoherence transform aligned to Apple10 NAX tiles with zero zero-point ra overhead.
  4. Rotated-Domain GPTQ / LDLQ & Simulated-INT8 MACaQ: Hessian-weighted quantization into 4-bit mivfp4_gauss_g64_s16_v1 (mivfp4_nax_lane_g64_v2), selectively promoting tiny high-sensitivity projections (gdn_a, gdn_b, attention_v) to homogeneous q8_lane_v2 (~4.52 bpw, 19.92 dB aggregate SQNR, 15.24 GiB / 16.36 GB model.miv, including embedded Native MTP (15 .miv objects, 227.9 MiB) and the losslessly preserved VLM vision tower & merger head (333 direct_bf16_v1 objects under ModelComponent::vision, 0.858 GiB / 878.8 MiB, 0 B text-mode UMA overhead)).
  5. Single-Copy Tri-State NAX Pre-Tiling: One resident weight copy (1.0x footprint) feeds M=1..2 coalesced SIMD QMV decode, M=4..16 0-ULP W4A16 speculative verify (Native MTP & DFlash2), and M>=32 INT8xINT8 W4A8 NAX 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 KiB static threadgroup SRAM (max 15,872 B) and 0 B register spill.
  • UMA 2-Tier KV Acceleration (ActKV-Lite + KVMem): Architecture-aware hybrid_gdn_full_attn adapter keeps all 48 GDN layers exempt_from_eviction (atomically archived as uma_slab in multi-session NVMe offload), while evicting/offloading cold Full-Attention pages with GPU 40-row tail-ring LSE page scoring, decaying-peak LRFU, physical/logical KvPagePool decoupling, PrefillChunk streaming eviction, and multi-threaded ARM64 NEON SDOT per-dimension int8 Quest NVMe recall.
  • Tiered Dynamic YaRN (512K / 1M Ultra-Long Context): Exact HF NTK-by-parts over rotary_dim=64 with fast-math-immune 48-bit 2pi range reduction (<= 256K stays 1.0x bit-exact lossless; 512K 2.0x; 1M 4.0x), 64-bit rope_scaling_tier_hash prefix/NVMe cache isolation, native MTP < 2 GiB ICB safety, and DFlash2 > 256K local 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/s AR (15.66 GiB UMA), 154.26 tok/s Native MTP, 196.75 tok/s DFlash2; B=4 aggregate 182.91 / 457.92 / 505.57 tok/s (AR / MTP / DFlash2).
  • 64K / 128K ActKV-Lite & Multi-Session NVMe: +24.1% 64K DFlash2 decode (124.39 T1 / 157.82 tok/s T2), +22.0% 128K MTP decode (109.17 tok/s), 100% NIAH (21/21 runs); 3-session NVMe archive/restore cuts switchback TTFT 6.32x–8.98x (6.545s -> 0.729s AR, 6.796s -> 0.770s MTP, 100% exact).
  • 1K–256K Cold Prefill (W4A8 + Sage2 + MInference): 2,882.4 tok/s peak at 16K and 256K in 107.1s (2,447.1 tok/s, 20.18 GiB UMA).

Included Files & Checksums

  • model.miv (15.24 GiB / 16.36 GB, 16,359,050,240 B) — Single-copy .miv v2.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 B text-mode UMA overhead)
    • SHA-256: c1dec49d8851c27e23756ae82ef6396c4a77fa4232d07a6577be37a90f265e3b
  • miv_rotation_basis.safetensors (106.8 MiB, 112,003,440 B) — Read-only SpinQuant $R_1$, RMSNorm & AWQ basis for syncing DFlash2 and HF/MLX LoRA adapters (zero GPU runtime cost)
    • SHA-256: 9ff1a822c5f70597c6189f67caff763d1286afdea10fda368183ecdb92e489ae
  • 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 exact R_1 basis — 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
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for scoltzero/Qwen3.8-27B-MIVFP4e

Base model

Qwen/Qwen3.8-27B
Quantized
(2,068)
this model
Adapters
1 model
Quantizations
2 models