Back to deep dives

Baseten on the inference frontier: 200,000-token routing, 4–6× speedups, and self-optimizing AI

  • AI Engineering, Software, And Developer Tooling
  • Open Models
  • AI Infrastructure, Compute, Chips, And Energy
Thumbnail for Baseten on the inference frontier: 200,000-token routing, 4–6× speedups, and self-optimizing AI
Image: The Inference Frontier: 10x Faster Models to Self-Optimizing AI — Philip Kiely & Ali Taha, Baseten

Audio deep dive

Listen to this deep dive

Spotify

IntroductionSection 01

This Latent Space podcast interview has host swyx asking Baseten’s Philip Kiely and Ali Taha how inference turns an open model into a product: request routing, quantization, GPU kernels, model parallelism, and AI video. It gets properly weird near the end, when GLM-5.2 helps rewrite its own serving code and continual learning starts to blur the line between training and inference.

A 200,000-token request is routed by cached context, then split across prefill and decodeSource3:06

where we're going to see we probably have a number of instances, a number of replicas up serving whatever model you're hitting. uh we want to send this one to something with number one available prefill workers and number two ideally some cached input already there so that we can skip prefill on at least part of these 200,000 tokens. Um if you're doing 200,000 tokens it's probably coding or a multi-turn agent or something where you would expect to have that cached. Um if you don't we're going to have to send it to a prefill worker. Um we've at least on certain models disagregated prefill and decode. Um, so you're going to have one set of GPUs that's solely going to process the input, create that KV cache, and get you your first token, and then that's going

A long request goes to an available prefill worker and, when possible, a replica that already holds some of its context. Separate decode workers can then generate and stream the response.

  • A workload-specific speculative model drafts tokens for the main model to accept or reject, raising decode speed when acceptance is high.
  • Dedicated deployments give high-volume users more control over reliability, precision, batching, parallelism and traffic-specific speculation.
  • Post-training and quantization must preserve valid tool-call JSON; bad training examples can make a model invent the result.
  • Baseten uses a state machine or grammar to force the required output format, but the model can still call the wrong tool.

Serving a new open model requires architecture work, behavior testing, and production debuggingSource23:48

>> Yeah. and it's and it's only temperature zero or >> even other.9 or whatever it will still it will still collect weird it's an inference it's an inference problem to be honest it's like a software problem like often times um the image you run like in Nvidia will release an image for instance and if we will upstream the changes from their latest image into our stack we'll find that it it fixes it or often times this will only happen in an inference engine that you're using like silang but if you were to switch to VLM that isn't the case so it seems to be like an extremely like nondeterministic kind of software issue and not really a model issue. It's not like a weights problem. Like people say like, "Oh, it's a problem with the quantity. We did PTQ wrong, right?" But that isn't that doesn't make sense because the same exact weights used with a different inference engine does not repeat this the problem. And sometimes it's um the kernels that are being used in the back

Producing one token from a new open model is easier than serving it through a reliable API. The remaining work spans runtimes, calibration, model retrofits and failures outside the weights.

  • Providers may still need to add architecture support, quantize and calibrate the model, and train a speculator.
  • One engineer joined a Kimi vision encoder to GLM-5.2 by training a small projector while freezing both models.
  • The team replaced an inefficient attention layer and trained the retrofit to recover its speculative-token acceptance rate.
  • Live traffic revealed repeated-token collapse, prompting the endpoint to stop or retry after at least four repetitions.
  • Identical weights can behave differently across inference engines, kernels, hardware and cluster interconnects.

Quantization can preserve quality while stacked optimizations deliver 4–6× speedupsSource32:11

perform better because the quantization errors have canceled out. And so what Joshua showed in his mathematical proof where he had like a verifier in is that you can predict which layers are going to have quantization errors that will cancel out with each other and you choose to quantize those layers. And so the result of doing this mathematical quantization is you end up with a model that's 20% more quantized than another provider. So you get 20% more throughput of it because there's more layers that running in NBF4 and your quality is better than that other quant because the layers that you chose to quantize have their errors cancel out. like one layer screw to the right, one layer screw to the left, one layer screw to the right, your final logistribution of the model, so you have better fidelity. And so the way we proved this was with kale diversion. So instead of just scoring on the benchmarks, we scored the kale diversions between the logic distribution of the quantized

