File size: 7,313 Bytes
f8033af | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | ---
license: apache-2.0
base_model: thinkingmachines/Inkling-2-Mini
base_model_relation: quantized
library_name: vllm
pipeline_tag: text-generation
language:
- en
- pt
tags:
- inkling2
- moe
- gptq
- int4
- w4a16
- compressed-tensors
- marlin
- speculative-decoding
- dspark
- rtx-3090
- sm86
---
# Inkling-2-Mini-SM86-Fast
A text-only requantization of [thinkingmachines/Inkling-2-Mini](https://huggingface.co/thinkingmachines/Inkling-2-Mini)
(26B total, ~3B active, looped MoE) built for **two RTX 3090s (Ampere SM86, tensor
parallel 2)** on the [`vllm-inkling2`](https://github.com/quantforge-br/vllm-inkling2/tree/inkling2-sm86)
fork, with a 262,144-token context and DSpark speculative decoding.
- Routed experts and attention projections: symmetric `uint4b8` GPTQ, group 128
(compressed-tensors `pack-quantized`), loaded straight into Marlin W4A16.
- Calibration on the model's own outputs (self-distillation, 5.68M generated tokens
over code, code edits, tool calls, math reasoning, EN and PT-BR chat).
- The official bf16 DSpark draft (`mtp.safetensors`) with a **40,960-id pruned draft
vocabulary** (`draft_vocab_ids.pt`, declared as `mtp_config.pruned_vocab_size`).
- `embed_tokens`, `lm_head`, router, controllers, short convs, `rel_logits_proj`,
AttnRes and norms stay bf16. The vision tower is removed.
## Results
Measured on 2x RTX 3090 (270 W each, PCIe P2P, no NVLink), TP2, single stream, against
the previous checkpoint [`Ar4ikov/Inkling-2-Mini-AWQ-W4A16-ASYM-INT4`](https://huggingface.co/Ar4ikov/Inkling-2-Mini-AWQ-W4A16-ASYM-INT4)
(with GPTQ attention at load) on the same runtime and flags. ABBA order, frozen inputs,
official sampling (temperature 1.0) except where greedy is stated.
| Workload | AWQ | This checkpoint | Change |
|---|---|---|---|
| Code, greedy, decode tok/s | 299.3 | 323.9 | +8.2% |
| Code, T=1.0, decode tok/s | 270.3 | 289.0 | +6.9% |
| Prose EN / PT-BR, T=1.0, decode tok/s | 189.0 | 201.1 | +6.4% |
| Code with 107k / 249k of context, decode tok/s | 306.6 / 212.2 | 308.5 / 220.0 | +0.6% / +3.7% |
| Cold prefill of 106,599 / 249,268 tokens (TTFT) | 26.5 s / 93.9 s | 22.5 s / 72.0 s | −15% / −23% |
| Weights per GPU | 7.42 GiB | 7.12 GiB | −0.30 GiB |
| Peak VRAM per GPU (benchmark) | 20.2 / 18.1 GiB | 20.2 / 18.1 GiB | same |
The full 262,144-token context fits, with 22.2 / 20.0 GiB peak at a 235k-token prompt.
| Quality gate | Result | Gate |
|---|---|---|
| Perplexity, 43,758 tokens of Go code (official checkpoint 1.4147, previous AWQ 1.4206, same runtime) | 1.4204 | ≤ 1.4216 |
| Reasoning leaked into the answer, 12 greedy prompts | 0/12 | 0/12 |
| Tool calls: integrity (streaming, continuation), 30 calls + 30 controls, 12 adversarial arguments | pass, 30/30 + 30/30, 12/12 | all |
| Needle retrieval at 12k / 130k / 235k tokens, 3 seeds each | 9/9 | 9/9 |
## Files
| File | Content |
|---|---|
| `model-000NN-of-00025.safetensors` | GPTQ experts and attention, bf16 dense rest |
| `mtp.safetensors` | official bf16 DSpark draft, unchanged |
| `draft_vocab_ids.pt`, `draft_vocab_ids.json` | the 40,960 draft ids (20,480 per TP shard) and their per-bucket coverage |
| `quantize_stats.json` | per-layer GPTQ output error and scale checks |
| `recipe.yaml`, `reproduce/` | the full recipe and the scripts that built this checkpoint |
| `PROVENANCE.md` | source revision, every decision with its measurement, sha256 of all files |
## Running it
This checkpoint needs the `vllm-inkling2` runtime (stock vLLM does not run Inkling 2 on
SM86 or load its int4 attention): branch `inkling2-sm86`, commit `682e8115a` or
later, installed in editable mode over the precompiled wheel of its merge base.
```bash
export CUDA_DEVICE_ORDER=PCI_BUS_ID OMP_NUM_THREADS=8
export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:False
export VLLM_ALLREDUCE_USE_FLASHINFER_PCIE_IPC=1
export VLLM_INKLING2_INT8_DENSE=1 VLLM_INKLING2_DENSE_BITS=4
export VLLM_INKLING2_EMBED_INT8=1
export VLLM_INKLING2_PREFILL_ATTN_INT8=1 VLLM_INKLING2_PREFILL_ATTN_PV_F16ACC=1 VLLM_INKLING2_PREFILL_ATTN_SPLITS=1
export VLLM_INKLING2_DSPARK_MIN_CONFIDENCE=0.5 VLLM_INKLING2_P2P_AR_CONV=1
vllm serve quant-mind/Inkling-2-Mini-SM86-Fast \
--tensor-parallel-size 2 --distributed-executor-backend mp \
--max-model-len 262144 --max-num-seqs 1 --max-num-batched-tokens 2048 \
--kv-cache-dtype int8_per_token_head --language-model-only --moe-backend humming \
--no-async-scheduling \
--speculative-config '{"method": "dspark", "model": "quant-mind/Inkling-2-Mini-SM86-Fast", "num_speculative_tokens": 7, "kv_cache_dtype": "bfloat16"}' \
--compilation-config '{"mode":0,"cudagraph_mode":"FULL_DECODE_ONLY","decode_cudagraph_capture_request_sizes":[1],"prefill_cudagraph_capture_token_sizes":[]}' \
--reasoning-parser inkling --tool-call-parser inkling --enable-auto-tool-choice
```
- `num_speculative_tokens: 7` is mandatory (the draft block is 8). The draft reads the
pruned vocabulary from the checkpoint; no extra variable is needed.
- `VLLM_INKLING2_DSPARK_MIN_CONFIDENCE=0.5` verifies only the confident prefix of each
draft block and needs `--no-async-scheduling`.
- `VLLM_INKLING2_P2P_AR_CONV=1` and the FlashInfer PCIe-IPC all-reduce need PCIe P2P
between the two GPUs.
- Use the official sampling preset (temperature 1.0) from the client.
- Text only: pass `--language-model-only`.
## Recipe
1. **Self-distillation.** 8,469 prompts from 13 public datasets (listed in
`recipe.yaml`), answered by the official checkpoint at temperature 1.0 with a
reasoning-effort mix. Every 10th prompt per source is held out.
2. **Draft vocabulary.** The 40,960 most frequent completion ids of the train split,
control tokens always kept. Held-out coverage: code 99.46%, tool calls 99.45%,
PT-BR 98.44%, EN prose 97.30%.
3. **Calibration corpus.** 321 rows, 442,712 tokens: 45% code, 25% tool calls and
reasoning, 30% EN / PT-BR prose. Disjoint from the perplexity gate corpus.
4. **Hessians.** Collected by the serving engine on the official checkpoint (TP2,
inputs accumulated over the three passes of the loop, routed rows weighted by their
routing weight, row-parallel inputs gathered so they do not depend on the TP size).
5. **GPTQ.** Damp 0.01, a 64-row prior from the layer's pooled Hessian for rarely routed
experts, symmetric 4-bit, group 128, strictly positive scales.
## Measured and not adopted
| Change | Result |
|---|---|
| int4 GPTQ draft | −2.4% greedy decode, greedy acceptance −5% |
| Marlin W8 target head | same perplexity, no step gain, prose −1.6%, +0.22 GiB/GPU |
| W4 target head | T=1 acceptance −5%, perplexity +0.0002 |
| W4A8-INT8 prefill | 1.02–1.07x on the attention GEMMs, 5x output error |
| decode attention without the old-token bias | exact, +1.7% at 249k: below the adoption floor |
## Limitations
- Built and validated only on 2x RTX 3090 with TP2, single stream (`max-num-seqs 1`).
- Eager and CUDA-graph greedy outputs diverge after a few hundred tokens on some
prompts, as they do for the previous AWQ checkpoint on the same runtime.
- Vision is removed. Use the official checkpoint for image input.
## License
Apache 2.0, as the source model. Inkling 2 Mini is by Thinking Machines Lab; the
quantization, the draft vocabulary and the SM86 runtime changes are by quant-mind.
|