Inkling 2 Mini on llama.cpp, on trogdor's RTX 5000s: research, sm75 image, test stack (not run)
  • Dockerfile 54.8%
  • Shell 45.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Chris Moriarty 0c24fdb0be Waiting for llama.cpp's fixes (owner, 2026-11-21): what we wait for and the trigger
The test waits for flash attention with the attention bias (#32740).
The other fixes (#32718, #32218, #32752, #32751) join if they land
by then. All five open at 23:05 UTC.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-21 18:16:47 -05:00
scripts Inkling 2 Mini on llama.cpp: research, sm75 image, test stack (not run) 2026-11-21 16:58:36 -05:00
.gitignore Inkling 2 Mini on llama.cpp: research, sm75 image, test stack (not run) 2026-11-21 16:58:36 -05:00
docker-compose.yml Inkling 2 Mini on llama.cpp: research, sm75 image, test stack (not run) 2026-11-21 16:58:36 -05:00
Dockerfile Inkling 2 Mini on llama.cpp: research, sm75 image, test stack (not run) 2026-11-21 16:58:36 -05:00
README.md Waiting for llama.cpp's fixes (owner, 2026-11-21): what we wait for and the trigger 2026-11-21 18:16:47 -05:00

inkling2-mini-llamacpp

Inkling 2 Mini, Thinking Machines' model released on 2026-11-20, served by llama.cpp on trogdor's four Quadro RTX 5000s, measured against Qwen3.8-27B, the production model (stack 126, qwen38-vllm-flashinfer).

vLLM cannot run this model on these cards: it runs the model in BF16, and Turing has no BF16. llama.cpp can. The vLLM route, for the RTX A6000s once they are installed, is in cmoriarty/inkling2-mini-vllm, with the model's description and the benchmark.

Status, 2026-11-21: ready, not run, waiting for llama.cpp's fixes. The owner chose that day to wait until llama.cpp runs this model faster ("Waiting for", below). The test needs all four cards, so it means stopping Qwen for about an hour and a half (the test plan below).

Piece State on 2026-11-21
Research (this page) Done: llama.cpp's code at afe77e1, its issues, and the GGUF files' headers read over HTTP
Dockerfile: llama.cpp build 12624 for sm75 Written. Not built
docker-compose.yml Written. Not deployed
scripts/download-model.sh Written; its file list checked against the Hugging Face API. Not run (23.5 GB)
Benchmark: bench/inkbench.py in the vLLM repo Reads llama-server since 2026-11-21. Tested against a fake llama-server; its vLLM side checked again against production Qwen (function and soak parts, tiny requests, 16:55 New York time)
Results Not run

Waiting for

The owner's decision, 2026-11-21: test when llama.cpp has flash attention for this model's attention bias (#32740). That one change shrinks the attention scratch from gigabytes to megabytes, so prompts can run in bigger, faster steps and two cards get a usable window ("Fit", "Speed"). Test with whichever of the others have landed by then.

Change What it would do here State, 2026-11-21 23:05 UTC
#32740: flash attention with the bias The trigger. It changes the CUDA kernels Turing uses (fattn-mma-f16, fattn-tile, fattn-vec) Open pull request
#32718: each pass's caches on its weights' card 25 % more output speed on two T4s. The maintainers want it after #32740 Open issue
#32218: DSpark speculative decoding Unsloth's build with DSpark reached about 80 t/s on an RTX 5090 Open pull request
#32752: the attention mask built in chunks Less memory for long prompts Open pull request
#32751: -sm tensor for this model Splits each layer across the cards, instead of giving each card whole layers. Untested here Open pull request

When #32740 is merged: set REF and LLAMA_BUILD_NUMBER in Dockerfile to a build that has it, redo "Fit" (the scratch term changes, and -ub and -ts with it), then follow the test plan.

Terms used below. GGUF is llama.cpp's model file format. NVFP4 stores each weight in 4 bits with one 8-bit scale per block of 16 weights; MXFP8 stores 8-bit weights with one scale per block of 32; BF16 is the 16-bit format models are usually trained in. KLD (KL divergence) measures how far one model's next-token probabilities are from another's: 0 means identical.

The file: unsloth's UD-Q8_K_XL is the original checkpoint

Inkling 2 Mini ships with its experts already in 4 and 8 bits: NVFP4 in layers 0-19, MXFP8 in layers 20-23, everything else BF16. The experts were trained that way. So the lesson from Qwen, that 8-bit weights beat 4-bit ones, does not carry over: here the 4-bit experts are the original, and any other number of bits is a copy.

One GGUF keeps them exactly. These are the tensor types in unsloth's Mainline_Support/Inkling-2-Mini-UD-Q8_K_XL, read from the file's header (Hugging Face revision ae9327c, 2026-11-21):

Tensors Type GB
Experts, layers 0-19 NVFP4, with each expert's F32 scale 11.47
Experts, layers 20-23 BF16: the MXFP8 values widened, which loses nothing 8.15
Token embedding and output head BF16 1.85
Attention and the rest BF16, a few small tensors F32 1.36
Expert router F32 0.03
All 26.07 B parameters 22.86

The other GGUFs, by their makers' notes (KLD against the BF16 file, wikitext-2):

File GB Experts of layers 0-19 KLD
unsloth UD-Q8_K_XL (this stack) 22.9 NVFP4, as shipped 0: the same numbers as the BF16 file. Unsloth's reference for their other files
ggml-org BF16 52.2 Widened to BF16 0: the reference
ggml-org Q8_0 27.8 Re-made in Q8_0 from the BF16 0.0030; 97.6 % same top token
ggml-org IQ4_NL 17.6 Re-made in IQ4_NL 0.0095; 95.5 % same top token

Unsloth names the files in Mainline_Support .gguf_file, so that tools listing the repo skip them, and scripts/download-model.sh saves the file as .gguf. The files at the top of their repo use unsloth's own layout and need unsloth's build of llama.cpp. The vision tower is mmproj-F16.gguf, which Turing computes natively.

Which llama.cpp

llama.cpp added Inkling 2 on 2026-11-14 (#32217) and Inkling 2 Mini's looped layout on 2026-11-20 (#32694). Fixes kept landing on 2026-11-21, so Dockerfile builds master at afe77e1 (build 12624), which has them all: the scales of the loop's 2nd and 3rd passes (#32704, without which unsloth's files give perplexity 130 instead of 7.65), correctness fixes (#32669) and reasoning_effort: "none" (#32763). The newest release tag was b12614 at 22:00 UTC that day. The recipe is the one in qwen38-flash-next: CUDA 13, sm75 only, built on trogdor, never pushed.

On cards without BF16, llama.cpp computes BF16 weights in F32 and the NVFP4 experts with 8-bit integer kernels. Nothing in its CUDA code for this model needs a newer card (read in ggml-cuda/mmq.cu and ggml-cuda.cu).

Fit on trogdor

llama.cpp gives this model 48 layer slots. Slots 0-23 are the real layers. Slots 24-47 are the loop's 2nd and 3rd passes over layers 6-17: they use those layers' weights and hold only their own caches. A layer split (-sm layer) deals the slots, and the output head after them, to the cards in order. So the weights sit wherever slots 0-23 land, and an even split would put 22 GB of weights on two cards.

Three things take memory on a card:

  • Weights: 0.63 GB per layer for layers 0-19, 2.09 GB for layers 20-23, 0.93 GB for the output head, 0.64 GB for the vision tower.
  • KV cache: 32 KiB per token of window, in 8 full-attention slots; 8 GiB for 262,144 tokens. The 40 sliding-window slots keep 1,024 tokens per sequence: about 1 GB for 6 sequences.
  • Attention scratch: the largest. llama.cpp cannot use flash attention for this model yet, because of its relative-position bias (#32740, open). So each card holding a full-attention layer sets aside, at start, room to write out the scores of one prompt step: about 2.5 x window x step size (-ub) x 24 heads x 4 bytes. That is 4 GB at 262,144 tokens and -ub 64.

Estimates from the file's header and llama.cpp's code; the first start logs the real buffer sizes:

Cards Window -ub -ts Fullest card (of 16 GB)
4 262,144 64 8,10,5,26 (the stack's default) 13.4 GB
4 131,072 192 9,9,5,26 13.5 GB
4, even split 262,144 64 1,1,1,1 19.7 GB: does not fit
2 (Lane T, after the upgrade) 65,536 64 18,31 14.6 GB
2 32,768 256 17,32 15.1 GB

So it fits on four cards with the full 262,144 window. On two cards it fits only with a short window, until llama.cpp gets flash attention for this model. Then the scratch shrinks to a few hundred MB and two cards should hold about 150,000 tokens (estimate).

Speed: expect it to be slower than Qwen, for now

llama.cpp's support is days old, and reports from other people, 2026-11-20 and 21, are slow:

Hardware llama.cpp File Prompt t/s Output t/s Source
2 x Tesla T4 (Turing, the same chip family as the RTX 5000) about b12603 UD-Q4_K_XL 172 (2,048 tokens, -ub 64) 19.7; 25.9 with each pass's state on its weights' card #32718
RX 9070 XT (Vulkan) b12600 IQ3_XXS about 400 about 21 #32707
Not named b12600 IQ4_NL about 30, against 60 for Qwen3.8-27B Q4_K_M #32707
RTX 5090 unsloth's build, with DSpark UD-Q4_K_XL about 2,000 about 80 #32707

On the RX 9070 XT, the same reporter found a dense Qwen3.8-27B faster at output and 2.3 to 2.7 times faster at prompts.

Why it is slow:

  1. No flash attention for this model. Every prompt step writes the full score matrix in F32 and reads it back several times (#32740, open).
  2. Thousands of small GPU kernels per token (#32707).
  3. On several cards, the loop's 2nd and 3rd passes keep their caches on a different card from their weights (#32718). It cost 25 % of output speed on the two T4s, and no flag avoids it.
  4. No speculative decoding. DSpark is not in mainline llama.cpp yet (#32218, open).

An estimate for trogdor, four cards: one stream's output at 20 to 30 t/s, and prompts at a few hundred t/s. Qwen did 71 to 82 t/s and about 1,600 t/s on 2026-11-20. Each token reads about 5.6 GB of weights: 2.5 GB of attention weights re-read at each of the 48 layer visits, 2.1 GB of experts, 0.93 GB for the output head. At the cards' 448 GB/s that sets a ceiling of about 80 t/s.

The fixes for these are listed under "Waiting for". Two forks claim large gains already (unsloth's build with DSpark; realugbun's, "4x faster prefill at 64K"). This stack uses neither.

Fidelity on these cards

  • Weights: exact.
  • NVFP4 experts: llama.cpp rounds their inputs to 8 bits per block of 32 before multiplying, as for every quantized type it runs. On vLLM those inputs stay BF16. In training they were quantized too.
  • BF16 weights (attention, the experts of layers 20-23, the output head): computed in F32.
  • Attention: scores in F32; K and V kept in F16, which holds more digits than BF16.

So the arithmetic is finer than the BF16 reference in some places and coarser in one. The measure: KLD against ggml-org's BF16 file, with llama-perplexity --kl-divergence on wikitext-2, ggml-org's own yardstick (their Q8_0 scored 0.0030). The BF16 file, 52.2 GB, fits across the four cards at a 512-token window. The image includes llama-perplexity. Not run.

Known problems in build 12624

Open on 2026-11-21 unless marked.

Issue What Here
#32710, #32755 Experts of the loop's layers on the CPU give NaN or repeated letters Every expert stays on the cards
#32718 Each pass's caches on another card than its weights Slower; nothing to set
#32707 Slow prompts, and a crash on an RTX 5090 See Speed
#32744 The CPU expert cache holds the loop layers' experts three times Not used: no experts on the CPU
#32739 -sm tensor refused for this model Layer split only. #32751 would add it
#32745, #32753 Empty answers with a raw grammar; reasoning_effort: "none" ignored Both closed by #32763, which is in build 12624

Test plan

For when #32740 has landed ("Waiting for"). Every step that changes trogdor waits for the owner's yes. Nothing below has been done.

  1. Build the image on trogdor, from this repo: about 20 to 30 minutes at low priority. Qwen keeps running.
  2. Download 23.5 GB into /mnt/models/Inkling-2-Mini-GGUF with scripts/download-model.sh, which checks every file's sha256. Qwen keeps running.
  3. Test window, about an hour and a half without Qwen:
    1. Stop stack 126 (Qwen).
    2. Deploy this stack as a Portainer git stack, PullImage off.
    3. Wait for /health; read the buffer sizes per card from the log.
    4. Run the benchmark: tiny requests first (--size smoke), then the full run. The two long needles are most of the time: at -ub 64, probably 10 to 20 minutes each.
    5. Save the engine log; stop this stack; start Qwen and check that it answers.
  4. Record the results here and on trogdor's page in the homelab repo.

The benchmark, run on trogdor, then the engine log added from a saved copy:

python3 inkbench.py run --url http://localhost:8002 --profile inkling2 --label inkling-llamacpp-b12624 --vram --out results
python3 inkbench.py log results/inkling-llamacpp-b12624.json engine.log
python3 inkbench.py compare results/inkling-llamacpp-b12624.json

The comparison's Qwen column is the live check of 2026-11-20. Its speed rows came from different scripts, so the fair speed comparison is a Qwen run through inkbench.py on the same day (vLLM repo, "The benchmark").

Results

Not run.

Sources (read 2026-11-21)

  • llama.cpp pull requests #32217, #32694, #32704, #32669, #32763, #32740, #32752, #32751, #32218
  • llama.cpp issues #32707, #32710, #32718, #32739, #32744, #32745, #32753, #32755
  • llama.cpp source at afe77e1: src/models/inkling2.cpp, src/models/inkling2-loop.cpp, src/llama-graph.cpp (flash attention is skipped when there is a bias), src/llama-model.cpp (layer split), ggml/src/ggml-cuda/mmq.cu and ggml-cuda.cu (NVFP4 and BF16 on Turing)
  • unsloth/Inkling-2-Mini-GGUF, its Mainline_Support/README.md and the header of Mainline_Support/Inkling-2-Mini-UD-Q8_K_XL.gguf_file, revision ae9327c
  • ggml-org/Inkling-2-Mini-GGUF, model card, revision e8a2cec
  • trogdor: nvidia-smi and nvidia-smi topo -m as the agent, 2026-11-21 21:42 UTC (cards 0 and 1 are an NVLink pair on CPU socket 0, cards 2 and 3 on socket 1; Qwen used 14.8 GB of each card and was idle)