File size: 8,639 Bytes
2141c24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9e8ebf3
2141c24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42f938e
 
 
2141c24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42f938e
2141c24
 
 
 
 
 
 
 
 
 
 
 
 
 
42f938e
 
2141c24
 
 
 
 
 
42f938e
2141c24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
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: text-generation
language:
  - en
tags:
  - kindi
  - inkling
  - moe
  - looped-transformer
  - quantized
  - 8gb-gpu
---

# AH-Inkling-2-Mini

AH-Inkling-2-Mini is a modified (re-quantized) version of
[Inkling 2 Mini](https://huggingface.co/thinkingmachines/Inkling-2-Mini) by Thinking Machines Lab. We changed only the
number format of the weights. We did not train the model and we did not change its behaviour on purpose.

The file is 7.4 GiB (7,947,408,096 bytes). All 3,072 experts fit in the memory of one 8 GB GPU, so the full model
runs on cards such as the GTX 1080 and the RTX 3080 without memory offload.

> **This file runs only in [Kindi](https://amirhusain.com/kindi) 0.7.1 or later.** It uses two Kindi-specific GGUF
> tensor types (116 and 117). llama.cpp, Ollama, LM Studio and other GGUF runtimes cannot load it. For those
> runtimes, use the [Unsloth GGUF files](https://huggingface.co/unsloth/Inkling-2-Mini-GGUF).

Demo videos and the full write-up: [amirhusain.com/inkling](https://amirhusain.com/inkling)

## The model

Inkling 2 Mini is a mixture-of-experts model from Thinking Machines Lab. It has 24 layers. The middle 12 layers run
three times with shared weights, so each token goes through 48 layer applications. Each layer routes every token to 8
of 128 experts. The model has 26.4B parameters in total, and Thinking Machines Lab gives 5.4B effective active
parameters per token. The original model also accepts images. Kindi runs the text part only.

For the model's design, its intended uses, its limitations and the benchmarks of the full-precision model, read the
[original model card](https://huggingface.co/thinkingmachines/Inkling-2-Mini). Those benchmark numbers are for the
original weights, not for this file.

## What we changed

- The expert weights are stored in 2-bit formats (Kindi IQ2_XS_128 for the gate and up projections of the 12 looped
  layers, and Kindi IQ2_XXS_128 for all other experts).
- The attention projections and the output layer are stored in Q4_0. The loop-control weights are stored in Q8_0.
- The chat template, the tokenizer and the sampling values from the original model are kept in the file.
- The source of the conversion was Unsloth's UD-Q4_K_M file from
  [unsloth/Inkling-2-Mini-GGUF](https://huggingface.co/unsloth/Inkling-2-Mini-GGUF). Kindi re-quantized it with an
  importance matrix that Kindi collected from the model on about 1,500 tokens of mixed text.

## Quality

A 2-bit file loses some quality. We measured how much against Unsloth's UD-Q4_K_M file (16.6 GB), with the same
engine (Kindi), on a CPU.

| File | Size | Math (12) | Code (12) | Instructions (8) | Total (32) |
| --- | ---: | ---: | ---: | ---: | ---: |
| UD-Q4_K_M | 16.6 GB | 12 | 11 | 8 | 31 |
| AH-Inkling-2-Mini (IQ2_M) | 7.9 GB | 12 | 11 | 7 | 30 |

The task set has 32 short tasks: arithmetic and word problems (numeric answer), Python functions checked by hidden
tests, and instructions with checkable rules. We used greedy decoding, one turn, the model's chat template with
reasoning effort 0, and a limit of 800 new tokens. The IQ2_M file missed one extra task: it wrote "Rayleigh" with a
capital letter in an answer that had to be all lowercase.

On 1,999 positions of plain text, compared with the Q4 file:

- the most likely next token is the same at 86.8% of positions;
- the mean KL divergence is 0.105 (median 0.037);
- the perplexity is 4.19 (Q4: 3.91), which is 7.2% higher.

This set is small. It shows that the 2-bit file does not collapse. It cannot show a difference of a few points. Use
this file when the model must fit on an 8 GB card. Do not expect the same quality as a 4-bit or 8-bit file.

## Speed

All numbers are from Kindi with this file, with all experts in GPU memory, and greedy decoding.

Benchmark: 512-token prompt, 128 generated tokens, context 2,048 (mean of 3 runs).

| GPU | Prompt (tokens/s) | Generation (tokens/s) |
| --- | ---: | ---: |
| GTX 1080 8 GB | 121.3 | 21.5 |
| RTX 3080 10 GB | 523.2 | 29.4 |

Coding-agent sessions: opencode 1.19.5 with Kindi's OpenAI-compatible server, context 32,768, 8K to 30K tokens in
use (four sessions).

| GPU | Prompt reading (tokens/s) | Generation (tokens/s) |
| --- | ---: | ---: |
| RTX 3080 10 GB | 428 to 453 | 20.3 to 21.2 |

Largest context with all experts in GPU memory: 14,336 tokens on the GTX 1080 (8 GB) and 32,768 tokens on the RTX
3080 (10 GB). The opencode system prompt is about 8,000 tokens.

## Agent demos

We gave opencode one prompt per session and did not help the model. On the RTX 3080, these four prompts passed on
the first attempt. The table shows the recorded runs; for Plant Therapy, that is a second run of the same prompt (the
first run also passed, but the photos that it linked from the web do not load offline).

| Task | Result | Time |
| --- | --- | ---: |
| A car in one HTML file with Three.js | A stylised red coupe with wheels, glass and lights, and orbit controls | 10 min 19 s |
| A floating island in snowy weather | Island with snow-capped trees, a meadow, falling snow and a slowly orbiting camera | 9 min 55 s |
| A space shooter in one HTML file | The game starts, the ship moves and shoots, the score, three lives and the game-over screen work | 6 min 29 s |
| A landing page for a SaaS called Plant Therapy | A complete single-file landing page with no external images and no JavaScript errors | 6 min 3 s |

We also asked for "an entire web based operating system with all the apps". The first result did not start. After
two short follow-up messages in the same session ("It's stuck on the BOOTING screen and I can't click anything...",
"Still can't click any icons or anything inside the windows."), 11 of its 12 apps worked with the mouse. The paint
app cleared its canvas every second.

## Run it

Install Kindi 0.7.1 or later:

```bash
curl -fsSL https://amirhusain.com/kindi/install.sh | bash
```

Download the file, build the Kindi pack and start the server:

```bash
hf download ahtx/AH-Inkling-2-Mini AH-Inkling-2-Mini-IQ2_M.gguf --local-dir ~/.kindi
kindi convert ~/.kindi/AH-Inkling-2-Mini-IQ2_M.gguf
kindi --ctx 14336 serve        # 8 GB card; use --ctx 32768 on a 10 GB card
```

The server speaks the OpenAI chat API on `http://127.0.0.1:8093/v1`, with streaming, tool calls and a separate
reasoning field. For opencode, add a provider like this to `opencode.json`:

```json
{
  "provider": {
    "kindi": {
      "npm": "@ai-sdk/openai-compatible",
      "options": { "baseURL": "http://127.0.0.1:8093/v1", "apiKey": "none" },
      "models": {
        "inkling-2-mini": { "tool_call": true, "reasoning": true, "limit": { "context": 14336, "output": 4096 },
                            "options": { "reasoningEffort": "low" } }
      }
    }
  }
}
```

Sampling: the file carries the values that Thinking Machines Lab recommends (temperature 1.0, top-p 1.0, top-k off,
min-p 0). A request can set other values.

## Limitations

- This is a 2-bit quantization. It makes more mistakes than the original weights (see Quality).
- Kindi runs the text part only. Image input is not supported.
- Thinking Machines Lab lists these limitations for the model: reasoning can repeat itself in loops (set an output
  token limit), agentic tool use is less reliable than in larger models, quality is lower outside English, and the
  model can state wrong facts with confidence.
- The model writes a short thinking block before most answers, also at low reasoning effort. This uses time on long
  tasks.

## Licence and use policy

Inkling 2 Mini is released by Thinking Machines Lab under the
[Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). This repository is a modified version of that
model and is released under the same licence. A copy of the licence is in [LICENSE](LICENSE), and the changes are
listed in [NOTICE](NOTICE).

The Thinking Machines Lab
[Model Acceptable Use Policy](https://thinkingmachines.ai/model-acceptable-use-policy/) applies to the model weights
and to any modified version, which includes this file. If you download or use this file, you must obey that policy.
If you deploy the model in a product, the policy tells you to tell your users that they are talking to an AI.

## Credits

- [Thinking Machines Lab](https://thinkingmachines.ai) made and released Inkling 2 Mini.
- [Unsloth](https://huggingface.co/unsloth) made the GGUF conversion that we re-quantized.
- [Kindi](https://amirhusain.com/kindi) by Amir Husain runs the file.