Blog

We’re building an Inkling-2-Mini engine that already decodes 1.5× faster than SGLang

On one RTX PRO 6000 Blackwell and 24 MT-Bench questions, our Inkling-2-Mini engine decodes a single greedy request at 295 tok/s, against 194 for SGLang and 212 for vLLM with optimized flags, and four requests at once at 539 tok/s against 466 and 441.

Magni12 min read

Inkling-2-Mini is Thinking Machines’ looped mixture of experts, with 26B parameters of which only 3.4B are active per token. We wanted to know how fast a serving engine written for this one model and one GPU could be, so we’re building one in Python and Triton on PyTorch, with an OpenAI-compatible server.

On 24 MT-Bench questions that nothing in the engine was tuned on, a single greedy request decodes 1.5× as fast as in SGLang and 1.4× as fast as in vLLM, and four requests at once get 1.16× SGLang’s throughput and 1.2× vLLM’s. That is our server’s default, which runs the dense weights in FP8 and prefills the experts in FP4, while SGLang and vLLM run the dense weights in BF16. With ours in BF16 too and every engine held to 32 GB, the lead for one greedy request is 1.4× over SGLang and 1.25× over vLLM.

Faster than SGLang and vLLM. Decode on 24 MT-Bench chat questions, on one RTX PRO 6000 Blackwell with each engine’s own flags, the same client for all of them, and DSpark speculative decoding on for every engine.

  • 256Ktokens of context in one slot, with an FP8 cache for the full-attention layers
  • 28.8 GiBpeak GPU memory set up for four 32K slots

Single-request decode speed

Output tokens per second, greedy, higher is better

  • Ours284 at temperature 1295 tok/s
  • vLLM, optimized flags207 at temperature 1212 tok/s
  • vLLM, default flags203 at temperature 1210 tok/s
  • SGLang189 at temperature 1194 tok/s
Medians over two containers of each engine, 24 MT-Bench questions with natural stopping at up to 512 output tokens each. The rate is all completion tokens over the wall time of a pass.

What makes Inkling-2-Mini slow to decode?

A decode step reads every weight its token touches and does little arithmetic with each one, so it is limited mainly by memory bandwidth and by the time lost between kernels. Inkling-2-Mini makes that second cost large, because its layers loop. The 24 stored layers form a prelude of 6, a core of 12 that runs three times and a coda of 6, so every token makes 48 layer visits.

Each visit has attention with a relative-position bias, a per-head attention sink and a sigmoid output gate, four short convolutions, block attention residuals, gated messages between loop passes and a router that picks 8 of 128 experts. The experts are stored in NVFP4 for the first 20 layers and MXFP8 for the last 4. Twenty of the attention layers look back over a sliding window of 1,024 tokens and four see the whole context.

Our engine runs each visit in about 12 fused Triton kernels, close to 600 launches per token, and captures the whole decode step as one CUDA graph that the CPU replays with a single call.

The checkpoint also ships a DSpark drafter, which reads the target’s hidden states and proposes the next 7 tokens in one pass. The target checks them together in a verify step and keeps the longest run that matches what it would have produced itself, while sampled requests use speculative rejection sampling, which keeps the output distribution exact. A verify step over eight positions takes about 1.5 times as long as a one-token step, so decode speed comes down to the step, the drafter and how many drafts are accepted.

How did we measure it?

Every server ran on its own Modal container with the whole 96 GB card, the same client and its own best setup, and was set to at most four running requests. SGLang ran the lmsysorg/sglang:inkling-2-mini image with the flags of its DSpark recipe for this card, --dtype bfloat16, FA4 attention, a 32,768-token context and --mem-fraction-static 0.8, leaving out the multimodal, grammar and tool-parser flags. vLLM ran the 0.34.0rc1 nightly image, which includes its Inkling-2-Mini performance PR, with its Inkling-2-Mini recipe, --gpu-memory-utilization 0.9 and a 32,768-token context. It ran once with its default flags and once with --kv-cache-dtype fp8 --attention-backend FLASHINFER, the flags that PR was measured with, which are the optimized flags in the tables.

The prompts are the first three questions of each of MT-Bench’s eight categories, in the chat format with thinking off and at most 512 output tokens, a limit that 6 to 9 of the 24 greedy answers reach. Our scheduler’s batch widths and the drafter’s sampling temperature were chosen on six other prompts, four short chat requests and two raw completions, so none of these 24 shaped the engine. One, two or four requests are kept in flight, and after a warm-up pass each container’s figure is the median of three passes. We also ran random 1K-token prompts with 1K tokens out, the lengths of that vLLM PR, with ignore_eos and eight requests for each one in flight.

In every speed test the client sends token ids to /v1/completions, so tokenization and chat templates cannot differ. Time to first token (TTFT) uses a fresh random-token prompt every time, so no prefix cache helps.

How do the three engines compare?

