Research · Phase 1

Inkling 2 Mini on two free Kaggle T4s

Thinking Machines' Apache 2.0 looped mixture-of-experts, 26.4B parameters, running at 41.0 tokens per second with 98.1% top-1 agreement against full precision, decoded by our own Triton kernels on the cheapest hardware Kaggle gives away.

The notebook, the kernel module and a standalone benchmark runner are public now. Everything on this page can be re-run, including the parts that did not work.

41.0 tok/s2× T498.1% top-126.4B / 3.4B activeApache 2.0
GitHub: notebook, kernels, bench runner Hugging Face Kaggle notebook
The result

41.0 tokens per second overall decode, median 40.9, range 40.7 to 41.4. Single-token step 21.2 ms. Quality: +1.16% perplexity (3.40 to 3.44) and 98.1% top-1 agreement against fp16. Protocol: greedy decoding, 10 prompts, 4,476 tokens, layer-split layout, zero timeouts.

Read the limits before the numbers. The notebook is published and executed, but the two .py files are direct extractions of that verified code and have not been re-run standalone on separate hardware. Decoding is greedy only. MAXLEN is 1,024 against a 32k target. T4s throttle at their 70 W cap, so results move a few percent run to run. None of that is hidden below; it is here first.

What the model is

Inkling 2 Mini is a looped MoE with 24 physical layers. Layers 6 to 17 are executed three times, so every token passes through 48 layer calls. Each layer has 128 experts and routes each token to 8 of them. 26.4B parameters total, 3.4B active per token.

That structure is why this is hard. The expert path dominates both memory and time, and the looped layers reuse weights, which changes how memory is planned across a forward pass and how attention keys and values can be cached.

Where this started

The first working notebook ran at about 8 tok/s and every output was garbage. The engine had been built from a guessed architecture, and the router was scoring against the vocabulary matrix instead of the expert gate. Getting a number at all was easy; getting a correct one was the work.

The engine was rebuilt from transformers' own inkling2_loop reference, matching every architectural detail: block attention residuals, loop passes with message gates and message queries, static and dynamic short convolutions, attention sinks, relative position bias, the 1,024-token sliding window, q/k clipping, log-scaling of attention, softcapped SwiGLU, sigmoid router with bias, and the final softcap. Checkpoint loading uses the official name mapping.

One bug in that rebuild mattered more than the rest: the MTP draft weights were overwriting real layer norms. Fixing it is what made the model produce the right answer to a simple prompt.

Quantisation

Experts

The checkpoint's own NVFP4 (layers 0 to 19) and MXFP8 (layers 20 to 23), decoded by our own Triton kernels. A T4 has no fp8 support in Triton, so decode uses fp16 bit-pattern tricks and is exact.

Dense weights

int8 with per-group scales (G=128). The head is int8 per row.

Measured cost of quantising

+1.16% perplexity (3.40 to 3.44) and 98.1% top-1 agreement against fp16, measured over 263 teacher-forced positions. Mean KL 5.89e-3.

The multi-token verify step

Speculation needs a way to check a block of 1 to 4 tokens in one pass through all 48 layer calls. That step uses the batched int8 kernel, a dedup MoE kernel that reads shared experts once, causal attention inside the block, and per-token conv snapshots so rejected tokens can be rolled back exactly.

Verified: it matches three sequential single steps at low KL, state matches to about 1e-5, and rollback is exact. Graph capture starts automatically at every GPU crossing, and the graphed results matched too.

The decisive measurement: each extra token cost about 11 ms, because every extra token brings about 4 new experts per layer and expert bytes dominate. That capped speculation at about 45 tok/s on the old layout, which is why it was later parked.

The hardware finding that changed everything

The first layout ran the two GPUs in series, so each sat idle half of every token. Measured: experts were 65% of the step (17.8 of 27.1 ms), both T4s stream experts at full speed simultaneously, and together they took no longer than one alone. Peer access works, but there are no P2P atomics: the cards connect through the CPU's PCIe host bridge, and a host-driven GPU-to-GPU hop costs 88 µs, or 4.2 ms per token at 48 hops.

The device-side protocol

Without atomics, flag-based handshakes were impossible. The fix borrows the idea behind NCCL's low-latency protocol: every 8-byte word carries 4 bytes of data and a 4-byte tag, the sender writes directly into the receiver's memory, and the receiver polls its own memory until every word carries the right tag. Measured 16 µs per round trip, about 0.77 ms per token, 5.5× faster than host copies, with zero errors over thousands of messages and timeouts so it cannot hang.

Expert parallelism

Where the time went

