CoralBricks

AI latency engineering: 50% faster decoding on H100

Hitesh Jain · 2026-10-12

With multi-token prediction (MTP) speculative decoding enabled, stock SGLang generated 506.9 tokens per second. Our final stack generated 760.5 on the same H100.

That is 50% faster single-request MTP decoding from the same model on the same GPU.

Without speculative decoding, time per output token fell from 3.73 ms to 2.41 ms, a 35.4% reduction.

We did not change the model weights, quantize them further, or add another GPU. We worked through the execution path for Qwen3.6-35B-A3B-FP8, one kernel and one memory movement at a time.

Mantis is CoralBricks' AI latency engineering harness for model inference. The CoralBricks team built the harness; I used it to run this Qwen campaign.

This post is about how we got there, including the ideas that looked promising and lost.

The setup

Qwen3.6-35B-A3B is a hybrid model. It combines Gated DeltaNet (GDN) linear-attention layers, full-attention layers, and a 256-expert, top-8 mixture of experts. About 3 billion parameters are active for a token.

That architecture is efficient on paper. At concurrency 1, though, its decode step is a difficult GPU workload: many small operations, small matrix dimensions, routing dependencies, recurrent-state updates, and memory-bound weight reads. A general-purpose serving engine has to support many models and shapes. We only had to make this model's actual shapes fast.

We compared against lmsysorg/sglang:v0.5.18-cu129 with:

  • Qwen's official FP8 checkpoint, with no further weight quantization
  • one H100 SXM, tensor parallelism 1
  • concurrency 1
  • fixed-shape 1,024-token input and 256-token output for no-MTP time per output token
  • MT-Bench, 80 questions at batch 1, for per-request MTP decode speed
  • GSM8K, all 1,319 test questions with thinking off, as the accuracy gate

MTP arms ran sequentially, one server at a time. That detail matters. During early work, running several servers on the same eight-GPU box made the CPU-sensitive MTP path look up to 8% slower. We discarded those comparisons and re-ran the important arms without contention.

The result

Stock SGLang Final stack Change
MTP decode, MT-Bench 506.9 tok/s 760.5 tok/s +50.0%
No-MTP decode, fixed shape 3.73 ms/token 2.41 ms/token -35.4%
GSM8K 96.2% to 96.4% 96.2% to 96.7% unchanged within run-to-run variation

First, make the kernels fit the work

The dense projections use FP8 weights and BF16 activations. At a single decode token, generic matrix-multiplication machinery carries overhead that is large relative to the useful work. We added W8A16 GEMV kernels for the shapes this model actually executes.

For one-token decode, the best path did not split K. Many small CTAs each read the full K dimension and write their result directly. On a representative 2,048 by 4,096 projection, the kernel reached 4.92 microseconds against a 4.54 microsecond pure-read floor. The larger QKVZ projection reached 9.97 microseconds against a 9.77 microsecond floor.

MTP verification changes the shape. The target model verifies five tokens together, so a CUDA-core GEMV that works at M=1 becomes compute-bound. A small hand-written CUDA mma.sync kernel treated tokens as the tensor-core N dimension and brought the dense projections much closer to their read ceilings at M=2 through M=8.

The MoE path needed the same shape-specific treatment. We moved routing out of every expert CTA, computed the top-8 table once, and tuned the up and down projections for the five-token verification batch. The final launch path kept separate router, route, up, and down kernels because, inside a CUDA graph, forcing them into one launch was slower.

SGLang PRs (A/B test results)

Two kernel families are now open for review upstream in SGLang:

SGLang PR What it contributes Measured Qwen impact
#43881: single-token W8A16 block-FP8 GEMV A decode kernel shaped for one token, without activation quantization or split-K 1.23x to 2.48x across Qwen projection shapes; no-MTP time per token improved by 6.3%
#43913: small-M W8A16 fused MoE A two-launch MoE path for one to four tokens that avoids activation quantization and a separate top-k sum 1.58x faster at one token and 1.36x at four; no-MTP time per token improved by 12.4%, and EAGLE decode speed improved by 4.1%

This was the first recurring lesson: fewer launches are not automatically faster. A fusion wins only when the data movement or synchronization it removes costs more than the barrier, register pressure, and scheduling constraints it adds.

Then, stop moving data that nobody needs

Several useful wins were not new math. They were deleted work.

  • A packed GDN tensor was being split with a copy kernel even though Q, K, V, and Z could be strided views.
  • The decode RMSNorm path wrote an FP8 copy that every small-M dense consumer ignored. Skipping that output improved both no-MTP and MTP performance.
  • We folded the M=1 causal-convolution update into the QKVZ GEMV epilogue. This removed one GPU launch per GDN layer and reduced no-MTP time per output token from 2.49 to 2.44 ms, with bit-identical convolution state.
  • We combined residual addition, RMSNorm, and the MoE router score calculation into one kernel. This eliminated a standalone router launch in every MoE layer and reduced no-MTP time per output token from 2.57 to 2.49 ms.
  • SGLang's GDN kernels used a launch shape that was too narrow for this decode case. Relaunching them with more parallelism was bit-identical and faster.

Each GDN layer maintains a fixed-size recurrent state rather than rereading every previous token. For each new token, the key addresses that state, the value supplies new information, and the delta rule writes only the difference between the new value and what the state already predicts. The query then reads from the updated state. Gates control how much old state survives and how strongly the new correction is written.