Aggregate output tokens per second, medians over two containers. Higher is better, and bold marks a lead of 10% or more.
EngineMT-Bench, 2 requestsMT-Bench, 4 requestsRandom 1K/1K, 1 requestRandom 1K/1K, 4 requests
Ours353539300652
vLLM, optimized flags331441295417
vLLM, default flags3274353031404
SGLang305466192490
Time to first token on a fresh random-token prompt, in milliseconds, medians over two containers. Lower is better.
Engine1K4K8K
Ours48168342
vLLM, optimized flags62193364
vLLM, default flags60184348
SGLang68199395

What changes under a 32 GB limit?

We develop the engine under a 32 GB budget so that it fits cards like the RTX 5090. We held every engine to it, ours with a process cap, SGLang with --mem-fraction-static 0.232 and vLLM with --gpu-memory-utilization 0.33. Under that limit vLLM with default flags had 7.3 GiB left for its cache, about 6.9K tokens, and ran with --max-model-len 6144. With the optimized flags it ran at 4,096, while 12,000 and 24,576 did not start.

Output tokens per second on MT-Bench with every engine held to 32 GB. Higher is better, and bold marks a lead of 10% or more.
EngineContainersGreedyTemperature 12 requests4 requests
Ours2303293363552
Ours, BF161264255325521
vLLM, optimized flags2212206331446
vLLM, default flags1211205325474
SGLang2192184302457

In BF16 our engine is level with vLLM at two requests. On the six prompts we tuned on, a greedy request under the same limit decodes at 322 tokens per second for us, 260 for vLLM with optimized flags, 235 with default flags and 232 for SGLang.

How did a decode step get cheap?

Fusion removed most of the launches, and programmatic dependent launch (PDL) hid much of the gap between the ones left. PDL lets a kernel start while its predecessor is still finishing and then wait for that predecessor’s output. Our first attempt triggered each kernel’s successor at the start of the kernel, and the launches cascaded, with waiting kernels spinning on SMs, so a decode step went from 6.40 ms to 6.81 ms. Triggering only at completion overlapped nothing.

Triggering right after each kernel’s own wait worked, because the time before the wait is free for work that doesn’t depend on the previous kernel. The weight GEMVs, the router, the message gates and attention all prefetch their weights or cached keys and values into L2 there, which took a decode step from 6.08 ms to 5.66 ms. It also exposed one kernel registered for PDL that never waited and raced its producer, so every PDL kernel waits first.

The NVFP4 expert kernels had been tuned on the wrong timings. The autotuner repeats a kernel whose weights are already in L2, while a real decode step reads them from memory, so we picked the launch configurations from cold timings instead. That cut the first expert kernel from 27.8 µs to 14.8 µs.

What does the drafter cost?

A draft took 1.48 ms at first. Fusing the glue between its layers, and replacing PyTorch’s grouped-query SDPA path, which copied 0.8 GB of keys and values at the 64K bucket, brought it to 0.98 ms.

Each draft row picks 1,024 candidates, and choosing them from the 32K most frequent tokens instead of all 200K took the draft from 0.97 ms to 0.63 ms and raised DSpark throughput 9%. The idea is ingine’s, and our frequency ranking is rebuilt from public text. Committing accepted tokens into the drafter’s caches had taken about 240 kernel launches, and two fused launches per layer cut it from 0.25 ms to 0.05 ms.

A request alone in the engine verifies 2, 4 or 8 positions per round, whichever maximizes expected tokens per millisecond given the measured cost of each verify graph and the drafter’s calibrated confidence. Sampled requests draft at 0.8× the request’s temperature, which stays exact under rejection sampling and adds 2–4% at temperature 1.

What about several requests at once?

Our scheduler first picked bad draft widths for four requests, because its verify costs had been calibrated on identical rows, 10.8 ms against 18–19 ms with real ones. Measuring the costs in place and fixing one width per batch size took four requests from 447–461 tokens per second to 525–533.

Each round also synced with the host several times. Batched rounds sync once, draft for every slot in one Markov launch and commit in one gather and scatter, which cut GPU idle time from 8.5% to 4.0%. Launching the next round’s draft before handing out tokens added another 3% or so through the server.

And prefill?

Prefill runs in chunks of 2,048 tokens, with the expert GEMMs grouped over tiles sorted by expert. Assigning those tiles with a counting sort on the GPU removed a host sync, and together with fused message gates and a 3xTF32 router GEMM it took an 8K prefill in FP4 mode from 549 ms to 416 ms.

Issuing the relative-bias load before the QK matrix multiply cut full attention from 2,199 µs to 1,769 µs. Key blocks far from the queries skip the relative-bias gather entirely, which took a 131K-token prefill from 26.3 s to 15.0 s. Very short prompts replay a captured graph, and an 8-token prompt reaches its first token in 10.9 ms instead of 20.9 ms.

