One GPU kernel that trains, serves and plays Doom, and 31 of 39 inference companies beaten on their own stacks

Magni builds inference engines and the system that tunes them. Below are our strongest measured results, each with its hardware, its baseline and the places where we still lose.

3kernel launches for a whole train + serve run on B200; baselines make 2.2M to 4.2M
31 / 39companies beaten in exact 1:1 replicas of their own published setups
5.39×largest fair win: structured JSON on 1× H100
7.7×DeepSeek-V4.1-Flash on one B300 vs stock vLLM, same quality

We beat each company on its own stack, chip and published config

Each row is a replica of the company's own published setup: their pinned stack and flags, the same chip, a run of theirs that matches their published number, interleaved runs, and the same quality gate on both sides. A second seat re-derives every number from the raw output.

LLM servingspeech, time series, imagedashed line = parity (1.0×)
CompanyModel and workloadHardwareOursTheirsQuality gate

Not shown: thin wins under 7% (ggml, Red Hat, Meta, Z.ai, DeepSeek), rows where our side was plain stock vLLM, and the rows where we are behind or tied (Kyutai, MiniMax, LMDeploy, Arm). Against SGLang with its own MTP enabled, the RadixArk margin is 1.29×. Our HF TGI win is in throughput; our p50 first-token time is worse, 177 ms against 105 ms.

Open Flapping Airplanes: train, serve and play Doom in one kernel

We rebuilt the Flapping Airplanes megakernel demo from scratch, without their code. It is one persistent CUDA kernel, launched once, whose blocks never exit. Blocks take roles from a static split of the SMs and pull work from ticket counters on the GPU. Training (forward, backward, AdamW) runs inside the kernel. Serving streams text from the weights while they are still training. Real Doom (doomgeneric, compiled to NVPTX) plays at 35 fps beside both.

On Blackwell the GEMMs use tcgen05, TMA and TMEM. The model is a 162.4M-parameter GPT trained for 4,000 steps of 4,096 tokens, reaching a final loss of 2.1575.

116 SMs train
24 serve
8
B200, 148 SMs, one launch8 SMs run Doom

Training time and serving speed, B200

Each baseline runs alone, under CUDA MPS, on the same SM share it would get in the split.

BuildTrain (116 SMs)Serve tok/s (24 SMs)
Ours, ofa_tc348.1 s1,660
Ours, ofa_tc252.4 s1,741
PyTorch + flash attention, 1 CUDA graph per step50.9 s
Megatron-core + TE, eager62.4 s
Megatron-core + TE, CUDA graphs (beats us)43.1 s
vLLM 0.33.0, 16 reserved CPU cores1,537
vLLM 0.33.0, no reserved cores684

The same work done three ways

  • Sequential Megatron (graphs), then vLLM: about 102 s
  • Both side by side: about 59 s (estimated)
  • One megakernel: 52.4 s (measured), in 3 launches against 15.2M kernels for the baselines

Our A100 build trains in 190.7 s against 233.2 s for Megatron + TE (1.22×). The B300 run took 49.9 s split, ran 1.12× faster than PyTorch eager and cost $3.75 of GPU time. The tcgen05 GEMMs reach 0.30 to 0.92 of cuBLAS, and tcgen05 forces one CTA per SM, which slows decode. Flapping Airplanes never published their model or data, so we train on TinyStories.

MVM turns the megakernel into a general executor

MVM (Magni VM) is the general version of the megakernel. A frontend compiles a model (GPT, Llama with GQA, MoE, ViT, MLP) into a graph of tasks. One persistent executor kernel admits that graph and schedules it with ready rings, version variables and a per-workload scheduler. Training, serving and other jobs share SMs with no kernel boundaries.

The demo runs a 162M GPT, live serving and 700 Doom frames in one launch: 392,630 tasks in 5.2 s of kernel time in bf16. All 700 frames are byte-identical to the CPU engine.

It scales out without NCCL. Data-parallel training on 2 GPUs runs 1.76× faster than on one, with state bitwise equal to the single-GPU run. NVLink peer stores reach 48.3 and 39.2 GB/s. Plans stay bitwise equal across two hosts on different continents over TCP.

Against PyTorch's best mode, one A100-SXM4-40GB

WorkloadSpeedup
9 small training jobs, geomean2.35×
Best job: 8 MLPs of different widths4.05×
Same 9 jobs vs PyTorch 2.11 CUDA graphs2.00×
GPT 355M, TF321.10×
GPT 162M, TF321.07×
GPT 162M, BF160.86×
Qwen3-8B-shape decode, 1 / 8 users0.97× / 0.89×

Where it falls short: matmul runs at 0.5 to 0.7× cuBLAS. The combined train + serve + Doom demo is about 6× slower per step than PyTorch bf16 eager. Only A100 paths exist so far, and RDMA has not run on a real NIC.

Our decode megakernel beats the published ones at batch 1

Llama-1B, batch size 1, one H100. We measured every system ourselves on the same chip, from 256 to 16K output tokens. At 256 output tokens ours decodes at 1,092.1 tok/s against 928.0 for Hazy's megakernel.

These rows are measured, but they have not yet been through the second-seat check used for the company table above.

AgainstOur speedup, OSL 256 to 16K
Hazy megakernel1.12× to 4.2×
Mirage MPK1.66× to 3.6×
VDCores1.42× to 14.6×

tritrun runs Ternary-Bonsai-2.5-27B up to 1.34× faster than your llama.cpp fork

