Inkling-2-Mini NVFP4 (M2)
This is a further-quantized build of thinkingmachines/Inkling-2-Mini (revision ed40e7da), tuned for batch-1 decode on NVIDIA DGX Spark (GB10, sm_121).
The official checkpoint is already mostly 4-bit: routed experts in layers 0–19 are native NVFP4. Everything else is wider: the experts in layers 20–23 are MXFP8, and attention, embeddings, lm_head, vision and MTP are BF16. On Spark, decode is limited by memory bandwidth, and the BF16 attention and lm_head weights are read 40+ times per token, because layers 6–17 are looped three times. M2 quantizes exactly those weights.
| Part | Official | M2 |
|---|---|---|
| Experts, layers 0–19 | NVFP4 (native) | unchanged (byte-identical) |
| Experts, layers 20–23 | MXFP8 | NVFP4, same layout as the native layers |
| Attention, 20 local (sliding-window) layers | BF16 | NVFP4 weight-only (W4A16) |
| lm_head (unembed) | BF16 | NVFP4 weight-only (W4A16) |
| Attention in global layers 5/11/17/23, embeddings, norms, vision, MTP/DSpark head | BF16 | unchanged (byte-identical) |
Results:
- Speed: 1.62× faster batch-1 decode than the official checkpoint with MTP off (55.5 vs 34.2 tok/s), and 1.43× its fastest setting.
- Size: 16.8 GB instead of 20.2 GB.
- Quality: math, tool calling, instruction following and 120k-token retrieval are unchanged. MMLU-Pro drops 6.3 points. See Quality and Future work.
Serving needs the patched vLLM image in
vllm/. Stock images can't load W4A16 attention for this architecture. The patch is a small overlay on the officialvllm/vllm-openai:inkling-2-miniimage.
Quick start (vLLM, DGX Spark)
hf download sambit9238/Inkling-2-Mini-NVFP4-M2 --local-dir Inkling-2-Mini-NVFP4-M2
cd Inkling-2-Mini-NVFP4-M2/vllm && docker build -t vllm-inkling2-mini-nvfp4 . && cd ../..
docker run -d --name inkling --gpus all --ipc=host -p 8000:8000 \
-v "$PWD/Inkling-2-Mini-NVFP4-M2:/model:ro" vllm-inkling2-mini-nvfp4 \
--model /model --served-model-name inkling --tensor-parallel-size 1 \
--max-model-len 131072 --gpu-memory-utilization 0.80 --max-num-seqs 32 \
--reasoning-parser inkling --enable-auto-tool-choice --tool-call-parser inkling
Leave MTP (DSpark speculative decoding) off for this build. In our runs the draft acceptance rate was about 19% at temperature 1.0. Once the base step gets this cheap, drafting costs more than it saves: 47.7 tok/s with MTP on vs 55.5 with it off. MTP is still available through the official --speculative-config '{"method":"dspark","num_speculative_tokens":7,"draft_sample_method":"probabilistic"}'.
Speed
All runs: DGX Spark, the same pinned image (the M2 runs add the overlay), --max-num-seqs 32, 131k context. Batch-1 decode uses 16 realistic chat prompts at the model's default sampling (T=1.0).
| Official, MTP off | Official, MTP on | M2, MTP off | M2, MTP on | |
|---|---|---|---|---|
| Batch-1 decode (tok/s) | 34.2 | 38.9 | 55.5 | 47.7 |
| Time per output token (ms) | 26.0 | 22.2 | 17.2 | 20.3 |
| Throughput, 8 concurrent (tok/s) | 107 | 121 | 135 | 127 |
| Throughput, 32 concurrent (tok/s) | 218 | 244 | 251 | 252 |
| Prefill, 2k / 32k (tok/s) | 3057 / 2992 | — | 3186 / 3043 | 3215 / 3061 |
| Weights + non-torch memory (GiB) | 20.9 | 17.7 |
FP4 Marlin reaches about 85–90% of the BF16 GEMV's memory bandwidth on GB10 at M=1. Per decode step, local-attention GEMM time drops from ~9.1 ms to ~3.1 ms, and the lm_head from ~3.9 ms to ~1.2 ms (results/gemm_bench.json).
Quality
Both builds were served the same way with MTP off, using reasoning effort low and max_gen_toks 32768. Raw outputs are in results/.
| Eval | Official | M2 |
|---|---|---|
| GSM8K-CoT, 300 questions (flexible / strict) | 0.960 / 0.763 | 0.960 / 0.773 |
| IFEval, 300 prompts (prompt-level strict / loose) | 0.900 / 0.897 | 0.873 / 0.893 |
| MMLU-Pro, 25 per subject (350 questions) | 0.637 | 0.574 (±0.025) |
| Tool calling, exact arguments (T=0 / T=0.7) | 0.667 / 0.657 | 0.695 / 0.686 |
| Needle in a haystack, 32k / 120k tokens | 5/5, 5/5 | 5/5, 5/5 |
Where the error comes from (teacher-forced KL vs official)
Each row adds one change on top of the official checkpoint. The numbers come from 258k positions of chat transcripts, scored with vLLM logprobs at concurrency 1.
| Variant | Mean KL, chat | p99 KL | Top-1 agreement | Perplexity change | Mean KL, wikitext |
|---|---|---|---|---|---|
| lm_head W4A16 only | 0.0076 | 0.13 | 97.5% | +0.34% | 0.0059 |
| Layer 20–23 experts NVFP4 only | 0.0148 | 0.27 | 96.8% | −0.02% | 0.0064 |
| Local attention W4A16 only | 0.0699 | 1.24 | 92.8% | +1.57% | 0.0269 |
| M2 (all three) | 0.0819 | 1.46 | 91.9% | +0.61% | 0.0349 |
Local-layer attention accounts for about 85% of the divergence, and it is the likely cause of the MMLU-Pro drop. The lm_head and the extra experts are close to free.
How it was made
ModelOpt's NVFP4QTensor math was applied directly to the official tensors. There is no BF16 master, so the official dequantized weights are the reference.
- Checking the native format. Re-quantizing the native NVFP4 experts (layers 0–19) reproduces them exactly: zero dequantization error and identical scales. The native format is the ModelOpt convention,
W = e2m1 · e4m3(block_scale) · amax/(6·448), with 16-element blocks. - Layer 20–23 experts. MXFP8 is dequantized and re-quantized to the native NVFP4 layout. Scales come from a per-block MSE search over 0.70–1.0× the block amax. Relative error vs MXFP8 is about 8.9% (
scripts/quant_experts.py). - Attention, local layers.
wq_du,wr_du,gate_attnandattn_sink_projare concatenated into oneq_sidetensor (6552×2304).wk_dv,wv_dvandwo_udare stored separately. All of them, plus the lm_head, use the same MSE scale search. Relative weight error is about 8.8% (scripts/repack_native.py,repack_report.json). - Storage. ModelOpt layout:
weightU8 (packed e2m1),weight_scaleF8 block scales andweight_scale_2F32 global scale. The tensors are listed in a newnvfp4_w4a16group inhf_quant_config.json. - Unchanged tensors. Every other tensor is byte-identical to the official checkpoint (SHA-verified).
- Runtime (
vllm/overlay.diff). The W4A16 layers run through vLLM's FP4 Marlin GEMM with BF16 activations. Quantized layers always use the split q/k/v GEMMs. The lm_head computes in FP16 by default; setINKLING2_W4A16_HEAD_DTYPE=bfloat16to switch. Tensor parallelism must be 1. Run on the official checkpoint, the overlay reproduces the official logprobs exactly (KL 0.0000).
To reproduce:
python scripts/quant_experts.py --ckpt Inkling-2-Mini --layers 20 21 22 23 --method mse --out experts_L20-23.safetensors
python scripts/repack_native.py --ckpt Inkling-2-Mini --out Inkling-2-Mini-NVFP4-M2 \
--experts experts_L20-23.safetensors --attn-layers local --lm-head --method mse
Future work
- Recover MMLU-Pro. Confirm the drop at a larger sample (60+ per subject on both builds). Then run a per-layer KL ablation over the 20 local attention layers and keep the 2–4 most sensitive in BF16. We expect that to bring MMLU-Pro within ~2 points of official at roughly 50 tok/s.
- Better weight quantization for attention. Try GPTQ- or AWQ-style error compensation calibrated on activations, instead of a pure weight-MSE scale search. Try a finer scale search for the
q_sideandwo_udtensors, which matter most. - Make MTP pay off again. Tune
num_speculative_tokens(fewer drafts, e.g. 2–3) for the cheaper base step. Consider quantizing the DSpark draft head too. - Global layers and embeddings. Measure quantizing the attention of global layers 5/11/17/23, which are currently BF16 for quality.
- Wider eval coverage. Add vision benchmarks (the vision tower is unchanged, but its inputs pass through quantized layers), coding (HumanEval/LiveCodeBench), and full MMLU-Pro.
- Upstream support. Propose W4A16 attention loading to vLLM once Inkling-2-Mini support lands in vLLM main, so the overlay is no longer needed. Add SGLang support.
Limitations
- The overlay is pinned to one image digest (
vllm/vllm-openai:inkling-2-mini@sha256:c2dc759f…), which is built from a private upstream commit. Other images will probably not load this checkpoint. - Tested only on a single DGX Spark (GB10). Other Blackwell GPUs with FP4 Marlin should work but haven't been measured.
- The eval samples are small (300 GSM8K/IFEval items, 25 MMLU-Pro questions per subject), so differences under ~2 points are within noise.
License
Apache-2.0, the same as the base model. Use is also subject to Thinking Machines' Model Acceptable Use Policy. This is an unofficial community build and is not affiliated with Thinking Machines Lab.
- Downloads last month
- 30
Model tree for sambit9238/Inkling-2-Mini-NVFP4-M2
Base model
thinkingmachines/Inkling-2-Mini