ashxhart's picture
Update README to clean TFQ X.XX naming
95b03ad verified
|
Raw History Blame Contribute Delete
9.2 kB
---
license: apache-2.0
base_model: thinkingmachines/Inkling-2-Small
base_model_relation: quantized
pipeline_tag: image-text-to-text
tags:
- tensorfold
- tfq
- tfp6
- tfq-2.32
- quantized
- moe
- inkling2
- coding
- conversational
- apple-silicon
- cuda
- rocm
inference: false
---
<p align="center">
<a href="https://huggingface.co/thinkingmachines"><img src="assets/thinkingmachines-logo.png" alt="Thinking Machines" width="96" height="96" /></a>
</p>
<h1 align="center">Inkling-2-Small (587B) — TFQ 2.32</h1>
<p align="center">
<a href="https://huggingface.co/thinkingmachines/Inkling-2-Small">Base MXFP8 (~366 GiB)</a> |
<a href="https://github.com/ashhart/TensorFold">TensorFold</a> |
<a href="https://github.com/ashhart/TFQ">TFQ</a> |
<a href="LICENSE">Apache-2.0 License</a>
</p>
<p align="center">
<img src="https://img.shields.io/badge/Memory_Fit-172.11_GiB_Core_%2F_175.32_GiB_w%2F_MTP_(Fits_2x96GB_%2F_192GB_Mac)-0f766e" alt="Memory Fit 172.11 GiB" />
<img src="https://img.shields.io/badge/Format-TFQ_(TFP6_Zero--LUT_A8)-2563eb" alt="TFQ TFP6" />
<img src="https://img.shields.io/badge/Precision-2.32_bpw_Tempered_MCKP_(2.0--4.5_bpw)-4f46e5" alt="TFQ 2.32" />
<img src="https://img.shields.io/badge/Model--Text_KL-0.008909_(A8)-7c3aed" alt="Model-Text KL 0.008909" />
<img src="https://img.shields.io/badge/Model--Text_Top--1-97.49%25_(Top--5_99.99%25)-16a34a" alt="Top-1 97.49%" />
<img src="https://img.shields.io/badge/Premature_Stops-0%2F46%2C262_(0.000%25)-15803d" alt="0 Premature Stops" />
<img src="https://img.shields.io/badge/Shards-48%2F48_XXH64_Verified-15803d" alt="48/48 Verified" />
</p>
**`Inkling-2-Small-TFQ-2.32`** is a compact TensorFold Quantization (**TFQ**, `TFP6` zero-LUT pure-ALU native signed-`int8` format) checkpoint of [**thinkingmachines/Inkling-2-Small**](https://huggingface.co/thinkingmachines/Inkling-2-Small) (587B MoE, 48 layers, 384 routed experts per layer, `H = 4608`, `I = 2304`, `200,058`-token active vocabulary with `final_logit_softcapping = 30.0`, and optional MTP speculative decoding head).
> **GPU VRAM & Hardware Fit (Fits 2× 96 GB GPUs / 1× 192 GB MI300X / 192 GB+ Mac Studio!)**
> - **Core Model Footprint (without MTP):** **`172.11 GiB`** (`159.10 GiB` TFP6 MoE across 48 layers + `13.01 GiB` untouched non-MoE) — fits **`2× 96 GB` GPUs** (`~20 GiB` KV headroom), **`1× 192 GB` AMD MI300X**, **`4× 48 GB`** GPUs, **`8× 24 GB`** GPUs, or a **`192 GB` / `256 GB` / `512 GB` Apple Silicon Mac Studio**!
> - **Full Checkpoint (including optional `3.19 GiB` MTP head):** **`175.32 GiB`** total on disk (`3.4×` smaller than `587B` BF16 / `2.1×` smaller than native `~366 GiB` MXFP8).
| Hardware Target | Memory Footprint | Notes |
|---|---:|---|
| **2× 96 GB GPUs (RTX PRO 6000 / H100 94GB / B200)** | **`172.11 GiB`** core (`175.32 GiB` w/ MTP) | Fits 2×96 GB with **`~16.7–19.9 GiB` KV headroom** |
| **192 GB / 256 GB / 512 GB Apple Silicon Mac Studio** | **`172.11 GiB`** core (`175.32 GiB` w/ MTP) | 100% resident in unified memory (`~16–336 GiB` KV headroom) |
| **1× 192 GB AMD MI300X / 4× 48 GB / 8× 24 GB GPUs** | **`172.11 GiB`** core (`175.32 GiB` w/ MTP) | Fits cleanly with full zero-LUT native `int8` execution |
All `55,296` routed MoE matrices (`48` layers × `384` experts × `{gate, up, down}`) are quantized directly from the native MXFP8 checkpoint using **calibrated sequential 2-stage `w²`-weighted per-expert Hessian-LDLQ-H** with **tempered SwiGLU Jacobian MCKP rate allocation** (`2.3187 bpw` average with a **strict `2.0 bpw` hard floor** across `2.0–4.5 bpw`: `L00 = 3.5 bpw`, `L01..L05 = 2.5 bpw`, `L06..L39 = 2.25 bpw`, `L40..L47 = 2.35 bpw`), while keeping **all non-MoE tensors (`13.01 GiB`) and MTP (`3.19 GiB`) untouched**.
## Highlights
- **Footprint:** **`175.32 GiB`** total on disk (**`172.11 GiB`** core without MTP):
- **`159.10 GiB`** across 48 self-contained `TFP6` MoE shards (`moe_L00.tffp6` .. `moe_L47.tffp6`, `55,296` tensors total — zero external lookup tables).
- **`13.01 GiB`** across 4 untouched non-MoE shards (`nonmoe-00001..00004.safetensors`) + **`3.19 GiB`** untouched `mtp.safetensors`.
- **Zero-LUT Pure-ALU Native `int8` (`TFP6` + `FLAG_A8_HADAMARD`):** Decodes directly to signed `int8` with zero LUT lookups and supports both normative `128×128` Hadamard `int8` activation execution (`tfp6_a8`) and BF16 activation execution (`tfp6_a16`).
- **Calibrated Sequential 2-Stage Method:**
- Tempered SwiGLU Jacobian MCKP rate allocation (`power = 0.75`, `10%` median floor, strict hard floor `min = 2.0 bpw`, `max = 4.5 bpw`, `avg = 2.3187 bpw`).
- Sequential `384 × 2048` (`786,432` tokens) calibration with `w²`-weighted Stage-1 `H_up`, post-quantization Stage-2 `H_down`, and 2-pass coordinate polish (`--polish --polish-su --polish-sv --share-su-groups`).
- **Integrity:** All 48 shards verified **`48/48 OK [A8] [XXH64 verified]`** via `tfq3-inspect`.
## Evaluation (Exact 200,058-Vocab FP64 Held-Out KL & Stop Stability)
Evaluated over **50 × 2048 (`102,350` total next-token predictions, including `46,262` assistant `model_text` tokens)** across five strictly held-out domains (chat, code, math, prose, and tool calls), comparing exact full **200,058-vocabulary FP64 log-probabilities** (`final_logit_softcapping = 30.0`) directly against native **`thinkingmachines/Inkling-2-Small` MXFP8 Gold**:
### Overall Model-Text (`46,262` Assistant Tokens) & All Tokens (`102,350` Tokens)
| Execution Path | Slice | KL (`gold \|\| cand`) | Rev-KL | Top-1 Agree | Top-5 Agree | Gold PPL → Cand PPL (`Δ%`) |
|---|---|---:|---:|---:|---:|---:|
| **`tfp6_a8` (Normative)** | **Model Text (`46,262` tok)** | **`0.008909`** | **`0.009550`** | `97.49%` | **`99.987%`** | **`1.8512 → 1.8581 (+0.373%)`** |
| **`tfp6_a16` (BF16 act)** | **Model Text (`46,262` tok)** | `0.009006` | `0.009837` | **`97.50%`** | `99.983%` | `1.8512 → 1.8582 (+0.380%)` |
| **`tfp6_a8` (Normative)** | All Tokens (`102,350` tok) | `0.031075` | **`0.035630`** | `95.67%` | `99.851%` | **`2.7849 → 2.8488 (+2.295%)`** |
| **`tfp6_a16` (BF16 act)** | All Tokens (`102,350` tok) | **`0.030910`** | `0.036200` | **`95.69%`** | **`99.858%`** | `2.7849 → 2.8527 (+2.435%)` |
### Per-Category Breakdown (`tfp6_a8` & `tfp6_a16` vs Native Gold)
| Category | Model-Text `tfp6_a8` KL / Top-1 / ΔPPL | Model-Text `tfp6_a16` KL / Top-1 / ΔPPL | All-Token `tfp6_a8` KL / ΔPPL |
|---|---:|---:|---:|
| **Tool Calls** (`4,237` mt / `20,470` all) | **`0.004559`** / **`98.87%`** / **`-0.415%`** | `0.004753` / `98.84%` / `-0.287%` | `0.019506` / `+0.592%` |
| **Code** (`10,357` mt / `20,470` all) | **`0.004797`** / **`98.55%`** / **`-0.236%`** | `0.004812` / `98.53%` / `-0.217%` | `0.015070` / `+0.109%` |
| **Math** (`15,292` mt / `20,470` all) | **`0.008005`** / `98.07%` / **`+0.751%`** | `0.008091` / **`98.11%`** / `+0.919%` | `0.029602` / `+3.148%` |
| **Chat** (`16,376` mt / `20,470` all) | **`0.013479`** / `95.93%` / `+0.611%` | `0.013613` / **`95.94%`** / **`+0.429%`** | `0.024547` / `+1.373%` |
| **Prose** (`20,470` all) | N/A *(no assistant turns)* | N/A *(no assistant turns)* | `0.066649` / `+6.376%` |
### Teacher-Forced EOS Stop Stability (`eos_token_id = 200006`)
| Execution Path | EOS Ends (`n=157`) Flips (Confident) | Math (`n=51`) | Tool Calls (`n=22`) | Code (`n=38`) | Chat (`n=46`) | Premature Stops (`n=46,262`) | Mean KL@Stop |
|---|---:|---:|---:|---:|---:|---:|---:|
| **`tfp6_a8` (Normative)** | **`6` (`3.82%`) / `1` conf (`0.64%`)** | **`0 / 51`** | **`0 / 22`** | **`2 / 38` (`0` conf)** | **`4 / 46` (`1` conf)** | **`0 / 46,262` (`0.000%`)** | **`0.04177`** |
| **`tfp6_a16` (BF16 act)** | `8` (`5.10%`) / `3` conf (`1.91%`) | `0 / 51` | `0 / 22` | `3 / 38` (`2` conf) | `5 / 46` (`1` conf) | `1 / 46,262` (`0` conf) | `0.07001` |
*Evaluation notes: Prose sequences contain raw document text without chat assistant turns (`model_text` and EOS stop metrics are N/A for prose), and prose accounts for the largest all-token PPL delta (`+6.376%` for `tfp6_a8`, `+6.420%` for `tfp6_a16`) along with packed multi-document boundaries. All metrics above are teacher-forced next-token evaluations against native MXFP8 Gold.*
## Checkpoint Layout
- `moe_L00.tffp6` .. `moe_L47.tffp6`: `48` self-contained `TFP6` v6 MoE shards (`159.10 GiB` total; `1,152` tensors per layer: `384` routed experts × `{gate, up, down}`).
- `nonmoe-00001-of-00004.safetensors` .. `nonmoe-00004-of-00004.safetensors` + `model.safetensors.index.json`: Untouched non-MoE tensors (`13.01 GiB` — embeddings, `lm_head`, attention, norms, routers).
- `mtp.safetensors`: Optional untouched Multi-Token Prediction speculative head (`3.19 GiB`).
- Tokenizer (`tiktoken` / `tokenizer*`), `chat_template.jinja`, and config files copied verbatim from `thinkingmachines/Inkling-2-Small`.
## Running with TensorFold
```bash
tensorfold serve TensorFold/Inkling-2-Small-TFQ-2.32
```
Open-source `TFP6` specification, conformance suite, and Metal/CUDA/ROCm converters live in [TFQ](https://github.com/ashhart/TFQ).
## License
This quantized checkpoint inherits the [Apache 2.0 License](LICENSE) from `thinkingmachines/Inkling-2-Small`.