FP4 prefill quantizes the expert inputs to NVFP4 and runs the expert GEMMs on the FP4 tensor cores through Triton 3.6’s tl.dot_scaled, which cuts an 8K prefill with BF16 dense weights from 469 ms to 373 ms. SGLang and vLLM do the same on this model, and our path follows vLLM’s sm_120 expert GEMM. Our BF16 setup leaves it out, so under the 32 GB limit its first token at 4K takes 230 ms, against 223 ms for SGLang and 184 ms for vLLM. FP8 dense weights cut the projections from about 110 ms to 44 ms of an 8K prefill.

What didn’t work?

A persistent kernel that ran the whole decode MoE in one launch took 104–230 µs against 28.7 µs for the separate kernels, because it kept too few memory loads in flight. Folding attention’s split-combine into the attention kernel took it from 9.7 µs to 12.3 µs to remove a 1.4 µs combine. A screened LM head that scored the vocabulary in FP8, with an error bound to certify the exact top 64, could certify only 19% of rows.

Computing the relative bias inside the attention kernel instead of reading a table was slower for both local and global attention. Splitting the router GEMM into three BF16 parts was 1.6× faster but had 30× the FP32 error. NVFP4 copies of the dense weights gave a simulated KL divergence of 1.45e-2, three times FP8’s, so the dense weights stop at FP8.

Will it run on an RTX 5090?

It should. A 5090 has the same GB202 chip and 31.84 GiB of memory, so we had a second process fill our card until only 31.0 GiB was free and started every job from an empty kernel cache. The default and BF16 setups each took four 31K-token prompts at once, the 256K setup took a 250K-token prompt, the server’s end-to-end and soak tests passed, and nothing went over 28.6 GiB.

The strangest roadblock was the first start, which took up to 31.5 GiB, so the default setup ran out of memory in that test. The autotuner was launching kernel variants that spilled up to 2.7 KB of registers per thread, and the driver sizes its local-memory pool for the largest spill it has launched, across every thread on the GPU, and keeps it. The engine ships its tuned kernel settings and never launches a variant that spills heavily, which also cut a first start from 481 s to 69 s.

We haven’t run it on a 5090, so its speed there is unmeasured. Decode should carry over well because it is limited mainly by memory bandwidth. GeForce cards run BF16 tensor-core math with FP32 accumulation at half the PRO card’s rate, so BF16 prefill should be slower there and the FP8 and FP4 paths should gain more.

Is it still the same model?

Alongside the fused engine we keep a plain PyTorch reference model. In FP64 its chunked prefill matches its one-shot prefill bit for bit, through the KV caches, the sliding-window rings, the convolution states and the loop passes, and in BF16 its prefill logits differ from transformers’ by a KL divergence of 1.4e-2 on one prompt. The fused engine is compared with that reference model in BF16 on 300 random tokens, where its prefill logits differ by a KL divergence of 2.4e-3, and over the 12 decode steps that follow by 1.4e-2, with 11 of the 12 greedy tokens the same. The table below has each option of the fused engine against the same engine in BF16.

Divergence from BF16 on 3,072 tokens of natural text, each option on its own. Lower is better.
ConfigurationKL against BF16Next-token NLL
BF16 noise floor3e-30.732
FP8 dense weights6e-30.737
FP4 prefill9e-30.737

On 200 GSM8K test questions, 5-shot and greedy through each server, the three engines are level.2

Where it stands

On chat prompts our engine decodes faster than SGLang and vLLM with one request and with four, on the whole card and held to 32 GB. Next we’re working on better draft acceptance at four requests, a cheaper decode step and speed measurements on an RTX 5090.

The model math follows SGLang’s implementation and transformers’ inkling2_loop. ingine, a C++ and CUDA engine for the same model, supplied the DSpark drafter reference, the shortlist head and the shape of the fused decode design, and vLLM supplied the FP4 prefill path. The repository has the engine, the benchmark client, every raw result file behind the comparison and the full optimization log, and this article’s figures come from commit bbfc876.

Notes

  1. vLLM with default flags is barely ahead on one random 1K/1K request, by about 1%, where our containers ran at 308 and 292, and at 30K, where its first token takes 1,409 ms against our 1,424 ms, 1,486 ms with its optimized flags and 1,585 ms for SGLang. ↑

  2. SGLang is barely ahead at 0.845, against 0.835, 0.835 and 0.840 in our three runs and 0.840 for vLLM. The differences are within noise, with a standard error of about 0.026. ↑

We push AI inference closer to the physical limit of GPUs, within days, on any model and any hardware.

Post on XShare on LinkedIn

Read next

  1. 16 min read

    We made vLLM beat Backboard’s Gemma 4 engine

    On Gemma 4 12B and one RTX PRO 6000, vLLM 0.33.0 with a tuned config and five patches serves 5.4% more output tokens per second than Backboard’s published engine over 8 workloads, with p90 TTFT 1.09× faster. On the same GPU that is 1.07–1.33× the article’s vLLM recipe.

All posts