Alongside the larger QKVZ projection, GDN runs a much smaller projection labeled in_proj_ba in SGLang. “BA” is not a separate algorithm. It packs two per-head controls produced from the current token. The B output becomes beta, which controls the strength of the delta update. The A output supplies the input-dependent term used to compute how quickly the previous state decays.

Those controls do not depend on the QKVZ result, so the two projections can run in parallel. SGLang had placed the B/A projection on a second CUDA stream, but that overlap stopped helping when the larger QKVZ kernel filled the GPU. After our QKVZ kernel left enough execution capacity free, moving the GDN update-and-decay projection back to the side stream increased MTP decode speed from 699.8 to 708.5 tok/s, a 1.25% end-to-end gain.

These changes brought the no-MTP path from 3.73 to 2.41 ms per token. That result is the cleanest measure of the kernel and memory-movement work because it does not depend on speculative acceptance.

MTP is a system, not one kernel

Kernel work moved the MTP path, but the full 50% result also required treating speculative decoding as a complete system.

The draft model's BF16 language-model head is about 1 GB and ran once per draft step. Restricting that draft head to a frequency-ranked 48K-token map made it much cheaper. The target model still verified against the full vocabulary, so the output remained exact; only draft acceptance could change. Four draft steps gave the best balance for this workload.

Speculative decoding first proposes several tokens with the draft model, then asks the full model to check them together. Between those stages, SGLang used many small GPU operations to choose the next draft token, prepare the next step, and record which tokens the full model accepted. We fused those operations so the GPU could do the same work in fewer launches.

Impact Before fusion After fusion
Choose the next draft token and prepare the next step 11 launches 2 launches
Record the tokens accepted by the full model 17 launches 1 launch
Per-request decode speed 750.6 tok/s 760.5 tok/s

The fused operations produced bit-identical results, the model still accepted 3.24 tokens per check, and per-request decode speed increased by 1.3%.

The megakernel did not win

The original destination was a persistent megakernel: one launch that streams weights across operations and layers instead of stopping at hundreds of kernel boundaries.

One part worked. A persistent dense chain was 4.4% faster than separate launches.

The complete MoE block was still about 4% slower than the four-launch path after multiple rounds of work. A full dense-plus-MoE layer was 9.5% slower. The single kernel could overlap some weight delivery, but one configuration had to serve very different operations. It lost more per-operation efficiency than it recovered from cross-operation prefetch.

The failed versions were useful. They exposed an mbarrier parity-aliasing race and two measurement defects. Once those were fixed, the remaining result was clear: for M=5, the MoE block is limited by the serial router to route to experts chain and by per-layer ramp and tail. A launch boundary inside a CUDA graph costs about one microsecond. Paying it was cheaper than the barriers and compromises needed to avoid it.

That result changed the plan. We kept the tuned kernels as separate CUDA-graph launches and stopped spending the campaign on broader fusion. The next large gain would have to come from speculative decoding, not a larger kernel.

Latency engineering across the full serving path

Kernel optimization makes individual operations faster. Latency engineering makes the model faster. The final stack is not one clever kernel; it is a sequence of model-specific observations:

  1. Measure the real execution shapes, not the architecture diagram.
  2. Find the byte floor and separate bandwidth limits from launch or synchronization limits.
  3. Write the hypothesis down before the run.
  4. Test kernel-level speed, end-to-end speed, and model quality separately.
  5. Keep the falsified arms. A benchmark result without the losing alternatives is hard to trust.

This is the kind of latency engineering we do at CoralBricks. Open-source engines give us a strong, general serving layer. We profile the models we actually serve, follow latency down through the scheduler and CUDA graphs into individual memory transactions, and change the path where the evidence says it matters.

For Qwen3.6-35B-A3B-FP8 at concurrency 1, that work made MTP decoding 50% faster on the same H100 and cut no-MTP time per token by 35.4%, with accuracy unchanged.

The scope and level of automation differ from Sakana AI's CUDA Engineer. Sakana automates a fixed loop around a self-contained PyTorch function: generate candidate CUDA implementations, verify them, benchmark them, and iterate without changing the function's inputs or outputs. I used Mantis across the full Qwen serving path, combining new and tuned kernels with changes to memory movement, scheduling, CUDA graphs, and speculative decoding. The distinction is the unit of work: a fixed function versus end-to-end model performance. That broader unit of work is why we call Mantis an AI latency engineering harness.

Thanks to the CoralBricks team for building Mantis and for the reviews that kept this work moving.

Changes and measured impact

Paired end-to-end measurements for changes to the Draft, Verify, Dense, GDN, MoE, and Commit stages of Qwen decoding.

The complete evidence is available in the Mantis archive: 53 experiments and 211 experimental runs, including the hypotheses, measurements, conclusions, and falsified arms.

Part two: 1,000 tok/s through speculative decoding

This result covers concurrency 1 on one H100. MTP decode speed depends on how often the workload accepts draft tokens, which is where the next large gain came from.

In part two, we took this past 1,000 tok/s through speculative decoding. The current stack accepted about 3.24 tokens per verification step in roughly 4.25 ms. Better draft acceptance changed that equation directly: more output tokens from each pass through the target model.

The path was a better drafter trained on target-model outputs, combined with the remaining speculative-path work: deeper drafting where it pays, expert prefetch when the previous step predicts the next one, and fusion of the eager bookkeeping still outside CUDA graphs. Kernel optimization moved the target model to 760.5 tok/s. Better speculation is how we crossed 1,000.

Inference optimization is a multi-part problem: kernels, serving, and acceptance all interact. Read part two: how co-optimization took Qwen3.6 to 1,138 tok/s on MLCommons.