Kernels tuned for your shapes
A mixture-of-experts model spends much of each decoding step in one kernel: the fused MoE layer. vLLM’s Triton version of that kernel picks its tile settings from a JSON file named after the model’s MoE shape and the GPU. When vLLM ships no file for that pair, it runs a built-in default and says so in its log:Using default MoE config. Performance might be sub-optimal!
InferCrane reads that line, tunes the tile settings for your GPU at the token counts your
traffic’s steps carry, and offers the result as one more setup in an optimization campaign.
The campaign measures it against the same engine untuned, on your traffic, and checks answer
quality before anything is proposed.
In testing. The checks, the campaign candidate and the proof harness are built. No tuned set
has been measured on a GPU yet, so any gain is unknown. The first proof is planned for
Qwen3.6-35B-A3B-FP8 on one H100 (
tools/kernel-tune/rules-qwen36-moe-h100-2026-11-26.md).
Sets are made with the development harness on a disposable GPU; the control plane does not run
tuning jobs itself yet.What the untuned engine logs on an H100 for Qwen3.6-35B-A3B-FP8 (vLLM 0.34.0)
What it delivers
The tuned set is data, not code. It holds the engine’s own file format: for each step size (tokens in one engine step), six tile settings for vLLM’s own reviewed kernel.One entry of a tuned file (values illustrative)
Fallback
vLLM reads the tuned folder first and its own files second, per file: a set for another shape or GPU changes nothing. Inside a file, every step size where tuning did not measure better keeps the engine’s own default. The tuner also adds one key on each side of every step size where the engine’s default changes its tiles, so the nearest key to any step reproduces the default exactly (internal/kerneltuning Keys).
How a set is made
1
Find the gap
Start the endpoint’s engine once, untuned, and read its log: the MoE backend it chose and the
tuned file it looked for and did not find. Another backend, a shipped file, or more than one
missing shape means there is nothing to tune.
2
Plan the step sizes
From the loads the workload runs at: decode steps up to the requests held at once (times one
plus the draft tokens when the setup speculates) and prefill steps up to the engine’s step
budget, plus the keys that keep the default exact.
3
Tune on a disposable GPU of the same type
For each step size, time the engine’s own choice twice, search tile settings from it, and keep
a setting only when it is at least 3% faster and faster by more than twice that step size’s own
spread, its error against an FP32 reference is no worse than the engine’s, and no time is below
what the GPU’s memory bandwidth allows. Then check the file as the engine reads it at step
sizes the search never timed. Kernel timings choose what to measure; they are never reported as
a serving gain.
4
Measure end to end
The campaign serves the starting setup and the same setup with the set, and judges output per
second with its paired comparison. Answers are checked with a task set, because new tile
settings can change the last digits of a result.
Prove a set on your traffic
A proposal adds the setup when the request carries a set:POST /api/v1/optimization/proposals (excerpt)
VLLM_TUNED_CONFIG_FOLDER at it. Other
adapters refuse a revision with a set rather than serve a different one.
Judge a recorded proof
The development harness (tools/kernel-tune) serves both setups in turn on one GPU, restarting
the engine between runs, control first and last, then repeats on a fresh machine. Serving both on
one machine removes the difference between machines, which reached 13% to 18% between H100s
this month, far above a kernel’s likely gain.
A slower p95 first token or time per token is shown as a warning beside the decision.
The verdict carries one technique contract result per load. The
technique requires the evidence
kernel-invocation-proof: for every server start of both
windows, what the engine log said about the fused-MoE kernel. Each tuned start must have read
every tuned file from the mount, and each control start must have reported the engine’s default.
--evidence-dir writes it as kernel-invocation-proof.json, and every result names that file’s
sha256. If any start served something other than its arm, the evidence is missing and no result
is shown. A load the fresh window confirmed also carries that window’s digest as
fresh-machine-confirmation (--evidence-dir writes it as fresh-machine-confirmation.json);
without a fresh window, no load is shown.
Where agent-written kernel code runs
Tuned tile settings are data for a kernel the engine already ships, so they may serve in your own cluster once proven. Code a language model writes (internal/kernelgen) is different:
- It is written as source text only, with no tools, and screened on CPU first (static checks, then the Triton interpreter in a Brezel sandbox).
- Every GPU test runs in a disposable GPU container of InferCrane’s own, one container per evaluation, on the GPU type it targets: no network, no credentials, nothing kept but the result and the content digest of the source. Today that container is on Modal.
- It never runs on a customer’s cluster or next to customer inference until it has passed the hardened evaluator, end-to-end qualification on the customer’s traffic, Release Guard and an explicit promotion. Firecracker sandboxes cannot pass a GPU through, and published agent loops have reset GPUs and taken machines out of service, so the boundary is a whole disposable GPU, not a process on a shared one.
Agent-written kernels on vLLM 0.34
The residual-RMSNorm pack’s serving integration for vLLM 0.22.1 goes through vLLM IR, whose operator-priority setting vLLM 0.34.0 removed. vLLM 0.34.0 keepsCustomOp.register_oot and
loads vllm.general_plugins entry points named in VLLM_PLUGINS, so the pack now also has a
plugin (integration-vllm-0.34) that goes on the serving container’s path instead of a fork.
It replaces RMSNorm, calls the generated kernel only for the shapes it was qualified on, falls
back to the library kernel for every other call, counts both, and leaves a marker on the first
generated call. A candidate enables it with VLLM_PLUGINS=infercrane_kernels and
--compilation-config '{"custom_ops":["+RMSNorm"]}'. It is tested against a stub of vLLM
0.34.0’s API, not yet on a GPU, so the pack still lists vLLM 0.22.1 only, and qualification does
not use the plugin yet.
The rest of the pipeline moved with it:
- Shapes from real traffic. A GPU profile now names each hotspot’s input shapes and dtypes, read from the operator that launched each kernel. Kernels replayed from a CUDA graph have no launching operator, so their shapes stay unknown rather than guessed.
- A harder evaluator. Correctness runs at those shapes and at row counts next to them that a hidden seed picks. Both kernels are timed inside a CUDA graph, the library kernel in place with no copies, each call reading inputs that do not fit in the L2 cache. A time faster than the GPU’s memory allows fails as a timing fault. The generated module runs in the evaluator’s process, so the evaluator records its own files and every function its checks call before the module loads, and any change fails the run.
- The end-to-end gate is unchanged: control, candidate, control on the same GPU with your traffic, the invocation proof, then Release Guard.
Next
- Optimization campaigns: how candidates are measured and proposed.
- GPU profiling: whether the MoE layer is where the GPU’s time goes.