Quantization trades precision for speed, so the practical goal is to keep the optimized model close to the original. Several optimizations can produce 4–6× gains; 10× needs aggressive assumptions.

  • Baseten wants users to be unable to distinguish its optimized API from the model maker’s API.
  • For image models, the team avoids quantizing modulation layers and output projections because both directly affect results.
  • Choosing layers whose errors cancel reportedly enabled 20% more quantization and 20% more throughput than another provider.
  • Speed comparisons change with hardware, load, prompt shape, response length and the chosen latency or throughput measure.
  • With hardware and GPU count fixed, the speakers put combined optimization gains nearer 2–4×.

Dynamo coordinates cluster state, while local and data-centre inference optimize for opposite limitsSource48:21

versus inference engineering for local AI is that we start with fundamentally like different constraints and different goals. With local AI, it's how do I fit this model onto my hardware and then make it less dumb? And with data center inference, it's how do I load this model and then make it less slow. And obviously, you know, we care about less dumb and they care about less slow. But the local AI inference engineering ecosystem, I think, actually has a lot for us to learn from in the data center space. They are experts in various forms of quantization, including dynamic quantization that we just kind of don't touch in the pruning, in the distillation, in the uh, you know, layer removal. There's

NVIDIA Dynamo coordinates state such as KV caches across inference hardware; installing it does not automatically make a model faster. Local and data-centre systems also start from different limits.

  • Dynamo spans frameworks and hardware, moves cluster state and offers replaceable defaults, but deployment choices determine its value.
  • Users can often reuse published quantized checkpoints and speculative decoders instead of building their own.
  • Running a small speculative model beside the main model consumes shared hardware, and each extra recursive speculator adds more work.
  • Local techniques can help data centres, but an optimization for laptop memory may slow a B200 when kernel overhead outweighs bandwidth savings.

Parallelism trades communication against memory, while kernel performance requires empirical tuningSource55:59

though? >> Uh I don't know what the >> training for training >> like deciding which GPU which GP >> yeah how to >> yeah yeah they they do and with training it's more of like a math like you can run the math and see the flops and maximize it. with inference it's more of like an autotuning like GPU current auto tuning but like it's it's basically like you you define that oh I have two GPUs I can do TP1 TP2 EP1 EP2 for instance right and you so that that gives you like total like two square combinations and then you just like you shadow the same traffic like real world traffic and you just see which configuration gives you the best TPM TPS and you just use that I don't like the fact that it's you cannot reason about which one's going to give you the best performance or that there isn't one specific configuration that's always best but It seems like autotuning is just the way that you find the best one. And with kernels and GPU

Model parallelism trades memory capacity against communication, latency and throughput. Production teams must test configurations and kernels against real traffic instead of trusting a universal optimum.

  • Tensor parallelism shards each step across GPUs, needs a fast interconnect and usually targets lower latency.
  • Expert parallelism keeps experts whole and replicates the small router, reducing communication and potentially raising throughput.
  • Pipeline parallelism splits layers across hardware and is mainly needed when one node cannot hold the model.
  • The speakers recommend shadowing real traffic and sweeping kernel parameters to find the best measured setup.
  • A fused mega kernel still cannot remove cross-GPU communication and may lose to easier-to-tune modular kernels.

Rubin makes inference a rack-scale problem, while giant models consume its memory headroomSource1:11:19

