--- license: apache-2.0 license_link: https://www.apache.org/licenses/LICENSE-2.0 base_model: thinkingmachines/Inkling-2-Mini base_model_relation: quantized pipeline_tag: image-text-to-text tags: - inkling - inkling2_loop - moe - int4 - w4a16 - quantized - vllm - rtx-3090 - ampere - conversational --- # Inkling 2 Mini W4A16 (INT4) for RTX 3090 and other Ampere GPUs An INT4 weight-only build of [thinkingmachines/Inkling-2-Mini](https://huggingface.co/thinkingmachines/Inkling-2-Mini), made to run on two RTX 3090s with vLLM. It includes: - tensor parallel 2 over NVLink - the model's own DSpark speculative decoding - up to 458,752 tokens of context > **Unofficial community quantization.** Not affiliated with or endorsed by Thinking Machines Lab, vLLM or NVIDIA. For the official model, see [thinkingmachines/Inkling-2-Mini](https://huggingface.co/thinkingmachines/Inkling-2-Mini). **How to run it:** [github.com/tonyd2wild/Inkling-2-Mini-W4A16-RTX3090](https://github.com/tonyd2wild/Inkling-2-Mini-W4A16-RTX3090). That repo has the launch scripts, the small vLLM overlay this checkpoint needs, and the bench and needle scripts. Stock vLLM cannot load this checkpoint on its own (see [Requirements](#requirements)). The same model on one DGX Spark (original NVFP4 weights): [Inkling-2-Mini-NVFP4-DGX-Spark](https://github.com/tonyd2wild/Inkling-2-Mini-NVFP4-DGX-Spark). ## Results on 2x RTX 3090 Tensor parallel 2, NVLink bridge, DSpark k=7, BF16 KV cache, text-only, one request at a time. Measured 2026-11-21. | | | |---|---| | Decode, one user | **137.5 tok/s**. Without NVLink P2P: 100.5 tok/s. Without DSpark: 93.7 tok/s. | | DSpark speed-up | **1.47x**. 19.8% of drafted tokens accepted, 2.39 tokens per target step (3.31 on tool-calling turns) | | Context | `--max-model-len` **458,752** (448K), KV pool **483,850 tokens** on 2x 24 GB | | Long-context needles | **PASS** at 32K, 199,595 tokens (59 s prefill) and 439,384 tokens (191 s prefill) | | 69-scenario tool eval | quality **87.0** / responsiveness **99.1** / deployability **90.6**, 55 pass / 10 partial / 4 fail | | Eval decode, median turn | **157.4 tok/s**, **670 ms** | The original NVFP4 checkpoint on one DGX Spark scored 88.4 / 92.1 / 89.5 (56/10/3) on the same eval at 47.7 tok/s with a 2,035 ms median turn. 68 of 69 scenarios scored the same. The one flip (TC-22, a translation with a large tool list, answered directly instead of calling the tool) is the same flip the Spark showed with FP8 KV. Other lanes from the recipe: - **Vision on:** TP2, 131,072 context, about 90 tok/s without speculative decoding. - **One card:** TP1, up to 32,768 context, about 74 tok/s. The test cards were power-limited to 240 W. ## What was quantized | Tensors | Original | This checkpoint | |---|---|---| | Routed experts, layers 0 to 19 (`mlp.experts.w13_weight`, `w2_weight`) | NVFP4 (E2M1, FP8 E4M3 scale per 16, per-expert FP32 scale) | **INT4**, symmetric, BF16 scale per 128 input channels | | Routed experts, layers 20 to 23 | MXFP8 (E4M3, E8M0 scale per 32) | **INT4**, symmetric, BF16 scale per 128 input channels | | Everything else (embeddings, LM head, attention, router, norms, short convs, loop controllers, AttnRes queries, vision encoder) | BF16 / FP32 | unchanged | | DSpark drafter `mtp.safetensors` | BF16 | unchanged (byte-identical) | - The experts are the only tensors that were quantized in the original checkpoint, and the only ones changed here. - Expert layout, in the compressed-tensors `pack-quantized` format, stacked per layer: - `w13_weight_packed`: int32 `[128, 2304, 288]`, with `w13_weight_scale`: bf16 `[128, 2304, 18]` - `w2_weight_packed`: int32 `[128, 2304, 144]`, with `w2_weight_scale`: bf16 `[128, 2304, 9]` - Values are stored as `q + 8` in 4-bit fields. - Per-tensor precisions are in `hf_quant_config.json` (compute dtype `w4a16`). Per-tensor quantization errors are in `quantization_stats.json`. ## How it was made 1. **Exact dequantization of the original experts** to fp32. - NVFP4: `e2m1 * e4m3_block_scale * amax / 2688`. - MXFP8: `e4m3 * 2^(e8m0 - 127)`. - Verified three ways: the max-abs check against the stored `amax`; vLLM's own expert GEMM on the original weights matching a torch GEMM on the dequantized ones (0.17% relative); and the dequantized copy re-quantizing back to identical FP4 codes and FP8 bytes. 2. **Round-to-nearest INT4 with an MSE scale search.** Symmetric INT4, group size 128. For each row and group, the scale is chosen from `amax / d` for d in {7, 7.25, 7.5, 7.75, 8, 8.25, 8.5, 9}, whichever gives the lowest squared error. Scales are rounded to BF16 before use. - Mean relative weight error: **10.4%** on the NVFP4 layers and **10.3%** on the MXFP8 layers. Plain `amax / 7.5` RTN gives 11.6% and 11.3%. 3. **Packing check.** vLLM's Humming INT4 expert GEMM on an RTX 3090 matches a torch GEMM on the unpacked INT4 weights to 0.2% relative. **No GPTQ, AWQ or AutoRound.** These tools need a transformers implementation of the `inkling2_loop` architecture, and none exists. The looped core layers, which run 3 times with shared weights, would also need custom activation capture. This is a calibration-free RTN quantization, and the quality numbers below should be read that way. The converter is in the GitHub repo: [`quantize/convert.py`](https://github.com/tonyd2wild/Inkling-2-Mini-W4A16-RTX3090/blob/main/quantize/convert.py). ## Quality vs the original checkpoint Both were measured on the same 2x RTX 3090 with greedy decoding. | | Original NVFP4/MXFP8 | **This W4A16** | |---|---|---| | Perplexity, prose passage | 4.574 | 4.677 (**+2.3%**) | | Perplexity, code passage | 1.153 | 1.154 (+0.1%) | | Perplexity, math passage | 1.812 | 1.800 (-0.7%) | | 19 fixed prompts | 19/19 | 19/19 | | 69-scenario tool eval | 88.4 (DGX Spark) | 87.0 | - The 19 prompts are 12 math word problems, 3 reasoning questions, 2 coding tasks run against unit tests, 1 tool call and 1 strict-JSON extraction. - The perplexity check uses three short fixed passages, so it is a sanity check, not a benchmark. ## Files | File | Size | | |---|---|---| | `model-00001-of-00004.safetensors` | 5,256,955,920 B | | | `model-00002-of-00004.safetensors` | 5,255,336,992 B | | | `model-00003-of-00004.safetensors` | 5,255,337,016 B | | | `model-00004-of-00004.safetensors` | 700,711,704 B | | | `mtp.safetensors` | 635,801,416 B | DSpark drafter, unchanged from the original | | `model.safetensors.index.json`, `config.json`, `hf_quant_config.json` | | describe the INT4 experts | | `quantization_stats.json` | | per-tensor relative error | | `tokenizer.json`, `tokenizer_config.json`, `special_tokens_map.json`, `tiktoken/tokenizer.model`, `chat_template.jinja`, `processor_config.json`, `generation_config.json` | | unchanged from the original | | `LICENSE` | | Apache License 2.0 | That is 16.47 GB of model shards plus the 0.64 GB drafter. The original is 19.53 GB plus 0.64 GB. Base revision: `ed40e7da625f594fc9c4990f5f66be24873c22d7`. ## Requirements - **vLLM image:** the official `vllm/vllm-openai:inkling-2-mini` image (tested digest `sha256:c2dc759f5984f69c1e2418c6af7c26eb756f5ed2a8934c768ae1253645d1449e`). - **The overlay:** [the overlay in the GitHub repo](https://github.com/tonyd2wild/Inkling-2-Mini-W4A16-RTX3090/tree/main/overlay), 8 Python files mounted read-only over the image's Inkling code. It is needed because: - that image's Inkling code only accepts NVFP4/MXFP8 experts - the image as shipped does not run on Ampere at all (FlashAttention-3, PDL, TMA, and several kernels compiled for SM90+ or SM100 only) - **GPUs:** 2x 24 GB for the 448K lane. One 24 GB card runs it with up to 32K context. - **Transformers:** there is no transformers implementation of this architecture, so the checkpoint cannot be loaded with `transformers`. ## Quick start ```bash hf download Tech2wild/Inkling-2-Mini-W4A16 --local-dir ~/models/Inkling-2-Mini-W4A16 docker pull vllm/vllm-openai:inkling-2-mini git clone https://github.com/tonyd2wild/Inkling-2-Mini-W4A16-RTX3090 cd Inkling-2-Mini-W4A16-RTX3090 ./launch_tp2_max.sh # 2x 3090, 448K, DSpark, text-only, port 8130 (~2.5 min to start) curl -s http://localhost:8130/v1/chat/completions -H 'Content-Type: application/json' -d '{ "model": "inkling-2-mini-w4a16", "messages": [{"role": "user", "content": "What is 17 * 23?"}], "max_tokens": 512, "chat_template_kwargs": {"reasoning_effort": "none"} }' ``` Reasoning effort is passed as `chat_template_kwargs.reasoning_effort`: none, minimal, low, medium, high (the default), xhigh or max. Tool calling uses `--tool-call-parser inkling`. The [GitHub README](https://github.com/tonyd2wild/Inkling-2-Mini-W4A16-RTX3090) explains every flag. ## Limits - **Text-only in the max-context setup.** The 448K lane runs `--language-model-only`. With the vision encoder on, the tested setup is 131K context. - **BF16 KV cache only on Ampere.** Inkling's attention supports FP8 KV only on SM12x GPUs. - **The first requests after a start are slower** (about 1.7 s to the first token) while Triton compiles kernels for new shapes. - **Needs the overlay** and the tested vLLM image build. Other vLLM versions will need the changes ported. - **Calibration-free INT4.** Prose perplexity is about 2% higher than the original. - **Single requests only.** All numbers are one request at a time. No concurrency or load tests were run. ## License This checkpoint is a derivative of [Inkling 2 Mini](https://huggingface.co/thinkingmachines/Inkling-2-Mini) by Thinking Machines Lab, released under the **Apache License 2.0**, and is distributed under the same license. See [`LICENSE`](LICENSE). Changes from the original: - The routed-expert weights were re-quantized from NVFP4/MXFP8 to INT4. - `config.json` (`quantization_config`), `hf_quant_config.json` and `model.safetensors.index.json` were rewritten for the INT4 experts. - The model weights were re-sharded into four files. - `quantization_stats.json` was added. All other files are unchanged copies of the original. Use of the model is also subject to Thinking Machines Lab's [Model Acceptable Use Policy](https://thinkingmachines.ai/model-acceptable-use-policy/), which applies to modified versions too. ## Credits - [Thinking Machines Lab](https://huggingface.co/thinkingmachines) for Inkling 2 Mini, its checkpoint and the DSpark drafter. - The [vLLM](https://github.com/vllm-project/vllm) project for Inkling 2 support, the `vllm/vllm-openai:inkling-2-mini` image and the Humming kernels that run the INT4 experts. - The INT4 layout follows the [compressed-tensors](https://github.com/vllm-project/compressed-tensors) `pack-quantized` convention.