The order of layer passes for one token of Inkling 2 Mini. Layers 6–17 run three times; the faded passes reuse the first pass's weights.
Thinking Machines released Inkling 2 Mini with a note that EXO Labs had it decoding at 210 tokens per second on a fleet of Macs. We have two RTX 3090s in a closet and wanted to know how close a single one could get. The answer is all the way to 200, if you accept 2-bit experts and a short context. With near-exact 4-bit weights it reaches 177 in the benchmark. Long contexts were the hard part; after a tensor-core rewrite of the attention scan, the 2-bit model holds 182 tok/s at 16K and 169 at 32K. Then we found we had the ceiling wrong: the 2-bit model can go much faster than 216. Further phases made speculative decoding pay: 351 tok/s on short code edits and 278–331 on 3,000-token replies (331 on a multi-turn agent replay), with output identical to plain decoding. Plain decode reached 241.
A flight simulator built by Inkling 2 Mini (2-bit experts) on one RTX 3090, through OpenCode with a one-line system prompt, fully local. It took two prompts: build it, then make the plane glide along the ground instead of crashing. That session averaged 244 tok/s over 137K generated tokens. The game is the model's code. Only the packaging changed: its single-file bundle pasted in two copies of three.js and would not run, so three.js now loads as a module next to it (the file as generated). The video is the same session: the prompt typed, the build at 8× (46 s in real time at 244.5 tok/s, as OpenCode reports), a first flight that ends in a crash, the follow-up, the rebuild at 15×, then the gliding version. The timer shows real time, with about three minutes of idle time between rounds cut.
This post walks through that map. It covers the model's unusual shape, why decoding is a memory problem and not a math problem, how a stock runtime spent most of its time on bookkeeping, what we fused, why speculative decoding stopped helping, how 2-bit experts crossed 200, why it doesn't feel like 200 in a coding agent, what the peer-to-peer driver patch from the tinygrad community changes for a two-GPU split, and how a corrected ceiling sent us back to speculative decoding, which now pays. Every number was measured on this machine. The appendix has a dev log and a repository you can point an agent at to reproduce it.
Results at a glance
Every build we measured, on one RTX 3090 (GPU1, the card's default 420 W power limit, driver 580, CUDA 12.8). Decode is llama-bench tg128 at the given context depth. "Served" is llama-server over HTTP, averaged over three 700-token replies at T=0. Perplexity is on a fixed 8×2048-token text for prefill, and on 2×1024 tokens fed one at a time for decode, which exercises the fused single-token kernels. Dashes are not yet measured. The methodology has exact commands.
| Build · weights | Decode, 0 | 4K | 16K | 32K | Served, short | Prefill 4K | PPL prefill | PPL decode |
|---|---|---|---|---|---|---|---|---|
| Stock llama.cpp · IQ4_NL | 62.2 | – | – | – | 58 | – | 2.9401 | 4.0660 |
| Phase 1 · IQ4_NL | 124.1 | – | – | – | 115.7 | – | 2.9412 | 4.0659 |
| Phase 2 · IQ4_NL (exact) | 140.7 | – | – | – | 128.2 | – | 2.9412 | 4.0674 |
| Phase 4 · Q6_K dense (released) | 159.3 | – | – | – | 152.4 | – | 2.9404 | 4.0640 |
| Phase 4 · IQ4_NL dense | 170.2 | 146.8 | 132.4 | 118.6 | 167.6 | 2,255 | 2.9458 | 4.0990 |
| Phase 4 · calibrated 2-bit experts | 209.5 | 168.7 | 148.9 | 131.2 | 202.2 | 2,184 | 3.0530 | 4.1945 |
| Phase 5 · IQ4_NL dense | 176.8 | 166.1 | 157.3 | 146.9 | – | 3,230 | 2.9471 | 4.0688 |
| Phase 5 · calibrated 2-bit experts (released) | 210.3 | 194.9 | 182.5 | 168.7 | 206.3 | 3,018 | 3.0530 | 4.2036 |
| Phase 6 · calibrated 2-bit experts, plain decode | 221.4 | 202.6 | 190.4 | 176.0 | – | – | 3.0530 | 4.1979 |
| Phase 7 · calibrated 2-bit experts, plain decode | 238.7 | 217.7 | 204.5 | 189.0 | – | – | 3.0530 | 4.1979 |
| Phase 9 · calibrated 2-bit experts, plain decode (live) | 241.2 | 221.2 | 207.3 | 191.4 | – | 3,463 | 3.0530 | 4.1979 |
With speculative decoding (DSpark, phases six and seven), the same 2-bit model serves 225–351 tok/s on short replies and 278–331 on 3,000-token replies, with output identical to plain decoding (final numbers).
Served at long context, 2-bit model, one 500-token reply after a real prompt (perf/longctx.py):
| Build | 16K prompt: time to first token | decode | 32K prompt: time to first token | decode |
|---|---|---|---|---|
| Phase 4 | 8.46 s | 147.9 tok/s | 17.87 s | 131.1 tok/s |
| Phase 5 | 6.29 s | 179.3 tok/s | 13.48 s | 166.1 tok/s |
Decode columns are llama-bench tg128 at that context depth (±0.3–4.4 sd). The phase 5 2-bit served and long-context rows, and the phase 4 2-bit speed and perplexity, were re-measured independently (audit). Everything else is from the lab notebook, perf/RESULTS.md.
A model that runs its middle three times
Inkling 2 Mini has 26.4 billion parameters, but only a fraction touch any given token. It is a mixture-of-experts model. Each feed-forward layer holds 128 experts and a router picks 8 of them per token, which keeps the active parameter count near 3.4 billion.
The unusual part is the loop. The model has 24 physical layers, and layers 6 through 17 form a core that runs three times for every token. So a token passes through 48 layers of compute while the file only stores 24 layers of weights. Thinking Machines counts this as 5.4 billion effective active parameters.
Several mechanisms sit around that loop that you won't find in a standard transformer. Each one turned out to matter for speed:
- Attention residuals. Instead of a plain
x + f(x)residual, each layer blends the outputs of earlier blocks using a learned query and a softmax, after normalizing each one. - Loop controllers. On passes 2 and 3, the q, k, v and FFN inputs are blended with a message from the previous pass through low-rank gain and forget gates:
y = cur − tanh(f)·cur + tanh(g)·msg. - Short convolutions over the last four tokens on keys, values and the residual stream, each with its own recurrent state.
- Relative position bias with attention sinks, plus L2 clipping of queries and relative features.
None of these are expensive in arithmetic. All of them are expensive in coordination, because each one is a small step that has to finish before the next one starts.
Why not the official path
The released checkpoint stores its experts in NVFP4, NVIDIA's 4-bit float format, with the last four layers in MXFP8. The vLLM and SGLang recipes target Hopper and Blackwell GPUs, which have FP4 and FP8 tensor cores. The 3090 is Ampere and has neither. So we ran the model through llama.cpp using ggml-org's GGUF conversion. The NVFP4 experts become IQ4_NL1, and the MXFP8 experts and the attention projections become Q8_0.1IQ4_NL stores 4.5 bits per weight: 4-bit indices into a fixed non-linear table, plus one scale per 32 weights. It and the K-quants used later (Q2_K, Q3_K, Q6_K) come from ikawrakow's quantization work in llama.cpp (#1684), and the importance matrices from #4861. Support for this architecture landed in llama.cpp the day we started (#32694).
Decoding is a memory problem
Generating one token for one user means multiplying each needed weight matrix by a single vector. Each weight is read from VRAM once and used for two floating-point operations. The GPU's arithmetic units sit almost idle; the speed limit is how fast weights move from memory into the chip. So the first question is how many bytes one token needs.
We read every tensor out of the GGUF file and added up what a single token touches. That is 8 of 128 experts per layer pass, every dense weight on every pass (three times for the looped core), and the full output head, because predicting the next token means scoring all 201,024 vocabulary entries.
A 3090 is rated at 936 GB/s. We measured 891 GB/s for a large sequential read2. Dividing bytes by bandwidth gives the floor:2Small reads are slower: 737 GB/s for a 2 MB read and 711 GB/s for 8 MB, because every kernel has a ramp-up and a tail. Many of this model's matrices are in that range.
That is the ceiling for one 3090 with these exact weights, and no kernel trick moves it. Only three things can: reading fewer bytes (lighter quantization), reading the same bytes for several tokens at once (speculative decoding or batching), or splitting the bytes across two GPUs.
The first profile
Stock llama.cpp ran the model at 62 tokens per second in its benchmark tool and 58 through the server.33CUDA graphs were already on, so this is not CPU launch overhead. Each tiny kernel still costs about a microsecond on the GPU: it starts, reads its inputs from VRAM, writes its result back, and lets the next one start. llama.cpp's CUDA graph support is described in NVIDIA's write-up. That is 16.5 ms per token, more than three times the floor. The profiler showed why.
Each token launched about 7,200 GPU kernels. The compute graph had 7,764 nodes per token: 977 matrix multiplies, 872 additions, 858 multiplications, 629 scalings, 548 concatenations, 514 RMS norms, 289 tanh calls, and so on. The matrix-vector products that actually stream weights took 5.4 ms. More than 6,000 tiny element-wise kernels took 8.9 ms.
Phase one: operators of its own
The fix for thousands of tiny dependent steps is fusion: compute several steps in one kernel and keep the intermediate values in registers and shared memory, instead of writing them to VRAM and reading them back.
We added ggml operators for the model's mechanisms. Each one has a CPU reference implementation, a CUDA kernel, and cases in llama.cpp's test-backend-ops suite that check the CUDA version against the reference:
RES_MIXis the attention-residual mix. It normalizes up to nine earlier states and blends them with a softmax in one pass.SHORTCONV_REScovers the short convolution, its residual add, and the store of its recurrent state, including the rollback slots speculative decoding needs.LOOP_CTRL_DOWNandLOOP_CTRL_APPLYare the loop controllers, batched across q, k and v.- Smaller fused ops:
REL_BIAS,L2_CLIP,MOE_SUM, and two gated activations (SITU,SIGLU).
Here is the whole loop-controller update as one kernel. Before, it was a matrix multiply, two tanh calls, three multiplies, an add and a subtract, each its own launch:
// loop_ctrl_apply: y = cur - tanh(wf^T d)*cur + tanh(wg^T d)*msg, one warp per output element
float sg = 0.0f, sf = 0.0f;
for (int k = lane; k < rank; k += WARP_SIZE) {
const float dk = dv[k];
sg += ik_w(g, k)*dk; // gain gate dot product
sf += ik_w(f, k)*dk; // forget gate dot product
}
sg = warp_reduce_sum(sg);
sf = warp_reduce_sum(sf);
if (lane == 0) {
const float gain = tanhf(sg), forget = tanhf(sf);
dst[...] = (c - forget*c) + gain*m;
}
ggml/src/ggml-cuda/inkling.cu · 7889cdf
We also changed the weight layout at load time. Each layer's attention input had seven separate projection matrices (query, relative features, sink, gate, key, value, and a conv projection). They are concatenated into one quantized matrix when the model loads, so one matrix-vector product replaces seven. The original tensors become views into the combined one, so no VRAM is duplicated (a1803a1).
Phase one ended at 124 tokens per second, double the start, with 1,614 launches per token.
Phase two: one launch per job
The second phase went after whole sub-blocks. The single-token attention block had been eleven kernels and became one. It covers the key and value convolutions, their normalizations and cache writes, the query clipping, the relative bias, the softmax with the sink, and the output gate. It runs as 8 key-value heads times 8 cache splits, and the last block to finish combines the partial results, the split-K scheme of Flash-Decoding.
The router got the same treatment. The FFN residual mix, its norm, the router logits, the sigmoid and top-k selection, and the weight normalization now run in one launch. That launch also writes the selected expert ids and the 8-bit activation the expert matmul reads next:
cur = ggml_inkling_router(ctx0, query, states.data(), (int) states.size(), ffn_consts,
layer.ffn_gate_inp, route, x_q8, 1e-6f, 1.0f/sqrtf(n_embd), hparams.f_norm_rms_eps,
n_expert_used, hparams.expert_weights_scale, hparams.expert_weights_norm_eps);
// the op writes route and x_q8 as side outputs: it must be in the graph even when
// its F32 result is not consumed
ggml_build_forward_expand(gf, cur);
src/models/inkling2.cpp · 97201b2
A layer pass went from 34 launches to 13 or 14. Phase two ended at 140.7 tokens per second with exact weights and 654 launches per token.
Why speculative decoding stopped helping
Inkling 2 Mini ships with a small drafter called DSpark. It guesses the next few tokens cheaply, and the full model checks several of them in one step. This is speculative decoding (Leviathan et al., 2023; Chen et al., 2023). For a dense model this is close to free speed, because checking four tokens reads the weights once instead of four times.
On the stock runtime DSpark helped, taking us from 58 to 66 tokens per second. After the fusion work it made things slower: 96 tokens per second against 116 without it. The reason is the experts. Each token in a verification batch picks its own 8 of 128 experts, so verifying n tokens reads close to n times the expert bytes. Only the dense weights and the head, 55% of the bytes, are shared.
We measured acceptance at 45–57% on chat prompts, so in our implementation speculative decoding is worth a few percent at best and the single-token path is where the time is. That conclusion assumes each drafted token reads its experts separately. maya-inkling-mini, a standalone engine for this model, groups the drafted tokens' expert picks so each expert is read once per window and runs the window as one CUDA graph. It reports 150–210 tok/s on code and edits that way, which makes grouped verification our next experiment. Phase six is that experiment: it pays.
Reading fewer bytes
The ceiling only moves if a token reads fewer bytes. We tried two changes, shipped each as an opt-in variant, and judged them only by quality:
| Variant | tok/s | Perplexity | Saved per token |
|---|---|---|---|
| Exact published weights | 140.7 | 2.9412 | – |
| F16 loop controllers (were F32) | 141.9 | 2.9380 | ~170 MB |
| Dense projections and head, Q8_0 → Q6_K | 145.6 | 2.9402 | ~470 MB |
| Both (deployed) | 149.3 | 2.9407 | ~640 MB |
All four perplexities are within the measurement's standard error (0.064) of each other. The experts and token embeddings stay exactly as published. Our server runs the combined variant, which serves at 136 tokens per second over the network.
Keeping it honest
Making it fast and wrong is easy. Every accepted change had to pass four checks:
- Operator tests. Every new CUDA kernel is compared against its CPU reference in
test-backend-ops, for example 2,696 of 2,696 matrix-multiply cases. - Perplexity on a fixed text, within 0.5% of the unfused reference (2.9401).
- Decode-path perplexity. The normal perplexity tool processes prompts in batches, which takes different code paths than one-token decoding. So we also measure it one token at a time, where the fused kernels actually run.
- Greedy generations compared with the original. They match for hundreds of characters and then sometimes diverge, always at a near-tie.44At every divergence we checked, the top two next tokens were within 0.1 log-probability. A different order of floating-point additions flips the tie, and the expert routing amplifies it from there.
Every fused path also has an environment switch (LLAMA_INKLING_FUSED=0 and friends) that restores the original graph and reproduces the stock output exactly. That switch is how we traced each divergence to rounding and ruled out a bug.
The last 2.4 milliseconds
At 140 tokens per second a token takes about 7.1 ms. Weight streaming now runs at roughly 790 GB/s, 88% of the measured peak, so that part is nearly done:
| Part | ms / token | Note |
|---|---|---|
| Expert matvecs | 2.34 | 1,847 MB at ~790 GB/s |
| Attention projection matvecs | 1.26 | 1,370 MB at ~800 GB/s |
| Output head | 0.56 | 492 MB at 883 GB/s |
| Attention output matvecs | 0.54 | small matrices, more ramp and tail |
| Fused attention kernel | 0.63 | 13 µs × 48 passes |
| Fused router kernel | 0.54 | 11 µs × 48 passes |
| Loop controllers | 0.55 | 24 looped passes |
| Mixes, norms, conv + residual, activations | 0.68 | single-block, latency-bound |
| Gaps between kernels | 0.25 | inside the CUDA graph |
The remaining glue is about 2.4 ms, or 50 µs per layer pass. Its first-principles cost is closer to 10–15 µs per pass. The router reads 1.2 MB of weights, about 1.5 µs of bandwidth. Short-context attention over 8 heads takes a few microseconds. The norms and mixes on a 2,304-number vector are nearly free in bandwidth. What they cost is the chain of dependent round trips through memory, 3 to 8 per kernel at about 0.7 µs each.
The megakernel
The third phase aimed at that chain. The idea comes from Hazy Research's Llama megakernel: keep each layer pass's glue on the chip, with no launch boundaries between dependent steps, and let the other streaming multiprocessors stream weights for work whose inputs are already known. Ampere shapes the design. The 3090 lacks programmatic dependent launch, so coordination needs cooperative-groups grid barriers or device-side flags, and a grid barrier across 82 streaming multiprocessors costs 1.5–3 µs, no cheaper than a kernel boundary.
A projection megakernel that fused the MoE epilogue, the attention-input mix and norm, and the projection matvec was built and tested correct. It didn't beat the separate kernels, so it stays behind a switch. The gains came from rewriting the two biggest glue kernels. The router went from 11.8 to about 8 µs per pass, with one load round trip using cp.async. Attention went from 12.5 to 10.7 µs, with its independent loads issued first. A four-row Q6_K matvec rounded it out, and the Q6_K variant reached 155 tok/s.
A bug, then two-bit experts
The third phase stopped at a usage limit. A Codex session (GPT-6.2 Astra at high reasoning effort) picked up the same repository and gates, and the first thing it found was a correctness bug the earlier phases had missed.
llama.cpp rotates the 8-bit KV cache with a Hadamard transform before quantizing it, which spreads outliers so quantization loses less (the idea behind QuaRot). Batched prefill wrote the rotated cache, but our fused single-token attention read it as unrotated. Short prompts hid this, because their first token comes from prefill and was correct. An 827-token prompt exposed it: the second generated token could be unrelated to the prompt. The fix keeps prefill and decode in one basis, and a new regression probe checks that 12 generated tokens match the reference attention.55The same pass found a second bug: the CUDA residual mix treated a ninth earlier state as the normalization weight. Both are now covered by tests that failed before the fixes.
Then came more speed. Cross-pass message queries were batched, and the attention projections skip columns a pass never reads. The residual mixes were specialized for each state count. With near-exact weights, that reached:
| Weights | tok/s, empty context | at 1K | Served | Prefill PPL | Decode PPL |
|---|---|---|---|---|---|
| Q6_K dense, F16 controllers | 159.3 | 150.3 | 152.4 | 2.9404 | 4.0640 |
| IQ4_NL dense, F16 controllers | 174.2 | 163.9 | 167.6 | 2.9458 | 4.0990 |
The last step to 200 was bytes again. Experts are 45% of what a token reads, so the session quantized the experts of layers 0–19 to two bits: Q2_K for gate and up, and Q2_0 for down. The stock Q2_0 encoder takes the largest weight in each block as its scale and ignores the importance matrix. The session rewrote it to fit the scale and all four levels against the importance weights. That cut the perplexity cost of the 2-bit model by more than half (prefill 3.3624 → 3.0516) at the same size and speed.
| Experts, layers 0–19 | tok/s, empty context | Served | Prefill PPL | Decode PPL |
|---|---|---|---|---|
| Q3_K / IQ4_NL | 180.0 | 171.5 | 2.9553 | 4.0754 |
| Q2_K / stock Q2_0 | 207.2 | 200.2 | 3.3624 | – |
| Q2_K / calibrated Q2_0 | 206.6 | 202.0 | 3.0516 | 4.2080 |
That is 200 tok/s on one 3090, at about 3.5–4% higher perplexity than the published 4-bit conversion. That is well past the 0.5% bar we held every exact change to, so it ships as its own model, clearly labeled: arelius/Inkling-2-Mini-Q2-3090-GGUF on Hugging Face. The 4-bit builds stay the default for quality. The same session also made tool calling work end to end with the OpenCode coding agent, and converted AtomicChat's uncensored build to the same 2-bit layout (arelius/Inkling-2-Mini-Uncensored-Q2-3090-GGUF, same speed, prefill perplexity 3.0571).
Checking the claim
We re-measured independently on the same GPU. The file's SHA-256 matched the notebook. llama-bench gave 208.7 tok/s at an empty context and 193.2 at 1K. The server gave 202.2 tok/s at T=0 and 201.2 at T=0.7 over 700-token replies. Perplexity was 3.0530 (prefill) and 4.1945 (decode). Every figure matched the notebook within noise.
Why it doesn't feel like 200
Then the person using it said it didn't feel that fast, and they were right. The server logs every request, so we grouped 131 real requests from coding-agent sessions by how full the context was:
| Context in use | Requests | Decode tok/s | Including prompt processing |
|---|---|---|---|
| under 4K | 21 | 196.5 | 184 |
| 4K–16K | 16 | 151 | 97 |
| 16K–24K | 26 | 141 | 93 |
| 24K–32K | 23 | 132 | 123 |
| 32K–48K | 44 | 123 | 110 |
The benchmark is a short prompt. A coding agent's tool prompt alone is about 17K tokens, and every token after it pays for attention over everything before it. Eight of the 48 layer visits attend over the full prefix, reading about 16 KB of cache per token of context6. At 32K that is roughly 0.5 GB per generated token on top of the weights. So the weight-streaming work that got us to 200 matters less than the attention cache once the context is long. That is where phase five went next.6This figure comes from maya-inkling-mini's analysis of the model. That engine's attention reads an FP8 cache at up to 846 GB/s and holds 104 tok/s at a 64K prefix.
Phase five: long context
The real-session table set the target, so the fifth phase started by measuring decode at depth. From 16K to 32K of context, a token got 0.91 ms slower while reading 285 MB more cache. That works out to 313 GB/s, a third of what the card can do. So the attention scan was not waiting on memory. It was bound by its own arithmetic: every lane ran warp shuffles and an exponential for every cache cell.
The fix moves the scan onto tensor cores. Query-key products and the weighted sum over values run as mma.sync instructions fed straight from the 8-bit cache. The int8 values convert to FP16 exactly in registers, and accumulation stays in FP32 with an online softmax (Milakov and Gimelshein; FlashAttention; FlashAttention-2). The scan's structure, its MMA wrapper and the integer-to-FP16 bit trick are adapted from maya-inkling-mini's decode kernel, under its MIT license; the notice is in the repo. The cache format didn't change, so the prefill/decode basis bug from phase four can't come back, and the math matches the old kernel up to summation order. The 16K→32K step now costs 0.53 ms, which is 535 GB/s.77The query and the softmax weights each enter the tensor cores as two FP16 limbs, a value plus its rounding remainder (Dekker, 1971), so the products keep close to FP32 precision.
The second win was prefill. A trace of a 4,096-token prompt showed the loop controllers taking 35% of the time, because they were written for one token at a time. Above eight tokens they now run as cuBLAS GEMMs, and prefill went from about 2,200 to about 3,000 tok/s. The 16K-token coding-agent prompt now takes 6.3 s instead of 8.5 s before the first token appears.
Several ideas didn't help, and they're worth recording:
- Prefetching the next step's loads made no difference.
- Two blocks per streaming multiprocessor spilled registers and was 1.5% slower.
- A standalone scan kernel with small blocks reached 151–165 tok/s at 32K, against 169 for the fused one.
- Sharing cache lines across key-value heads didn't help.
- A shared-memory tile fed by 16-byte loads dropped to 158.
Quality held. Decode perplexity was 4.2036 against 4.2080 with the new scan off. The 827-token regression probe matched the reference attention, and the greedy probes diverged only at near-ties (top-two margins of 0.03–0.04).
Speculative decoding, measured again
With DSpark on the existing verify path, speculative decoding is still slower than plain decoding, even when the drafter is right 93% of the time:
| Prompt | Plain tok/s | DSpark, up to 3 drafts | Accepted |
|---|---|---|---|
| New code | 208.8 | 128.2 | 47% |
| Edit of given code | 197.3 | 191.2 | 93% |
| Prose | 207.4 | 107.5 | 33% |
| Edit at 16K context | 179.2 | 136.6 | 75% |
A trace explains it. A four-token verify step takes 17 ms: 4.8 ms of expert matvecs, 4.0 ms of dense matvecs including the drafter, and about 8 ms of glue that runs unfused because every fused operator we wrote handles one token. A plain token takes 4.8 ms. Grouping expert reads, as maya-inkling-mini does, would save about 2 ms, but a window has to come in under about 9 ms to pay on code. Getting there means multi-token versions of every fused decode operator. That is the open item for the next round, and phase six did it.
Phase six: the ceiling we got wrong
We treated 216 tok/s as the wall for most of this post. That is right for the exact weights, 4.12 GB per token, and wrong for the 2-bit model we serve. Summing the 2-bit GGUF's tensors the same way, with experts at 8 of 128 and the core layers counted three times, gives 2.42 GB per token: 1,135 MB of dense weights, 1,019 MB of experts and 261 MB of output head. At 891 GB/s that is 2.7 ms per token, a ceiling of about 369 tok/s. At 209 tok/s we were using 57% of the card's bandwidth. We caught it while reading two engines for this exact model on an RTX 5090, basalt and ingine, and the ceiling arithmetic in sybil-solutions/inference-optimisation-skill.
A profile of the 2-bit build splits a 4.97 ms token into 1.53 ms of dense weight streaming (about 910 GB/s, at the floor), 1.31 ms of expert streaming (about 780 GB/s), 0.54 ms of attention latency, 1.29 ms of glue and 0.3 ms of idle GPU. The weights already stream at full speed. The other two milliseconds are where the time is.
Plain decode: a little more, then a wall
Codex worked on the single-token path. Three changes held up: the expert down projection computes two output rows per warp, the short-context attention skips fully masked tiles, and the router picks its top 8 with warp shuffles. That took plain decode from 207 to 215 tok/s on one card, and to 221 in the merged build. A diagnostic then showed the limit. Replacing all 193 quantized matvecs with plain streaming reads changed nothing, while removing the reads as well gave 450 tok/s. The dependent glue runs after the weight streaming instead of alongside it, so with this graph structure plain decode tops out near 243 tok/s. A cooperative kernel that replaced the three expert launches per visit came out slower (35.0 against 33.2 µs).
Speculative decoding, third try
Both 5090 engines run plain decode at a similar fraction of their ceiling and get 1.6–1.9× from the same DSpark drafter. The difference from our phase-five attempt is the verify step: every kernel takes a window of one to eight tokens for about the cost of one. We rebuilt ours that way in four rounds.
- Exact windows. Every fused single-token operator got a multi-row version whose per-row arithmetic is the single-token kernel's, so verifying a window is bit-identical to decoding its tokens one at a time. The conv state keeps rollback planes for rejected drafts.
- Experts. Reading each shared expert once per window was slower than one warp per (token, expert) pair, because our dp4a expert kernel is compute-bound, not byte-bound. Following ingine's kernels, the Q2_0 experts moved to tensor cores (
mma.syncint8) with the window's tokens as matrix columns, and the Q2_K experts to CUDA-core tiles that share each expert across rows. Single tokens use the same kernels, so windows stay exact. Dense IQ4_NL weights are now decoded once per window. A 4-token window went from 15.4 to about 9.7 ms. - Drafter. The draft head scores a shortlist of the 32,768 most frequent tokens (ingine's idea) through the target head folded with the drafter's output projection (basalt's idea), and picks drafts on the GPU. The drafter went from 1.66 to 0.83 ms per round, and the 3.2 MB logits readback is gone. The target still verifies against the full 201K vocabulary.
- Policy. The server learns what each window size costs and how often drafts at each confidence are accepted, and drafts only when that pays.
A verify round on the short edit prompt went from 13.1 to 11.6 ms for about 3.8 accepted tokens.
Keeping it exact
Greedy speculative decoding must not change the output, so every configuration is compared against a plain server with the same flags. Our first three checks passed for a bad reason. The probe saved message.content, but Inkling reasons first and puts those tokens in reasoning_content, so we were comparing empty strings. With the full message, 384-token replies matched, but a 3,000-token edit reply diverged after about 1,100 tokens. Codex found two bugs, both in the sliding-window attention cache, a 1,024-cell ring:
- After the ring wraps, a verify row computed its cache extent from the visible cells and dropped an occupied, fully masked tail. In a replayed trace 163 of 1,699 rows differed.
- A rollback across the end of the ring resumed at the lowest physical cell instead of the first rejected position.
After the fixes, all 24 comparisons (four prompts, each at up to 2, 3 or 4 drafts, with and without the policy) produce byte-identical full messages and identical token IDs at 3,000 tokens, 72,000 of 72,000. A 64K-context tool-history replay matched all 777 tokens. Prefill perplexity is unchanged at 3.0530.
Results
| Prompt | Plain, 384 tokens | DSpark, 384 | Plain, 3,000 tokens | DSpark, 3,000 (max 3) | DSpark, 3,000 (policy) |
|---|---|---|---|---|---|
| New code | 210.0 | 222.0 | 200.0 | 249.8 | 242.2 |
| Edit of given code | 200.1 | 310.7 | 196.1 | 273.6 | 266.6 |
| Prose | 209.3 | 205.1 | 199.9 | 228.7 | 238.8 |
| Edit at 16K context | 183.8 | 246.9 | 181.8 | 259.3 | 250.5 |
tok/s, 2-bit model, temperature 0, one fresh server per configuration; 384-token cells are medians of three. "Plain" uses the same build and flags as the DSpark runs (IK_MR=1 IK_MMA=3); the default plain build is 1–3% faster. DSpark at 384 tokens uses the adaptive policy. Round 4 build 399b61a; the full tables, with accepted and proposed draft counts, are in perf/RESULTS.md.
Short edits reach 311 tok/s. Speculative decoding isn't bound by the 369 tok/s plain-decode ceiling, because each verify round reads the weights once for about four tokens. Long replies run 239–267 tok/s against about 200 plain, and the edit at 16K context gains 38%. Phase seven took these further overnight.
Phase seven: one night of hill climbing
With both GPUs free overnight, two Codex agents worked in parallel and the orchestrator checked, merged and relaunched them as each finished. One card worked on the speculative path, the other on plain decode. Every merged change stayed exact: drafted replies still match the plain server byte for byte.
Cheaper verify rounds
- One host sync per round. The draft's input features, candidate IDs and the next target batch stay on the GPU, graphs are cached per window size, and inputs are pinned. In 1,800 measured rounds, each round had exactly one host synchronization. Short edits went from 308 to 324 tok/s.
- One K/V scan for a window. The window's query rows are packed as columns of one tensor-core tile over the cache. This was a small win: the 4-row window at 32K went from 12.44 to 12.09 ms.
- A guarded policy. The first policy no longer protected short prose (172 against 210 plain). The release drafts only at positions whose confidence pays at the measured window costs, so every configuration now beats plain at both lengths.
- A faster exact verifier for the dense weights. One warp computes two IQ4_NL rows for every window column while keeping the single-token summation order. The 3-draft code window went from 9.25 to 8.85 ms.
Plain decode, four more rounds
Codex took plain decode from 216 to 233 tok/s on one card, and the merged release runs at 239 on the other: the 4-tap convolution folded into the output projection, the gate projection overlapped with attention, controller fusions that remove 70 launches per token, and faster gate, attention and controller kernels. It also measured the limits:
- One persistent kernel streams the token's 193 matvecs in 2.69 ms. The production graph takes 2.94 ms, so weight streaming is close to its floor.
- A CUDA graph edge costs 0.67 µs, so the roughly 500 launches per token cost about 0.34 ms. A persistent, flag-synchronized layer visit reproduced the exact logits but took 96 µs, against 72 µs for the eight launches it replaced.
The remaining gap to 300 tok/s plain, about 0.95 ms per token, is the glue kernels' own run time, not launches or weight bytes.
Results
| Prompt | Plain, 384 | DSpark, 384 | Plain, 3,000 | DSpark, 3,000 |
|---|---|---|---|---|
| New code | 212.3 | 252.2 | 201.0 | 276.7 |
| Edit of given code | 201.9 | 342.6 | 196.9 | 305.8 |
| Prose | 211.4 | 219.9 | 201.1 | 296.1 |
| Edit at 16K context | 183.7 | 294.0 | 183.3 | 299.7 |
| Edit at 32K context | 171.0 | 258.7 | 169.8 | 302.1 |
tok/s, 2-bit model, temperature 0, release flags, up to 3 drafts with the guarded policy. DSpark at 384 tokens is the median of three; the other cells are single uncached requests. Across the release matrices, 270 drafted replies and 260,640 token IDs matched the same-flags plain server. Prefill perplexity is 3.0530 and decode-path perplexity 4.1979. Release 401460d; details in perf/RESULTS.md (phases 7, 7b and 7c).
This release ran the live endpoint until phase nine replaced it.
Phases eight and nine: the last of one GPU
Before rebooting into the two-GPU driver, we spent a day on the remaining single-GPU levers, again with Codex agents on both cards.
- Glue kernels. Packing the loop controllers in parallel and reusing the gate inputs in attention made the plain-token path that the drafting server uses between rounds 7–9% faster at every depth. Default plain decode moved only slightly, to 241 tok/s.
- Prompt lookup drafting. Each round can draft by copying a continuation of text already in the context (prompt lookup decoding), choosing it over DSpark when its expected payoff is higher, as basalt does. Agent turns echo files and tool output, so this helps most there: +3.2% on a short agent replay, about even on long replies.
- Prefill. Faster expert GEMMs for batches made prefill 12–15% faster: 3,463 tok/s at 4K and 3,151 at 16K. A 16K-token agent prompt now reaches its first token in 5.7 s, down from 6.6.
- Quantized KV in prefill. Unsloth reported that Inkling 2's attention in llama.cpp did not support a quantized KV cache, so llama.cpp fell back to making F16 copies of K and V; on a B200 their fix gave 60% faster prefill and a much smaller compute buffer (unslothai/llama.cpp, PRs #386 and #400–402). Our decode attention reads the Q8_0 cache directly, but our prefill had the same fallback: 3,072 whole-cache conversions in a 16K prompt. Phase nine reads Q8_0 tiles directly in prefill on the 3090, so there are now none, and the 64K compute buffer is 262 MB smaller. The prefill gain on this card is about 1%, because the conversion was cheap here. Unsloth's banded attention saved more memory but made prefill slower on the 3090, so we left it out. We also took three small fixes from upstream llama.cpp.
| Prompt | Plain, 384 | DSpark, 384 | Plain, 3,000 | DSpark, 3,000 |
|---|---|---|---|---|
| New code | 226.9 | 255.6 | 219.1 | 277.8 |
| Edit of given code | 221.3 | 350.6 | 216.9 | 311.0 |
| Prose | 226.7 | 224.9 | 219.0 | 306.4 |
| Edit at 16K context | 202.4 | 289.8 | 200.2 | 305.0 |
| Edit at 32K context | 186.4 | 256.0 | 184.1 | 305.7 |
| Agent replay (multi-turn, tool results) | 218.4 | 304.1 | 216.4 | 329.0 |
tok/s, 2-bit model, temperature 0, release flags (DSpark and guarded prompt lookup, up to 6 drafts). 384-token cells are medians of three; 3,000-token cells are single uncached requests. All 80 long drafted replies matched the same-flags plain server byte for byte; prefill perplexity is 3.0530. Release 72fd097, live since Nov 22, 18:10.
In a coding agent
The harness turned out to matter as much as the kernels. Out of the box, OpenCode sends about 11,000 tokens before the user types anything: its own system prompt, a "Code Mode" section that asks the model to call tools as JavaScript inside an execute tool, two dozen tool definitions, and a block that tells the model its name from the local config. That is why asking "who are you?" got "an OpenCode coding agent" or "an AI coding agent by localinkling". We replaced the prompt with one neutral line (Use the available tools to complete the request.), turned Code Mode off, denied the tools we don't use, and removed the identity block in our OpenCode build. The preamble went from 11,066 to about 1,300 tokens, a new session's first token from about 3.7 s to 0.4 s, and the model now answers "I'm Inkling, an AI assistant made by Thinking Machines Lab." The next real session averaged 244 tok/s, against 214 for the same kind of session with the default setup, and produced the simulator at the top of this post. One more lesson: keep old attempts out of reach. The model found notes from earlier runs in a sibling folder and read them.
That is where one RTX 3090 ends up: 241 tok/s plain, about 280–330 on long replies and 290–350 on short edits with output unchanged. Short prose is the one case where drafting doesn't help, and the policy keeps it level with plain decoding. The next step is the second card.
How far it goes: precision and context
The numbers above are for short and medium contexts. Here is how the final build behaves at the edges, for the 2-bit model and for a near-exact 4-bit build, on the same card at its default 420 W power limit. The KV cache is Q8_0 and the drafter is loaded. Decode is tok/s: "plain" is llama-bench tg128, and "DSpark" is one served, uncached 3,000-token reply at temperature 0.
| Context | 2-bit, plain | 2-bit, DSpark | 4-bit, plain | 4-bit, DSpark |
|---|---|---|---|---|
| Short | 229 | 279–330 | 192 | 217–247 |
| 16K | 205 | – | 175 | 244 |
| 32K | 188 | – | 163 | 226 |
| 64K | 159 | 272 | 141 | 210 |
| ~80K (4-bit maximum) | – | – | 127 | 217 |
| 128K | 121 | 212 | does not fit with the drafter | |
| ~193K (2-bit maximum) | 92 | 189 | – | |
2-bit: Q2_K/Q2_0 experts (9.94 GB, prefill perplexity +3.8%). 4-bit: IQ4_NL experts and dense weights (17.07 GB, +0.2%). Short-context DSpark ranges cover new code, an edit, prose and a multi-turn agent replay. Prefill: 3,531 / 3,212 tok/s (2-bit) and 3,381 / 3,092 (4-bit) at 4K / 16K, and about 1,450 tok/s when filling the 2-bit model's whole 196K context. At temperature 1.0 (the model's default sampling), short replies run 231–261 tok/s on 2-bit and 186–201 on 4-bit. The released near-exact build (IQ4_NL experts with Q6_K dense weights) decodes at 170 tok/s plain and 193–205 with DSpark at short context. Commands and raw logs: perf/PHASE10_NUMBERS.md.
- How much fits. With the drafter loaded, the 2-bit model holds about 196K tokens of context on 24 GB, with 2 GB to spare; 256K runs out of memory. The 4-bit model is 7 GB larger and tops out near 80K. Without the drafter it reaches about 131K, decoding at 110 tok/s plain.
- Speculative decoding helps more as context grows. At 193K, plain decode is down to 92 tok/s, while DSpark still gives 189, about twice as fast, because each verify step reads the long cache once for several tokens.
- Still exact, still retrieving. Drafted replies matched plain decoding token for token at every context tested (9,000 token IDs on 2-bit, 24,000 on 4-bit). A retrieval test hid three labeled codes at 10%, 50% and 90% of the prompt; both modes returned all three, in order, at 131K and 193K tokens (2-bit) and 81K (4-bit). Our fused attention had only been validated to about 50K before this.
Two GPUs and the P2P driver
A second 3090 doubles the memory bandwidth, but only if the two cards can split each layer's work and combine results quickly. Splitting by layers does nothing for a single stream. We measured 123.8 tokens per second with the layers spread over both cards, the same as one card, because each card waits for the other.
The useful split is tensor parallelism. Each GPU holds half of every weight matrix, including half of every expert, so the load stays balanced. Each GPU reads 2.06 GB per token instead of 4.12. But the two halves must be summed after attention and after each mixture-of-experts layer, about 96 times per token.
On our machine that sum is the problem. The two cards meet at a PCIe host bridge8, and the stock driver refuses peer-to-peer access between consumer GPUs, so data bounces through system memory. One 9 KB hidden-state vector took 26 µs to make the round trip. Times 96, that is 2.5 ms per token, which eats the entire gain.8nvidia-smi topo -m reports PHB between them. AMD's Zen root complex does route peer traffic between root ports once the driver allows it; some boards also need an ACS override.
The patch
NVIDIA supports direct GPU-to-GPU transfers on its data-center and workstation cards, and disables them on GeForce in the driver. Since NVIDIA open-sourced its kernel modules, the tinygrad team and others have maintained a small patch that turns the capability back on for consumer cards. It maps the peer GPU's memory through the PCIe BAR1 window, so one GPU can write straight into the other's VRAM. We use a community fork that tracks recent drivers (aikitoria/open-gpu-kernel-modules, branch 615.71.09-p2p). It needs NVIDIA's open kernel modules, Resizable BAR large enough to map the whole card (each of ours exposes a 32 GB window over 24 GB), and IOMMU passthrough, which is a kernel boot flag.
Secure Boot adds one step: the self-built module has to be signed, and the key confirmed once at the console on first boot. The patched module must also match the driver's userspace libraries exactly, so the plan moves the machine from driver 580 to 615.71.09, the version both the fork and Ubuntu ship.
# sign each patched module, then pin it above the stock DKMS build
for m in nvidia nvidia-uvm nvidia-modeset nvidia-drm nvidia-peermem; do
install -m 644 "$SRC/kernel-open/$m.ko" "$DEST/$m.ko"
"$SIGN" sha256 $MOKDIR/MOK.priv $MOKDIR/MOK.der "$DEST/$m.ko"
done
for m in nvidia nvidia_uvm nvidia_modeset nvidia_drm nvidia_peermem; do
echo "override $m $KVER updates/nvidia-p2p"; done > /etc/depmod.d/00-nvidia-p2p.conf
perf/p2p/install-p2p-driver.sh
| Setup | Weights | Syncs | Estimate |
|---|---|---|---|
| One GPU at its ceiling | 4.85 ms | – | ~206 tok/s |
| Two GPUs, no P2P (26 µs per sync) | 2.4 ms | ~2.5 ms | ~205 tok/s |
| Two GPUs, P2P copies (6–8 µs) | 2.4 ms | ~0.7 ms | ~320 tok/s |
| Two GPUs, hand-rolled all-reduce (2–4 µs) | 2.4 ms | ~0.3 ms | ~350–380 tok/s |
These estimates assume the glue is already small. Splitting across GPUs halves the weight streaming but not the glue, because every GPU still runs the full chain of norms, mixes and routing on the replicated hidden state. With today's 2.4 ms of glue, two GPUs with P2P would land near 200, not 300. That is why the megakernel comes first: the time it saves on one GPU is what lets the second GPU's bandwidth show up.
Sharing the card
The same machine runs two cloned voices (dots.tts fine-tunes), speech-to-text, and a vocal remover, and those had to keep working. Profiling them found the same pattern twice. PyTorch's caching allocator keeps the memory high-water mark of every past request, so a service that needs 5 GB idles at 9. Releasing the cache after each request, plus small changes like keeping a token-embedding table in system RAM, cut each voice from 9.2 to 6.5 GB. The audio stayed byte-identical and synthesis was no slower. Speech-to-text went from 5.1 to 4.2 GB with identical transcripts on 41 real recordings. That investigation also turned up a bug: most phone recordings had been silently rejected because of how audio was piped to ffmpeg.
Today one GPU holds both voices and speech-to-text, and the other holds Inkling and the vocal remover. With everything busy at once, Inkling dips to about 80 tokens per second for the length of the burst, and nothing runs out of memory.
Closing thoughts
The useful habit here was computing the floor before touching a kernel. Once the byte budget said 4.6 ms, the stock runtime's 16.5 ms was clearly mostly overhead, and every later decision followed from the same arithmetic. That includes why the drafter stopped paying, why the second GPU needs a driver patch, and why the glue has to shrink before the second GPU matters. The model's looped design is what made the overhead so large, and also what makes the fused version so specific to it. A general runtime can't make these trades; a model-specific one can. The last lesson came from using it. A benchmark at an empty context is not the experience of a coding agent with 30K tokens of context, and the next round of work is aimed at that gap. The habit also needs checking itself: we computed the floor once, for the exact weights, and then measured the 2-bit model against it for three phases. Recomputing it for the 2-bit file showed 150 tok/s of headroom and made speculative decoding worth a third try.
Appendix: dev log
How this actually happened, in order. The kernel work was done by AI agents running on the machine. Claude Code sessions ran phases one to three, using a Fable model for the CUDA work. A Codex session (GPT-6.2 Astra, high effort) ran phase four after Claude hit a usage limit. Each phase was briefed with the measurements and gates above, and the headline numbers were re-measured independently before anything shipped.
- Nov 20 · afternoonInkling 2 Mini support merges into llama.cpp (#32694). The first deployment shares the GPUs with other services and runs at 14–20 tok/s with a third of the experts in system RAM. Vision returns garbage and tool calls return 500s upstream, so it ships text-only.
- Nov 20 · eveningWith one GPU freed, the stock build reaches 58 tok/s served, and 66 with DSpark. Unsloth's fork is no faster. nsys shows about 7,200 kernels per token and 8.9 ms of tiny element-wise work.
- Nov 21 · overnightPhase one: new fused ops, load-time weight concatenation, mmvq tuning. 11 commits, 62 → 124 tok/s, perplexity unchanged. Verified independently: 124.4 fused against 64.6 with the fused paths switched off.
- Nov 21 · morningByte budget derived from the GGUF: 4.12 GB per token, a 216 tok/s ceiling. A layer split over both GPUs gives 123.8, no gain. Peer access is absent (26 µs round trip), so the two-GPU plan depends on the P2P driver.
- Nov 21 · middayMaking room: voices 9.2 → 6.5 GB, speech-to-text 5.1 → 4.2 GB, the old whisper service retired, and an m4a decoding bug found and fixed.
- Nov 21 · afternoonPhase two: single-launch attention and router, Q8_1 activations, and the Q6_K/F16 variant. 140.7 exact, 149.3 variant, 136 served. Deployed next to the voices and speech-to-text. DSpark is shown not to pay for this MoE.
- Nov 21 · afternoonP2P driver prepared: the 615.71.09-p2p modules build cleanly against the running kernel, and install, verify and rollback scripts are written. Waiting on a reboot.
- Nov 21 · afternoonPhase three (Claude, Fable): router v2 (11.8 → ~8 µs) and attention v2 (12.5 → 10.7 µs) kernels, plus a four-row Q6_K matvec: ~155 tok/s. A projection megakernel works but stays opt-in. Cut short by a usage limit.
- Nov 21 · late afternoonPhase four (Codex, GPT-6.2 Astra high): finds and fixes the rotated-KV cache-basis bug, specializes residual mixes, and segments projections. Q6_K dense reaches 159, IQ4_NL dense 174. Calibrated 2-bit experts reach 206.6, and 202 served. Tool calling with OpenCode works. AtomicChat's uncensored build is converted to the same layout.
- Nov 21 · eveningAudit (Claude): checksum matches, 208.7 / 193.2 tok/s at 0 / 1K context, 202.2 served, perplexity 3.0530 / 4.1945, all as recorded. Real-session logs show 120–140 tok/s at coding-agent context lengths. Both 2-bit models are packaged for Hugging Face.
- Nov 21 · eveningPhase five (Claude, Fable 5.2, 86 minutes): tensor-core attention scan (32K: 131 → 169 tok/s) and controller GEMMs for prefill (+40%). Grouped-expert verify studied but not built. Audit (Claude): served short 206.3, 16K 179.3 and 32K 166.1 tok/s, all matching. The live server moves to the new build. A one-command
uvxlauncher and a prebuilt release ship, and the near-exact Q6_K build joins the two 2-bit models on Hugging Face. - Nov 21 · nightThe ceiling is recomputed for the 2-bit file: 2.42 GB per token, about 369 tok/s. Phase six, round one (Claude, Fable 5.2): exact multi-token verify windows; DSpark beats plain on edits for the first time (235 against 197). Round two: tensor-core experts and the folded drafter head (273). Codex, in parallel on the other card: plain decode 207 → 215, and a diagnostic that puts this graph's plain-decode limit near 243.
- Nov 22 · after midnightRound three: drafts picked on the GPU, the shortlist head, a new policy, Codex's plain gains merged: 304 tok/s on short edits. The orchestrator's re-check finds the equality probe compared empty strings and that 3,000-token edits diverge. Round four (Codex, after Fable reached its usage limit): two sliding-window cache bugs fixed; 24 of 24 configurations identical at 3,000 tokens; 311 tok/s on short edits and 242–267 on long code and edit replies.
- Nov 22 · overnightPhase seven (Codex, both GPUs, orchestrated by Claude). Levers one and two: one host sync per round and a shared K/V scan, giving 324 on short edits and 277 at 32K. Lever three, four rounds: plain decode 216 → 233, with the measurements that place the remaining gap in the glue kernels' own run time. Phase 7b merged the two and fixed the policy for short prose. Phase 7c added an exact multi-column IQ4_NL verifier and lever three's last round: 343 on short edits, 277–306 on 3,000-token replies, 239 plain. Deployed to the live endpoint at 08:00.
- Nov 22 · dayPhases eight and nine (Codex): glue-kernel latency, prompt lookup drafting, prefill +12–15%, and Unsloth's quantized-KV finding applied to our prefill. 351 on short edits, 278–331 on long replies, 241 plain. Live at 18:10.
- Nov 22 · eveningLimits measured for posting: 2-bit fits about 196K tokens of context with the drafter (189 tok/s at 193K), 4-bit about 80K (217 tok/s). Drafted output stays exact and needle retrieval passes at every depth tested.
- NextThe P2P driver and a tensor-parallel split across both 3090s.
Try it on your 3090
You don't need to read any of this code to run it. On Linux (glibc ≥ 2.38, e.g. Ubuntu 24.04) with an NVIDIA driver ≥ 570 and uv installed, one command, the inkling-3090 launcher, downloads a prebuilt server from the fork, the CUDA runtime as pip wheels, and the model, then serves an OpenAI-compatible API on 127.0.0.1:8031:
uvx --from "git+https://github.com/csaben/llama.cpp@inkling-3090-v2#subdirectory=tools/inkling-3090" inkling-3090
# near-exact quality (Q6_K, ~152 tok/s): ... inkling-3090 --quality
# AtomicChat's uncensored build instead: ... inkling-3090 --uncensored
# an OpenCode provider config for it: ... inkling-3090 --opencode
The three models on Hugging Face:
- arelius/Inkling-2-Mini-Q2-3090-GGUF: the default, 2-bit experts, ~200 tok/s, +3.8% perplexity.
- arelius/Inkling-2-Mini-Q6K-3090-GGUF:
--quality, Q6_K dense projections, ~152 tok/s served, perplexity within noise of the original. - arelius/Inkling-2-Mini-Uncensored-Q2-3090-GGUF:
--uncensored, AtomicChat's edit in the 2-bit layout.
To build from source, or to run the higher-quality 4-bit weights, follow INKLING.md.
One note on intent. This code was written by AI agents, and we haven't reviewed it to the standard an upstream project deserves, so we aren't proposing it to llama.cpp. It's here to use, and for anyone who wants to verify it, take ideas from it, or point their own agent at it.
Methodology
- Hardware: RTX 3090 24 GB (GA102, sm_86), at its default 420 W power limit, driver 580.173 (open kernel modules), CUDA 12.8 (nvcc), Ryzen 9 9900X, Ubuntu 24.04. The second 3090 was not used. The voice and speech services ran on the other GPU throughout.
- Decode:
llama-bench -m <gguf> -ngl 99 -fa 1 -ctk q8_0 -ctv q8_0 -p 0 -n 128 -d 0,1024 -r 3, plus the switches listed in INKLING.md. Before phase 4 the cache type was the default F16 and there was no-d. - Served:
perf/bench.py, three fixed prompts × 700 tokens at T=0 and T=0.7, one slot, 16K–64K context, using the server's own timings. - Perplexity:
llama-perplexity -f perf/ppl.txt -c 2048 --chunks 8 -b 2048(prefill) and-c 1024 --chunks 2 -ub 1(decode path). The standard errors are about 0.064 and 0.28. The text is llama.cpp's build documentation, so it is public and reproducible. - Correctness:
test-backend-opsfor every new operator against its CPU reference; three fixed greedy generations; and an 827-token mixed-prefill probe that compares 12 generated tokens with unfused reference attention. - Real sessions: per-request
print_timinglines from llama-server's log, grouped by the context size recorded when each request finished.
What it cost
We like knowing what a result took, so here is the bill, split by vendor. Every number comes from the agents' own session logs, Claude Code's and Codex's, starting at the request that kicked off this work. Each model call is counted once and priced at each vendor's API list rates.99Opus 5.5: $4 input, $20 output, $0.20 cache read per million tokens. Fable 5.1: $10, $50, $0.25. Cache writes cost 1.25× input for 5-minute entries and 2× for 1-hour entries, and the logs record which. *Fable 5.2 is not in our price table yet, so it is priced at Fable 5.1 rates. GPT-6.2 Astra: $8 input, $0.40 cached input, $40 output per million tokens, from OpenAI's pricing page. The logs show no cache-write tokens. Unrelated side sessions that ran on the same machine during this work are left out. The work actually ran on subscriptions, not the API. On the Claude side it used about three back-to-back five-hour usage windows before the limit that handed phase four to Codex.
| Workstream | Model | Active h | Output | Tokens processed | API cost |
|---|---|---|---|---|---|
| Orchestration, verification, audit, deploys, write-up and site | Claude Opus 5.5 | 6.5 | 0.70M | 385.5M | $147.54 |
| Phase 1 kernels (fused ops) | Claude Fable 5.1 | 1.8 | 0.35M | 70.2M | $67.28 |
| Phase 2 kernels (single-launch attention/router) | Claude Fable 5.1 | 2.5 | 0.53M | 104.4M | $70.29 |
| Phase 3 kernels (router/attention v2, stopped by a usage limit) | Claude Fable 5.1 | 2.1 | 0.44M | 44.7M | $56.25 |
| Phase 5 kernels (tensor-core attention scan, prefill GEMMs) | Claude Fable 5.2* | 1.4 | 0.22M | 24.3M | $23.14 |
| Phase 6 research (basalt, ingine read-through) | Claude Opus 5.5 | 0.1 | 0.02M | 2.0M | $1.27 |
| Phase 6 research (basalt, ingine read-through) | Claude Opus 5.5 | 0.1 | 0.02M | 1.9M | $1.26 |
| Phase 6 round 1 (exact multi-token verify windows) | Claude Fable 5.2* | 1.0 | 0.25M | 42.4M | $29.03 |
| Phase 6 round 2 (tensor-core experts, drafter fold) | Claude Fable 5.2* | 0.8 | 0.15M | 11.5M | $13.74 |
| Phase 6 round 3 (device picks, shortlist, policy) | Claude Fable 5.2* | 0.8 | 0.13M | 21.3M | $15.47 |
| Phase 6 round 4 start (stopped by the Fable limit) | Claude Fable 5.2* | 0.2 | 0.04M | 3.0M | $4.30 |
| Phase 4 (Codex): kernels, cache-basis fix, 2-bit experts, tool calling, uncensored conversion | GPT-6.2 Astra (high) | 2.2 | 0.19M | 87.3M | $51.19 |
| Phase 6 plain decode (Codex) | GPT-6.2 Astra (high) | 0.7 | 0.09M | 22.5M | $15.47 |
| Phase 6 round 4 (Codex): two SWA rollback bugs, long-reply proof | GPT-6.2 Astra (high) | 1.0 | 0.08M | 35.4M | $20.09 |
| Phase 7 plain decode, four rounds (Codex): 216 to 233 tok/s | GPT-6.2 Astra (high) | 5.9 | 0.61M | 164.4M | $104.65 |
| Phase 7 speculative decoding, three rounds (Codex): shared K/V scan, one host sync, policy, merges | GPT-6.2 Astra (high) | 6.7 | 0.46M | 163.6M | $96.43 |
| Phase 8-9 (Codex): glue kernels, merges, Q8_0 prefill tiles, upstream fixes | GPT-6.2 Astra (high) | 6.5 | 0.24M | 110.9M | $61.43 |
| Phase 8 drafting and prefill (Codex): prompt lookup, expert prefill GEMMs | GPT-6.2 Astra (high) | 2.7 | 0.10M | 72.3M | $36.05 |
| Total | 42.8 | 4.62M | 1368M | $814.88 |
By vendor: Anthropic: $430, 711M tokens, 17.3 active h · OpenAI: $385, 656M tokens, 25.5 active h. Counted through phase nine (Nov 22, 18:20).
A few things stand out. Almost all of the tokens are cache reads: an agent rereads its whole working context on every step, at a small fraction of the input price. The kernel phases dominate the bill. The Codex session took the last stretch, from 155 to 200, for about a fifth of what the Fable phases cost, but it started from their kernels, profiles and notebook. "Active hours" sums the gaps under ten minutes between calls, so waiting on a rate limit or on a human does not count. The GPUs cost nothing extra; the machine was already running.
Reproduce with your agent
github.com/csaben/llama.cpp · branch inkling-3090
The branch is llama.cpp plus every commit above, tagged at each milestone (checkpoint-124tok, -134tok, -137tok, -140tok, variant-q6k-dense). INKLING.md is written for coding agents. It covers building, downloading the weights, reproducing each number, finding the core code, and the gates any change has to pass. Paste this into Claude Code, Codex or similar on a machine with a 24 GB NVIDIA GPU:
Clone https://github.com/csaben/llama.cpp and check out the inkling-3090 branch. Read INKLING.md first and follow it: build with CUDA for my GPU's architecture, download ggml-org/Inkling-2-Mini-GGUF (IQ4_NL), then reproduce the llama-bench tg128 number with the fused paths on and with LLAMA_INKLING_FUSED=0 LLAMA_INKLING_FUSED_QKV=0, and the perplexity on perf/ppl.txt. Report both against the table in INKLING.md, and walk me through src/models/inkling2-loop.cpp and the attention and router kernels in ggml/src/ggml-cuda/inkling.cu.
Where the code lives
| File | What it holds |
|---|---|
| src/models/inkling2-loop.cpp | The loop: 24 physical layers become 48 cache slots, and each core pass reads the previous pass's bank. |
| src/models/inkling2.cpp | The layer body: residual mixes, the fused attention and router ops, the expert path, load-time weight concatenation. |
| ggml/src/ggml-cuda/inkling.cu | Every custom CUDA kernel, including the single-launch attention and router. |
| tests/test-backend-ops.cpp | Test cases for each new op against its CPU reference. |
| perf/RESULTS.md | The lab notebook: every step with its speed, perplexity, commit and profile. |
| perf/p2p/ | The P2P driver install, verify and rollback scripts. |
| perf/quantize-inkling-dense.sh | The requantization recipes for the dense and 2-bit variants. The calibrated Q2_0 encoder is in 704a7da. |
| tools/inkling-3090/ | The uvx launcher and the v2 release it downloads (prebuilt for sm_86 from the phase 5 commit 1083879, tested end to end). |
| commit history | From stock to 140 tok/s, one commit per step. |
Prior work
None of the tricks above are new on their own. Here is what each one builds on:
- Speculative decoding: Leviathan, Kalman and Matias, 2023; Chen et al., 2023. The DSpark drafter is Thinking Machines'.
- Split-K single-token attention with a final combine: Flash-Decoding (Dao, Haziza, Massa and Sizov).
- Tiled attention with an online softmax: FlashAttention, FlashAttention-2, and Milakov and Gimelshein's online normalizer. The two-limb FP16 split is Dekker's.
- Megakernels and removing launch bubbles: Hazy Research, "Look Ma, No Bubbles!".
- Hadamard-rotated KV quantization: QuaRot (Ashkboos et al.), as implemented in llama.cpp.
- K-quants, IQ4_NL and importance matrices: ikawrakow's llama.cpp work, #1684 and #4861. Our calibrated Q2_0 encoder applies the importance-weighted fitting idea to Q2_0.
- CUDA graphs in llama.cpp: NVIDIA's write-up.
- Peer-to-peer on consumer GPUs: the tinygrad patch and aikitoria's fork.
- maya-inkling-mini (Project Maya, MIT): our tensor-core decode scan adapts the structure, MMA wrapper and int-to-FP16 trick of its
attn_decode_mma_kernel. Its analysis of the full-attention layers, and its grouped expert reads for draft windows, shaped phase five. - Multi-token verify for this model: basalt (MIT): one graph per window size, every fused op multi-row, experts grouped per window, the folded drafter head, the learned window policy. ingine (Apache-2.0): tensor-core expert and dense kernels with tokens as matrix columns, the drafter shortlist head, device-side drafting. Phase six adapts ingine's kernel structure; its notice is in
NOTICE.inkling. - Quantized KV in Inkling 2 prefill attention: Unsloth's finding and fixes in unslothai/llama.cpp (PRs #386, #400, #401, #402; MIT). Prompt lookup decoding: Apoorv Saxena.
- Ceiling arithmetic for MoE speculative decoding (union of routed experts per verify step): sybil-solutions/inference-optimisation-skill.
- The model and its conversions: Thinking Machines, ggml-org, Unsloth, and AtomicChat (uncensored edit).
Citation
Sources: Inkling 2 Mini announcement · model card · vLLM recipe · ggml-org GGUF · Unsloth GGUF and DSpark drafter · llama.cpp #32694, #32218, #32704 · tinygrad P2P patch · aikitoria fork · S. McLeod on P2P for consumer GPUs.
Please cite this work as:
Clark Saben, "Looping on a 3090", Nov 2026.Or use the BibTeX citation:
@misc{saben2026looping3090,
author = {Clark Saben},
title = {Looping on a 3090},
year = {2026},
note = {https://github.com/csaben/llama.cpp/tree/inkling-3090},
}Measurements are llama-bench tg128 on one RTX 3090 unless noted. Served numbers come from llama-server with an 8-bit KV cache over the network, and perplexity from a fixed 8×2048-token text.