File size: 15,191 Bytes
0a1aeca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c8e3df6
 
0a1aeca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c8e3df6
0a1aeca
 
 
 
c8e3df6
0a1aeca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27045bb
0a1aeca
 
 
 
 
 
 
 
 
27045bb
0a1aeca
 
 
 
 
 
 
 
 
 
 
c8e3df6
0a1aeca
c8e3df6
0a1aeca
 
 
c8e3df6
0a1aeca
 
 
 
 
 
 
 
 
c8e3df6
0a1aeca
 
 
 
 
 
c8e3df6
0a1aeca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
---

base_model: thinkingmachines/Inkling-2-Mini
base_model_relation: quantized
license: apache-2.0
pipeline_tag: image-text-to-text
tags:
  - quantized
  - moe
  - low-bit
  - e-means
  - grpo
  - llama-cpp
  - custom-kernel
  - 12gb-vram
  - 8gb-vram
  - rocm
  - cuda
---


# Inkling-2-Mini β€” E-MEANS Quantizations (`3.04 bpw` & `2.27 bpw`)

Experimental mixed-precision `e-means` quantizations of [Inkling-2-Mini](https://huggingface.co/thinkingmachines/Inkling-2-Mini) (`26.2B` MoE, `5.4B` effective active):

- **`Inkling-2-Mini-3.04bpw.emns`** (`9.20 GiB` VRAM / `9.87 GB` on HF): Fits 100% inside a **12 GB GPU** at `47 tok/s` with `52K–72K` context and `0` RAM spill.
- **`Inkling-2-Mini-2.27bpw.emns`** (`6.88 GiB` VRAM / `7.39 GB` on HF β€” **Experimental**): Fits inside an **8 GB GPU** (`~24K–32K` headless / `~8K–16K` desktop with `q4_0` KV). Structurally verified (`EMNS0001`, `694` tensors, `120/120` GRPO LoRA merged); live token generation smoke test and benchmarks pending.

> **Requires the `llama.cpp-emeans` Loader (Won't Open Directly in LM Studio / Ollama / Stock `llama.cpp`):**
> `.emns` is a custom low-bit quant format, so standard GGUF loaders cannot read it natively.
> - **Safe & open-source loader:** Grab a GitHub-Actions-built zip from [**`olsn-bit/llama.cpp-emeans` (`v0.1.1-emeans`)**](https://github.com/olsn-bit/llama.cpp-emeans/releases/latest), or audit and compile it yourself from the full repo or [`0001-ggml-cuda-add-e-means-.emns-HIP-CUDA-kernels-WMMA-pr.patch`](patches/0001-ggml-cuda-add-e-means-.emns-HIP-CUDA-kernels-WMMA-pr.patch) (applies cleanly on `llama.cpp` `b2236cb39`).
> - **Use any UI, harness, or CLI you want:** The loader only serves the model β€” once running on any `--port` you pick, it exposes a standard OpenAI-compatible API (`http://127.0.0.1:<PORT>/v1`) that plugs into **any** client (Open WebUI, OpenCode, Cline, `pi`, SillyTavern, Python, etc.), or run directly in terminal with `llama-cli`.

---

## Files

| File | Size (VRAM / Windows) | Size (HF / Decimal) | Bit-Width | What it is |
|---|---:|---:|---:|---|
| `Inkling-2-Mini-3.04bpw.emns` | `9.20 GiB` | `9.87 GB` | `3.04 bpw` | **Recommended (12 GB+ VRAM)** β€” mixed-precision `2.5–4b`, fits 100% in 12 GB VRAM (`52K` desktop / `72K` headless) |
| `Inkling-2-Mini-2.27bpw.emns` | `6.88 GiB` | `7.39 GB` | `2.27 bpw` | **Experimental (8 GB VRAM)** β€” `2.0`-bit 2D codebook MoE + `4.0`-bit dense/attn/embed (`~24K–32K` headless / `~8K–16K` desktop; live smoke test pending) |
| `Inkling-2-Mini-metadata-stub.gguf` | `11.4 MiB` | `12.0 MB` | β€” | **Required** header + tokenizer stub (zero weight bytes; shared by both `.emns` models) |
| `mmproj-Inkling-2-Mini-Q4.emns` | `167.7 MiB` | `176 MB` | `4.0 bpw` | Optional 4-bit vision encoder (`0` VRAM on CPU, or `2Γ—` faster on GPU) |
| `mmproj-Inkling-2-Mini-metadata-stub.gguf` | `23.4 KiB` | `24.0 KB` | β€” | Header stub for vision (only needed if using `mmproj`) |
| *`Inkling-2-Mini-4.0bpw.emns`* | *`~12.5 GiB`* | *`~13.4 GB`* | *`~4.0 bpw`* | *Planned β€” 16 GB+ HQ tier (or 12 GB with offload / multi-GPU)* |

*Note on file sizes: Windows, Linux `ls -lh`, and GPU VRAM use binary `GiB` (`1024Β³`), while Hugging Face's Files tab displays decimal `GB` (`1000Β³`). Both columns are the exact same byte count (`9,873,665,184` B for `3.04bpw`, `7,387,230,816` B for `2.27bpw`).*

---

## What's Inside (Layer Precision Breakdown)

Inkling-2-Mini runs its middle 12 layers (`L6–L17`) **3 times per token**. Both builds keep sensitive dense/attention/embedding layers at 4-bit and merge the `120/120` GRPO recovery LoRA before packing:

| Layer Group | `3.04 bpw` (`9.20 GiB` / `9.87 GB`) | `2.27 bpw` (`6.88 GiB` / `7.39 GB`, Experimental) | Why |
|---|---|---|---|
| Dense, attention, embeddings, `lm_head` | **4.0-bit** (`EM1D_Q4_G64`) | **4.0-bit** (`EM1D_Q4_G64`) | Most sensitive weights |
| Looped core MoE experts (`L6–L17`, `3Γ—`/token) | **3.0-bit** (`EM1D_Q3_G64`) | **2.0-bit** (`EM2D_K16_G128`) | `3.04bpw` protects `3Γ—` error compounding; `2.27bpw` trades core precision to fit 8 GB VRAM |
| Outer MoE experts (`1Γ—`/token) | **2.5-bit** (`EM2D_K32_G128`) | **2.0-bit** (`EM2D_K16_G128`) | 2D vector codebooks compress MoE experts tightly |
| Routers, norms, `sconv` | **FP32** | **FP32** | Tiny footprint, keeps routing stable |

![Coding Comparison](assets/ab_bench_comparison.png)

![VRAM & Context Scaling](assets/vram_vs_context.png)

---

## Benchmarks (`3.04 bpw`)

*(All benchmarks below are measured on **`Inkling-2-Mini-3.04bpw.emns`**. Live token tests and benchmarks for experimental `Inkling-2-Mini-2.27bpw.emns` will be added next.)*

### 1. Coding Tasks (`ab_bench`, 13 tasks, `32K` context on RX 6700 XT 12 GB, tested Nov 2026)



| Model | Bit-Width | Size | Passed (↑) | Hard Tasks (↑) | Decode Speed | Total Tokens | Total Time (↓) | Stuck / Capped (↓) |

|---|---|---:|---:|---:|---:|---:|---:|---:|

| Unsloth `UD-Q2_K_XL` (Nov 2026) | mixed ~2–3b | `9.14 GB` | `8 / 13` | `4 / 8` | `51.3 tok/s` | `22,202` | `444.9 s` | `4` |

| **This Build (`3.04 bpw`)** | **mixed 2.5–4b** | **`9.20 GiB` (`9.87 GB`)** | **`10 / 13`** | **`6 / 8`** | `47.6 tok/s` | **`12,240`** (`-45%`) | **`264.9 s`** (`1.68Γ—` faster) | **`1`** |



### 2. Perplexity & KLD vs Uncompressed Original (Colab L4 Gate, Pre-GRPO)



| Variant | Size | Wiki PPL (↓) | Code PPL (↓) | KLD vs Original (↓) |

|---|---:|---:|---:|---:|

| Original Checkpoint (`NVFP4/MXFP8/BF16`) | `~20 GB` | `6.609` | `1.573` | `0.000` (ref) |

| **`3.04 bpw` (pre-GRPO)** | **`9.20 GiB` (`9.87 GB`)** | `7.023` | `1.595` | `0.083` |



*(Local post-GRPO `llama-perplexity` KLD / Top-1 comparison against `UD-Q2_K_XL` will be added next.)*



### 3. Thinking Effort (`8` coding tasks on RX 6700 XT)



| Thinking Effort | Passed (↑) | Avg Time / Task (↓) | Total Tokens | Best For |

|---|---:|---:|---:|---|

| **`low` (Recommended)** | **`7 / 8`** | **`9.5 s`** | `3,418` | Daily coding, quick edits |

| `medium` | `7 / 8` | `13.2 s` | `4,835` | Multi-file refactors |

| `high` | `7 / 8` | `16.9 s` | `6,242` | Hard debugging |



---



## Hardware & Context Tested



### AMD RX 6700 XT (`12 GB`, Real `3.04 bpw` Weights, `0` RAM Spill)



| Context | Dedicated VRAM | Shared Spill | Prompt Speed (`pp`) | Decode Speed (`tg`) | Notes |

|---:|---:|---:|---:|---:|---|

| `llama-bench` (`-ub 128`) | `~9.6 GiB` | `0` | **`213.5 tok/s`** | **`48.7 tok/s`** | `229.5 tok/s` pp @ `-ub 256` |

| **`32K` (`llama-server`, default)** | **`10,416 MiB`** | **`0`** | `190.4 tok/s` | **`47.2 tok/s`** | **Safe with IDE + browser open** |

| `52K` (`llama-server`, clean desktop) | `10,777 MiB` | `0` | `190.3 tok/s` | `47.2 tok/s` | Recommended on clean 12 GB desktop |

| `72K` (`llama-server`) | `11,137 MiB` | `0` | `190.2 tok/s` | `47.0 tok/s` | Max tested on 12 GB (headless / clean desktop) |



### Optional 4-Bit Vision (`mmproj-Inkling-2-Mini-Q4.emns`, `167.7 MiB` / `176 MB` vs `610 MiB` F16)



| Vision Mode | File Size | Image Encode | Extra VRAM | Visual / OCR Quality |

|---|---:|---:|---:|---|

| Stock `mmproj-F16.gguf` (CPU) | `610 MiB` | `2.41 s` | **`0 MiB`** | Reference (crisp OCR) |

| **Q4 Vision (CPU β€” Default)** | **`167.7 MiB`** (`3.64Γ—` smaller) | `2.45 s` | **`0 MiB`** | **Matches F16** (`cos = 0.995`, keeps full `52K` text) |

| Q4 Vision (GPU) | `167.7 MiB` | **`1.22 s`** (`2Γ—` faster) | `+368 MiB` ded / `+613 MiB` shr | Matches F16 (`cos = 0.995`) |



### NVIDIA CUDA Max Context Scaling *(Synthetic Exact-Manifest Weights)*



> *Measured using a synthetic `.emns` matching the exact `694`-tensor `9.20 GiB` layout to verify CUDA kernel speed, WMMA accuracy (`0.000000` max logprob diff), and max zero-OOM context. Does not measure model quality.*



| GPU | VRAM | Backend | `-ub` | `pp512` (tok/s) | `tg128` (tok/s) | Max Zero-OOM Context |

|---|---|---|---:|---:|---:|---|

| **NVIDIA L4** (`72 W`) | `24 GB` | CUDA `13.0` (Tensor Core WMMA) | `128` / `256` | **`582.8`** / **`748.2`** | **`51.8`** / `51.5` | **`640K`** (`21.5 / 23.0 GiB`, `47.2 tok/s`) |

| **NVIDIA Tesla T4** | `16 GB` | CUDA (pre-WMMA baseline) | `128` | `89.3` | `25.3` | **`256K`** (`14.4 / 15.4 GiB`, `25.4 tok/s`) |



---



## Quickstart (3 Steps)



### 1. Download the Weights



**12 GB+ VRAM (`3.04 bpw`, Recommended):**

```bash

pip install -U "huggingface_hub[cli]"
hf download olnnn/Inkling-2-Mini-EMEANS --include "Inkling-2-Mini-3.04bpw.emns" "Inkling-2-Mini-metadata-stub.gguf" "SHA256SUMS" --local-dir ./inkling2
```



**8 GB VRAM (`2.27 bpw`, Experimental):**

```bash

hf download olnnn/Inkling-2-Mini-EMEANS --include "Inkling-2-Mini-2.27bpw.emns" "Inkling-2-Mini-metadata-stub.gguf" "SHA256SUMS" --local-dir ./inkling2

```

### 2. Get Patched `llama-server`

Download the prebuilt release for your GPU from [**GitHub Releases (`v0.1.1-emeans`)**](https://github.com/olsn-bit/llama.cpp-emeans/releases/latest):

| Platform | GPU Backend | Archive |
|---|---|---|
| Windows (x64) | NVIDIA CUDA 12.4 | `llama-emeans-v0.1.1-emeans-win-cuda-12.4-x64.zip` |
| Windows (x64) | AMD ROCm / HIP | `llama-emeans-v0.1.1-emeans-win-rocm-x64.zip` |
| Linux (x64) | NVIDIA CUDA 12.8 | `llama-emeans-v0.1.1-emeans-ubuntu-cuda-12.8-x64.tar.gz` |
| Linux (x64) | AMD ROCm / HIP | `llama-emeans-v0.1.1-emeans-ubuntu-rocm-x64.tar.gz` |

<details>
<summary>Or build from source (NVIDIA CUDA or AMD ROCm/HIP)</summary>

```bash

git clone -b emeans-hip-cuda-v1 https://github.com/olsn-bit/llama.cpp-emeans.git

cd llama.cpp-emeans



# NVIDIA CUDA (RTX 20/30/40/50, T4, L4, A100, H100)

cmake -B build -DGGML_CUDA=ON -DCMAKE_BUILD_TYPE=Release

cmake --build build --target llama-server llama-bench -j



# AMD ROCm / HIP (e.g. RX 6700 XT = gfx1031)

# cmake -B build -DGGML_HIP=ON -DAMDGPU_TARGETS=gfx1031 -DCMAKE_BUILD_TYPE=Release

# cmake --build build --target llama-server llama-bench -j

```

*(Alternatively, apply [`patches/0001-ggml-cuda-add-e-means-.emns-HIP-CUDA-kernels-WMMA-pr.patch`](patches/0001-ggml-cuda-add-e-means-.emns-HIP-CUDA-kernels-WMMA-pr.patch) directly onto `ggml-org/llama.cpp` commit `b2236cb39`.)*

</details>

### 3. Load the Model (Server or CLI β€” Any Port, Any Client)

**Option A β€” Local OpenAI-Compatible Server (connect any UI, coding agent, or CLI):**
Change `--port 8080` to any free port you prefer, then point your client at `http://127.0.0.1:<PORT>/v1` (or open it in a browser):

**Windows PowerShell (single-line β€” paste as-is; use `.\bin\llama-server.exe` on Windows ROCm):**
```powershell

$env:EMEANS_MODEL = "./inkling2/Inkling-2-Mini-3.04bpw.emns"

.\llama-server.exe -m ./inkling2/Inkling-2-Mini-metadata-stub.gguf -a Inkling-2-Mini-EMEANS -c 32768 -ngl 99 -np 1 -fa on -ctk q4_0 -ctv q4_0 --fit off -b 2048 -ub 128 --temp 1.0 --top-p 1.0 --top-k 0 --min-p 0.0 --cache-reuse 256 --jinja --host 127.0.0.1 --port 8080

```
*(Start with `-c 32768` when browsers/IDEs are open to avoid VRAM spill; raise to `-c 53248` on a clean 12 GB desktop.)*

**Linux / macOS (bash):**
```bash

export EMEANS_MODEL=./inkling2/Inkling-2-Mini-3.04bpw.emns



./llama-server \

  -m ./inkling2/Inkling-2-Mini-metadata-stub.gguf \

  -a Inkling-2-Mini-EMEANS \

  -c 32768 -ngl 99 -np 1 -fa on \

  -ctk q4_0 -ctv q4_0 --fit off \

  -b 2048 -ub 128 \

  --temp 1.0 --top-p 1.0 --top-k 0 --min-p 0.0 \

  --cache-reuse 256 --jinja \

  --host 127.0.0.1 --port 8080

```

**Option B β€” Direct Terminal CLI (`llama-cli`):**
```bash

export EMEANS_MODEL=./inkling2/Inkling-2-Mini-3.04bpw.emns

./llama-cli -m ./inkling2/Inkling-2-Mini-metadata-stub.gguf -c 32768 -ngl 99 -fa on -ctk q4_0 -ctv q4_0 --fit off

```
*(On Windows PowerShell, replace `export EMEANS_MODEL=...` with `$env:EMEANS_MODEL = "./inkling2/Inkling-2-Mini-3.04bpw.emns"` and run `.\llama-cli.exe` β€” or `.\bin\llama-cli.exe` on Windows ROCm.)*

*(For **8 GB VRAM** with experimental `Inkling-2-Mini-2.27bpw.emns`, point `EMEANS_MODEL` to `./inkling2/Inkling-2-Mini-2.27bpw.emns` and start with `-c 16384` on desktop or `-c 24576`–`32768` headless.)*

*(Optional 4-bit CPU vision = `0 MiB` VRAM: set `EMEANS_VISION_MODEL` β€” `$env:EMEANS_VISION_MODEL = "./inkling2/mmproj-Inkling-2-Mini-Q4.emns"` in PowerShell or `export EMEANS_VISION_MODEL=./inkling2/mmproj-Inkling-2-Mini-Q4.emns` in bash β€” and add `--mmproj ./inkling2/mmproj-Inkling-2-Mini-metadata-stub.gguf --no-mmproj-offload`.)*

### Using with Coding Agents (`pi`, OpenCode, Cline, OpenAI API)

Set thinking/reasoning effort to **`low`** for fast coding (`7/8` pass in `9.5 s` avg):

- **`pi` (`~/.pi/agent/settings.json`):**
  ```json

  {

    "modelThinkingLevels": {

      "local/Inkling-2-Mini-EMEANS": "low"

    }

  }

  ```
- **OpenAI-compatible API / OpenCode / Cline:**
  ```json

  {

    "model": "Inkling-2-Mini-EMEANS",

    "reasoning_effort": "low",

    "temperature": 1.0,

    "top_p": 1.0

  }

  ```

---

<details>
<summary>Technical Details: Tensor Precision Map, Checksums & Notes</summary>

- **`Inkling-2-Mini-3.04bpw.emns`** (`9.20 GiB` / `9.87 GB`, `9,873,665,184` bytes, `694` tensors):
  - SHA256: `2748aa8d1ebc14658624d1de60b3f108c79b8ef3eff45de1d31cb136857373bc`
  - `356` `FP32`: all RMSNorms, MoE router gates, and `sconv` tensors.
  - `290` `EM1D_Q4_G64` (`4.0`-bit): dense attention projections, `token_embd`, `lm_head` (`10Γ—` digit-token Hessian + `sFisher` `lm_head`).
  - `24` `EM1D_Q3_G64` (`3.0`-bit): all `3Γ—`-looped core MoE experts (`L6–L17`).
  - `24` `EM2D_K32_G128` (`2.5`-bit): once-executed outer MoE experts.
- **`Inkling-2-Mini-2.27bpw.emns`** (`6.88 GiB` / `7.39 GB`, `7,387,230,816` bytes, `694` tensors β€” **Experimental**):
  - SHA256: `1bed9a13791fd0060cde1f6da8c9ea3cf27c99b9a7fd1cabadd5605cfed0b574`
  - `348` `FP32`, `298` `EM1D_Q4_G64` (`4.0`-bit dense/attn/embed/`lm_head`), `48` `EM2D_K16_G128` (`2.0`-bit 2D codebook across all MoE experts).
  - Mean MoE packing `rel_L2 = 0.3379`; `120/120` GRPO LoRA projections merged prior to packing.
- **Vision (`mmproj-Inkling-2-Mini-Q4.emns`, `167.7 MiB` / `176 MB`, `175,809,568` bytes):**
  - SHA256: `08838738a76305f42884893b772fe20f5d8358c6fcbf8864d4b1da1607ec7262`
  - `140` `EM1D_Q4_G64` linear layers + `282` FP16/FP32 tensors (`cos = 0.9942–0.9955`).
- **GRPO Recovery:** Merged `120/120` GRPO LoRA projections (`inkling2_grpo_v1`) prior to `.emns` packing.
- **Speculative Decoding (`DSpark`) Note:** Tested on RX 6700 XT (`61.4%` acc, `36.4 tok/s`) and T4 (`67.2%` acc, `23.1 tok/s`). Multi-token verification activates `~4Γ—` more unique experts on a 128-expert MoE, so **no-draft is faster and lighter**.

</details>

---

## License & Credits

- **Model Weights:** Apache 2.0 (inherited from [`thinkingmachines/Inkling-2-Mini`](https://huggingface.co/thinkingmachines/Inkling-2-Mini)).
- **Engine Patch (`.emns` HIP + CUDA kernels):** MIT License (matching [`ggml-org/llama.cpp`](https://github.com/ggml-org/llama.cpp)).
- **Credits:** Thinking Machines Lab (`Inkling-2-Mini`), `ggml-org/llama.cpp`, `unslothai/llama.cpp`.