tritrun is a standalone CUDA engine we wrote for Ternary-Bonsai-2.5-27B in its PTQ1_0 GGUF, the whole 27B model in about 6 GB. Each 128-weight block of trits is decoded once and dotted with the int8 activations of every token in the step, so one read of the weights serves all the MTP drafts: a 4-token step costs 1.15× (L4) to 1.4× (T4) a 1-token step. A step is about 640 launches replayed as one CUDA graph, and prefill runs on INT8 tensor cores.

The baseline is your fork (prism-b12178-03ec600) at the best setting we found for it, in the same container and on the same GPU, with the same prompt token ids. Decode figures are the better of 2 repetitions of 4 prompts, greedy, 200 new tokens.

Decode tok/sFork, plaintritrunFork, 3 MTP draftstritrun
T433.135.646.860.1 (+28%)
L436.038.863.773.7 (+16%)
A1061.666.499.5112.7 (+13%)
RTX 5090161.8179.3241.4323.6 (+34%)

Without drafts the gain is 8% to 11%. With MTP on, tritrun uses 5% to 7% less VRAM. Prefill is faster at 64 and 512 tokens on every card (+39% at 512 on the RTX 5090) and level at 2,048 on A10. Quality matches the fork within its own run-to-run spread: WikiText-2 perplexity 9.71 on both, median KL 9e-5, MMLU 778 vs 777 of 1,000, and plain and speculative outputs bit-identical. Each card was measured on one machine; machines of the same type differ by several percent. Not yet tested: H100, B200 and contexts over 2,048 tokens.

We have also measured, repacked and recompressed Bonsai models

Bonsai-8B, 1-bit, measured on one L4

We ran Bonsai-8B through your Q1_0 llama.cpp kernels (PrismML-Eng/llama.cpp) against Qwen3-8B at bf16 and Q4_K_M on the same L4. The kernels are yours; the measurements are ours.

Decode tok/sBonsai Q1_0Qwen3-8B bf16Q4_K_M
Batch 1168.1116.9449.54
32 concurrent, aggregate904.02360.16
CPU only8.572.91

Bonsai at batch 1 runs at 65% of its 259 tok/s memory-bandwidth bound; bf16 reaches 93% of its own. That gap is headroom we think a better 1-bit decode kernel can close.

Repacking Bonsai-8B and Ternary-Bonsai-2-27B

  • Bonsai-8B, repacked losslessly as sign bits plus fp16 group scales, takes 1,172,851,508 bytes including our edit, 7.16% of Qwen3-8B fp16 (the 1-bit compression is yours). Greedy outputs match the release token for token. A closed-form edit of existing group scales taught it a new routing label at .909 accuracy and kept every one of 2,489 base-correct answers.
  • Ternary-Bonsai-2-27B, recompressed with trits, coded scales and a trimmed vocabulary, fits in 5,350,214,867 bytes, 9.94% of fp16. It kept 2,653 of 2,653 base-correct answers (Wilson lower bound 99.86%). Today it unpacks to bf16 at load, so there is no ternary kernel behind it yet.

Ternary GEMV kernels, research

On a 20480 × 5120 batch-1 GEMV (RTX 2080 Ti), our 2-bit ternary kernel runs in 50.5 µs, 3.67× faster than int8 dp4a. A separate lossless bf16 exponent-plane format sped Qwen3-8B decode up by 1.287× with bit-exact weights. These kernels ran on synthetic ternary weights, not on Bonsai.

The routing tests are our own and are easy tasks. On a harder dev set, Bonsai-8B keeps 92.5% to 92.8% of bf16 Qwen3-8B accuracy.

How far we have pushed single models

ModelHardwareResultAgainst
DeepSeek-V4.1-Flash1× B300304.9 tok/s single-stream decode (n=27 over 9 boots, 287.0 to 316.6)Stock vLLM 39.1 tok/s (7.7×); GSM8K 247-249 / 250 vs 248
Qwen3-30B-A3B, 32K to 128K context1× MI300XDecode 44× faster at 128K; first token 42% to 57% soonerStock stack, same quality
Qwen3-30B-A3B1× B200P99 TTFT 18.1 msSGLang 32.5 ms (1.80×)
Qwen3-30B-A3B1× H100P99 TTFT 1.78× betterSGLang; 6.26× vs vLLM 0.34
gpt-oss-120b, 256 concurrent1× MI300X6,733.7 tok/svLLM's own AMD setup 4,078.1 (+65.1%)

On DeepSeek-V4.1-Flash, another published single-B300 result reaches 425 tok/s; we are at 0.72× of it and still working.

A number counts only if a replica of the other side reproduces theirs

  • Both sides run the other company's own pinned stack and config on the same chip.
  • Their side first reproduces their published number (Together's INT4 setup came within 0.4% of its published 568 tok/s).
  • Runs are interleaved A-B-B-A, at least three repeats each.
  • Both sides pass the same quality gate (GSM8K, schema validity or byte-identical output).
  • A second agent re-derives every number from the raw output before it is called a win.

Why this matters for 1-bit models

tritrun took Ternary-Bonsai-2.5-27B up to 1.34× past your own fork within days of its release, and Bonsai-8B's 1-bit decode still reaches only 65% of its bandwidth bound on an L4, against 93% for bf16. Gaps like that are what we close: persistent kernels that never return to the host, ternary GEMV, schedulers that keep every SM busy, and a measurement rule that holds up against the strongest baseline. We would like to apply this to Bonsai serving on your target hardware.