[how big the comparison is, but like uh it is a it is a very like real estate allocation difference. >> Few few dozen I would say. >> Few doz. >> Before we move from hardware, I have two quick questions. One, the latest Kimmy which is really big uh 3 trillion doesn't fit on most hardware on single node. Yes. you you you need you need GB300 to visit on a single >> ord [laughter] it's simple math um NVFP4 2.8 trillion parameters uh 1.4 4 terabytes. Um the GB300's have uh 288 GB each. Um so eight across eight of those. Um you have enough room for the model. And honestly like so the other thing with with GPU](https://www.youtube.com/watch?v=7PSXtru6mmY&t=4279s)

Rubin systems must move KV caches and data across CPUs and GPUs, not merely run fast kernels. A 2.8-trillion-parameter example shows how quickly model weights consume rack memory.

  • More low-precision compute and bandwidth make cache offloading, cache-aware routing and disaggregation more important.
  • The speakers said AI-specific GPUs may reduce the need for ASICs, though they disagree and cannot yet predict which hardware will win.
  • They estimate that 2.8 trillion NVFP4 parameters occupy about 1.4 terabytes, while each GB300 has 288 GB.
  • Eight GB300s can hold those weights, but long-context KV caches reduce the remaining headroom.

Long-form AI video may need autoregressive sequencing with diffusion-style refinementSource1:16:47

tokens. Yeah. >> Which means that for attention for just 5 seconds, you're running attention on 35,000 tokens, right? So the attention becomes such a huge bottleneck and because it's open squared if you're doing like if you extend that to like 10 seconds well it's just square 20 seconds 30 seconds. So to generate a good cut scene of like 1 minute it's almost impossible to do within the same compute time and it's just it's becomes unfeasible you can't do it and so you end up with moving towards two direction either you decide to do attention on the entire video at once in which case you are forced to do sports attention. So if you scroll back down to the original the the video image like you can see whereas on the left for instance I would be doing full attention where every single token in that sport at 200 scene attends to every single other token as you can see the sheer number of like red patches on the right I'm only attending to each token only

Long video faces quadratic attention costs and consistency drift as visual tokens accumulate. Autoregressive generation could extend and stream output, perhaps paired with diffusion-style refinement, but today’s open systems remain weak.

  • Media companies still choose stronger closed video models even when optimized open inference could cost much less.
  • Five seconds of 480p video at 16 frames per second can yield about 35,000 latent tokens.
  • Autoregressive video could generate images sequentially and reuse language-model optimizations, but current open results are worse.
  • Extending a clip from its final image can darken or degrade it, while autoregression cannot revisit earlier images.
  • The proposed autoregressive and diffusion combination is a qualified possibility, not an established design.

Training and inference are converging as GLM-5.2 rewrites the kernels used to serve itselfSource1:33:41

it will do a forward pass on the JM52 instance of the you know the node and then it will get the profile trace and it will analyze it and it will find the kernels that are the bottlenecks in Slang and then it will write the new kernels and it will do another profiling trace and when it's done it uploads the image to our thing and then we can pull that image down and repeat the cycle and so for quite a bit of time we had like literally GLM52 GM2 and and like some of the GPU kernels that were on JLM52 within our inference engine is written by GLM52 >> and the trace and the kernels were guided by J52 as the driver. So it seems like I do see I do see that that circle being there. I think a bit more time is needed. There's definitely a lot of things that they can't do. The models just aren't there yet even though

Training and inference increasingly depend on each other through faster rollouts, quantization-aware post-training and production feedback. GLM-5.2 has already profiled its serving path and rewritten bottleneck kernels, though serious limits remain.

  • Slow inference can bottleneck training, while low-precision models may need post-training or distillation to recover quality.
  • The speakers expect production traces to feed continual post-training, testing and product improvement.
  • GLM-5.2 identified SGLang bottlenecks and wrote replacement kernels, but models still show poor judgment and reward hacking.
  • One speaker estimates direct node-to-node KV-cache transfers could approach 100× speedups, while acknowledging major uncertainty.
  • Continual learning might retain updates through compacted KV caches or lightweight adapters instead of repeatedly fetching full weights.

Tags

  • Open Source AI
  • Frontier Models
  • Inference Infrastructure