Tech2wild commited on
Commit
88dbe19
·
verified ·
1 Parent(s): 0e182b4

Add model card

Browse files
Files changed (1) hide show
  1. README.md +170 -0
README.md ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ license_link: https://www.apache.org/licenses/LICENSE-2.0
4
+ base_model: thinkingmachines/Inkling-2-Mini
5
+ base_model_relation: quantized
6
+ pipeline_tag: image-text-to-text
7
+ tags:
8
+ - inkling
9
+ - inkling2_loop
10
+ - moe
11
+ - int4
12
+ - w4a16
13
+ - quantized
14
+ - vllm
15
+ - rtx-3090
16
+ - ampere
17
+ - conversational
18
+ ---
19
+
20
+ # Inkling 2 Mini W4A16 (INT4) for RTX 3090 and other Ampere GPUs
21
+
22
+ 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:
23
+ - tensor parallel 2 over NVLink
24
+ - the model's own DSpark speculative decoding
25
+ - up to 458,752 tokens of context
26
+
27
+ > **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).
28
+
29
+ **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)).
30
+
31
+ 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).
32
+
33
+ ## Results on 2x RTX 3090
34
+
35
+ Tensor parallel 2, NVLink bridge, DSpark k=7, BF16 KV cache, text-only, one request at a time. Measured 2026-11-21.
36
+
37
+ | | |
38
+ |---|---|
39
+ | Decode, one user | **137.5 tok/s**. Without NVLink P2P: 100.5 tok/s. Without DSpark: 93.7 tok/s. |
40
+ | DSpark speed-up | **1.47x**. 19.8% of drafted tokens accepted, 2.39 tokens per target step (3.31 on tool-calling turns) |
41
+ | Context | `--max-model-len` **458,752** (448K), KV pool **483,850 tokens** on 2x 24 GB |
42
+ | Long-context needles | **PASS** at 32K, 199,595 tokens (59 s prefill) and 439,384 tokens (191 s prefill) |
43
+ | 69-scenario tool eval | quality **87.0** / responsiveness **99.1** / deployability **90.6**, 55 pass / 10 partial / 4 fail |
44
+ | Eval decode, median turn | **157.4 tok/s**, **670 ms** |
45
+
46
+ 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.
47
+
48
+ Other lanes from the recipe:
49
+ - **Vision on:** TP2, 131,072 context, about 90 tok/s without speculative decoding.
50
+ - **One card:** TP1, up to 32,768 context, about 74 tok/s.
51
+
52
+ The test cards were power-limited to 240 W.
53
+
54
+ ## What was quantized
55
+
56
+ | Tensors | Original | This checkpoint |
57
+ |---|---|---|
58
+ | 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 |
59
+ | Routed experts, layers 20 to 23 | MXFP8 (E4M3, E8M0 scale per 32) | **INT4**, symmetric, BF16 scale per 128 input channels |
60
+ | Everything else (embeddings, LM head, attention, router, norms, short convs, loop controllers, AttnRes queries, vision encoder) | BF16 / FP32 | unchanged |
61
+ | DSpark drafter `mtp.safetensors` | BF16 | unchanged (byte-identical) |
62
+
63
+ - The experts are the only tensors that were quantized in the original checkpoint, and the only ones changed here.
64
+ - Expert layout, in the compressed-tensors `pack-quantized` format, stacked per layer:
65
+ - `w13_weight_packed`: int32 `[128, 2304, 288]`, with `w13_weight_scale`: bf16 `[128, 2304, 18]`
66
+ - `w2_weight_packed`: int32 `[128, 2304, 144]`, with `w2_weight_scale`: bf16 `[128, 2304, 9]`
67
+ - Values are stored as `q + 8` in 4-bit fields.
68
+ - Per-tensor precisions are in `hf_quant_config.json` (compute dtype `w4a16`). Per-tensor quantization errors are in `quantization_stats.json`.
69
+
70
+ ## How it was made
71
+
72
+ 1. **Exact dequantization of the original experts** to fp32.
73
+ - NVFP4: `e2m1 * e4m3_block_scale * amax / 2688`.
74
+ - MXFP8: `e4m3 * 2^(e8m0 - 127)`.
75
+ - 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.
76
+ 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.
77
+ - 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%.
78
+ 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.
79
+
80
+ **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.
81
+
82
+ The converter is in the GitHub repo: [`quantize/convert.py`](https://github.com/tonyd2wild/Inkling-2-Mini-W4A16-RTX3090/blob/main/quantize/convert.py).
83
+
84
+ ## Quality vs the original checkpoint
85
+
86
+ Both were measured on the same 2x RTX 3090 with greedy decoding.
87
+
88
+ | | Original NVFP4/MXFP8 | **This W4A16** |
89
+ |---|---|---|
90
+ | Perplexity, prose passage | 4.574 | 4.677 (**+2.3%**) |
91
+ | Perplexity, code passage | 1.153 | 1.154 (+0.1%) |
92
+ | Perplexity, math passage | 1.812 | 1.800 (-0.7%) |
93
+ | 19 fixed prompts | 19/19 | 19/19 |
94
+ | 69-scenario tool eval | 88.4 (DGX Spark) | 87.0 |
95
+
96
+ - 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.
97
+ - The perplexity check uses three short fixed passages, so it is a sanity check, not a benchmark.
98
+
99
+ ## Files
100
+
101
+ | File | Size | |
102
+ |---|---|---|
103
+ | `model-00001-of-00004.safetensors` | 5,256,955,920 B | |
104
+ | `model-00002-of-00004.safetensors` | 5,255,336,992 B | |
105
+ | `model-00003-of-00004.safetensors` | 5,255,337,016 B | |
106
+ | `model-00004-of-00004.safetensors` | 700,711,704 B | |
107
+ | `mtp.safetensors` | 635,801,416 B | DSpark drafter, unchanged from the original |
108
+ | `model.safetensors.index.json`, `config.json`, `hf_quant_config.json` | | describe the INT4 experts |
109
+ | `quantization_stats.json` | | per-tensor relative error |
110
+ | `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 |
111
+ | `LICENSE` | | Apache License 2.0 |
112
+
113
+ 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`.
114
+
115
+ ## Requirements
116
+
117
+ - **vLLM image:** the official `vllm/vllm-openai:inkling-2-mini` image (tested digest `sha256:c2dc759f5984f69c1e2418c6af7c26eb756f5ed2a8934c768ae1253645d1449e`).
118
+ - **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:
119
+ - that image's Inkling code only accepts NVFP4/MXFP8 experts
120
+ - the image as shipped does not run on Ampere at all (FlashAttention-3, PDL, TMA, and several kernels compiled for SM90+ or SM100 only)
121
+ - **GPUs:** 2x 24 GB for the 448K lane. One 24 GB card runs it with up to 32K context.
122
+ - **Transformers:** there is no transformers implementation of this architecture, so the checkpoint cannot be loaded with `transformers`.
123
+
124
+ ## Quick start
125
+
126
+ ```bash
127
+ hf download Tech2wild/Inkling-2-Mini-W4A16 --local-dir ~/models/Inkling-2-Mini-W4A16
128
+ docker pull vllm/vllm-openai:inkling-2-mini
129
+ git clone https://github.com/tonyd2wild/Inkling-2-Mini-W4A16-RTX3090
130
+ cd Inkling-2-Mini-W4A16-RTX3090
131
+ ./launch_tp2_max.sh # 2x 3090, 448K, DSpark, text-only, port 8130 (~2.5 min to start)
132
+
133
+ curl -s http://localhost:8130/v1/chat/completions -H 'Content-Type: application/json' -d '{
134
+ "model": "inkling-2-mini-w4a16",
135
+ "messages": [{"role": "user", "content": "What is 17 * 23?"}],
136
+ "max_tokens": 512,
137
+ "chat_template_kwargs": {"reasoning_effort": "none"}
138
+ }'
139
+ ```
140
+
141
+ 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.
142
+
143
+ ## Limits
144
+
145
+ - **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.
146
+ - **BF16 KV cache only on Ampere.** Inkling's attention supports FP8 KV only on SM12x GPUs.
147
+ - **The first requests after a start are slower** (about 1.7 s to the first token) while Triton compiles kernels for new shapes.
148
+ - **Needs the overlay** and the tested vLLM image build. Other vLLM versions will need the changes ported.
149
+ - **Calibration-free INT4.** Prose perplexity is about 2% higher than the original.
150
+ - **Single requests only.** All numbers are one request at a time. No concurrency or load tests were run.
151
+
152
+ ## License
153
+
154
+ 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).
155
+
156
+ Changes from the original:
157
+ - The routed-expert weights were re-quantized from NVFP4/MXFP8 to INT4.
158
+ - `config.json` (`quantization_config`), `hf_quant_config.json` and `model.safetensors.index.json` were rewritten for the INT4 experts.
159
+ - The model weights were re-sharded into four files.
160
+ - `quantization_stats.json` was added.
161
+
162
+ All other files are unchanged copies of the original.
163
+
164
+ 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.
165
+
166
+ ## Credits
167
+
168
+ - [Thinking Machines Lab](https://huggingface.co/thinkingmachines) for Inkling 2 Mini, its checkpoint and the DSpark drafter.
169
+ - 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.
170
+ - The INT4 layout follows the [compressed-tensors](https://github.com/vllm-project/compressed-tensors) `pack-quantized` convention.