StepResult
EP engine on the general block math, uncompiledcorrect, but 44.8 ms; dense alone 33.9 ms
M=1 expert fast path, no dedup for one token48 calls from ~11.5 to ~8.5 ms per GPU
Compiled block math28.6 ms = 34.9 tok/s; dense still 20.2 ms
Old single-token dense code plugged in27.4 ms = 36.6 tok/s; its dense measured at 19.6 ms
Floor analysisdense floor 9.3 ms: int8 GEMVs 4.8, other weights 1.5, KV 1.4, head 1.65
Own attention kernel24.7 ms = 40.5 tok/s
One-token int8 GEMV41.9 tok/s
Inductor combo_kernels + aggressive_fusion2,022 → 1,502 kernels per token; 42.4 tok/s
One-token expert kernelsno gain: existing kernels already reach 94–174 GB/s against a 174–231 GB/s ceiling
Fused router top-ksame experts 20/20, KL 6e-9; small gain

Progress over the project

0.69 → 1.24 → 2.99 → 10.8 → 13.5 → 18.2 → 20.6 → 23.9 → 24.6 → 34.1 → 34.4 → 36.8 → 40.5 → 41.0 tok/s

Speculation, measured and parked

The DSpark draft model was ported from vLLM main and its acceptance measured on our engine. These are our measurements, not published by vLLM: greedy decoding, int8 engine, 10 prompts, 1,920 anchor positions, blocks of 8 (an anchor plus 7 drafts) with the recurrent Markov head.

MeasureValue
Mean accepted per block1.82
Acceptance by depth0.68, 0.63, 0.65, 0.65, 0.70, 0.66, 0.66
Tokens per verify step, 2 / 3 / 4 / 5 / 7 drafts2.02 / 2.24 / 2.35 / 2.41 / 2.45
By prompt: prose (explain, summary, email)1.10–1.24
By prompt: code and JSON2.24–2.33
By prompt: maths2.85
int8 vs fp16 acceptanceidentical, consistency 1.0

On 2×T4 the block costs are 1.66× for M=2 and 2.11× for M=3, so speculation measures 32.1 / 31.7 / 29.1 tok/s at 1 / 2 / 3 drafts against 41.0 without it. Every extra token pulls in about 4 new experts. Outputs were 100% token-identical to greedy, so the quality is fine and the arithmetic is not. It is parked.

Corrections we published

Two projections in this work were wrong, and both are recorded here rather than quietly dropped.

The gap to 60 tok/s

The step needs to go from 21.2 ms to 16.7 ms. These savings are estimates, not measurements:

ItemEstimated saving
Hand-fuse the ~1,500 small dense kernels per token (~10 ms now, ~3 ms floor)4–5 ms
Lazy / certified head, not the full 200K vocab every token~1.5 ms
Expert decode in fp16 maths1–2 ms
Exchange glue~1 ms

Current layout

Our own kernels: NVFP4/MXFP8 expert decode (batched dedup and one-token), int8 per-group and per-row GEMVs, the attention kernel, the LL send/receive kernels, and the fused router top-k.

For scale

The TensorFold engine on NVIDIA's DGX Spark reports 48.3 tok/s for one request, measured with drafts on. We are at 41.0 on two free T4s with no speculation. That comparison is not a claim of superiority: it is a different machine, a different budget, and different constraints. It is here because a number without context is not useful.

Run it yourself

Three files, all published under Apache 2.0:

FileWhat it is
inkling-2-mini-t4.ipynbA self-contained 8-cell Kaggle notebook: audit, kernels, model load, CUDA graphs, the G0 to G3 gates, the benchmark and interactive chat. Executed and verified on Kaggle 2×T4.
inkling2_t4_kernels.pyThe Triton kernel module: sm_75 shared-memory pruning, num_stages=2, NVFP4/MXFP8 bit-pattern decoders, int8 GEMVs, decode attention, router top-k, the 8-byte tag-encoded exchange and self_test().
run_t4_bench.pyA standalone Linux CLI runner outside Kaggle: --mode, --prompt-set, --skip-quality, --no-dspark.

The two .py files are direct extractions of the verified notebook, so they are the same kernels. They have not been separately re-executed on standalone hardware, and the README says so.

Kernel self-test on a single GPU, no model download:

python3 -c "import inkling2_t4_kernels as K; K.configure_kernels(num_heads=24, num_kv_heads=8, head_dim=128, gate_cap=30.0, up_cap=30.0); K.self_test()"
Notebook, kernels, bench runner Hugging Face Research repo Cite it

Follow the work

@fikraapi on X for updates. The founder: @jamesmian0 on X and jamesmiano on LinkedIn.

← All research