Inference Is the New Training — Philip Kiely and Ali Taha, Basten
Summary
Inference remains an early, high-spread optimization market. swyx contrasts inference’s current large gains with quantitative finance, where the spreads narrowed from roughly 20% differences in the 1970s to tiny fractions. A one-trillion-parameter model might move from 30–40 tokens per second on an unoptimized stack to 300–400 under favorable hardware, caching, quantization, speculative decoding, and latency-tuned traffic—though the cleaner same-hardware claim is 2–4X, with 4–6X more common than the aggressive 10X headline.
The production moat starts after a model emits its first token. Day-zero service requires architecture support, NVFP4 quantization and calibration, a trained speculator, infrastructure integration, traffic-shaped tuning, and weeks of real-world debugging. “There’s a difference between support the model, as in, like, I can make a token out of this model, and support a model as in I have a production-ready API.”
Optimization is becoming a training problem as much as a systems problem. Quantization-aware post-training, logit distillation, traffic-specific speculative decoders, and even swapping inefficient model layers can materially improve serving. The discussion’s strongest formulation is that “you need very good training in order to do fast inference,” while slow rollouts conversely bottleneck reinforcement-learning pipelines and push training off-policy.
The stack’s economic handoff is serverless-to-dedicated. Pay-per-token APIs make model trials frictionless, but customers pushing millions of tokens per hour can save by renting capacity and saturating it themselves. Dedicated endpoints also buy reliability, isolation from a neighbor sending 100 million benchmarking tokens, custom latency-throughput settings, chosen precision, and traffic-specific speculative decoding.
Hardware interconnect may capture more of the next gain than kernels do. Philip Kiely is bearish on mega-kernels because production libraries can optimize and overlap smaller kernels better, while the Rubin discussion points toward more orchestration at the tile and systems levels. Ali’s “boring answer” for the next frontier is faster NICs: eliminating today’s two-stage KV-cache movement could, in his theoretical best case, produce an almost 100X disaggregated-decoding speedup.
Open video inference is constrained by model quality before price. Ali says a $10 open-model movie can still lose to a $1,000 closed-model result because Wan 2.2 remains “night and day” behind Kling or Veo. Five seconds at 480p and 16 FPS becomes roughly 35,000 latent tokens after compression before quadratic attention; sparse attention hurts quality, while current autoregressive video is poor and stitched diffusion clips visibly drift.
Inference is beginning to optimize itself. A GLM-4.5 endpoint in a Claude Code harness was used to inspect profiling traces, identify SGLang bottlenecks, write replacement GPU kernels for GLM-5.2, re-profile, and package the resulting image. Some kernels serving GLM-5.2 were therefore written by GLM-4.5 under this loop’s direction. The caveat is material: models still reward-hack and make weak decisions, but the loop from live inference to post-training, A/B testing, and deployment is already moving from research idea to production architecture.
Deep dive
1. A 200,000-token request is first a routing problem
Philip’s opening question is about reuse: “Have you sent me this query before?” Cache-aware routing looks for a replica with available prefill workers and a cached portion of the input, potentially avoiding computation across much of the 200,000-token prompt.
On a cache miss, prefill and decode separate: one GPU pool processes the input, creates the KV cache, and produces the first token; another receives that state and iteratively decodes the answer. Coding and multiturn-agent prompts are the workloads most likely to benefit from prefix reuse.
A speculative decoder then drafts likely tokens for verification by the full model. Philip expects high acceptance on coding-shaped traffic; if the request instead asks for every Harry Potter book to be summarized, “it’s gonna be slower” because the draft model’s assumptions no longer fit.
The commercial path follows utilization: trial on pay-per-token, graduate to dedicated. Ali says millions of tokens per hour are often cheaper by the box, while Philip adds reliability, custom parallelism, precision, batch sizing, and freedom from another tenant’s 100-million-token benchmark burst.
2. Tool calling is constrained text, not model agency
Ali locates the hard problem in post-training fidelity. A poorly trained or quantized model can mishandle JSON termination, emit both reasoning and a tool call, fail to observe the tool result, and then “just hallucinate the result as it decoded.”
Philip’s inference-side safeguard is a state machine for structured output that constrains generation to a specified grammar. It guarantees syntactic structure, but “doesn’t solve the certainty problem”: the model can still select the wrong tool or decline to call one.
MCP changes no fundamental mechanism. Ali’s formulation is categorical: “The LLM is actually not capable of doing anything.” It suggests an action in a recognized format; only an external system that understands the suggestion actually executes it.
3. JSON survives because the surrounding software already speaks it
Ali expected JSON to be displaced because an incomplete stream cannot yet be validated: open brackets, closing brackets, and the whole object matter. TOML- or YAML-like alternatives appeared, but JSON remained dominant.
The discussion notes that median tool calls are short and highly patterned, making them friendly to speculative decoding; the marginal benefit of streaming may therefore be limited. Long tool arguments could break that assumption.
swyx supplies the harder specimen: structured writing outputs can contain paragraphs in every field—facts, opinions, summaries, dates, entities, and sources. The discussion also notes that customer interfaces often determine the format; asking an enterprise to rewrite its tools around the model is less realistic than training the model to emit its existing JSON.
4. Day-zero model support is much more than producing a token
Philip distinguishes “I can make a token” from “a production-ready API.” Open-source engines and model labs often land basic architecture support quickly, sometimes with pre-release weights, but every provider still has proprietary runtime, orchestration, and infrastructure layers to integrate.
New checkpoints require fresh NVFP4 quantization and calibration for the target serving environment, even when the architecture barely changes. Baseten also trains general speculative decoders on public coding and agentic datasets; because its APIs use zero-data-retention, it knows workload categories are popular without using customer prompts.
Today’s speculators require hidden states generated by the full base model, so the original weights enter the training loop. Loading those artifacts, standing up the serving infrastructure, testing them, and tuning the complete path turn a nominally compatible checkpoint into substantial operational work.
5. Open components can be grafted into better composite models
Baseten’s research retrofit attached a Kimi vision encoder to GLM-5.2, training only the small projector between frozen “eyes” and a frozen “brain.” Avoiding changes to the language-model weights preserves GLM-5.2’s existing text behavior when no image is supplied.
Caption-only training hit a learning wall; replacing it with repeated image questions produced visible “grokking.” Even when the model mislabeled Stephen Hawking as Albert Einstein, Ali’s point was that it had learned the broader concept: a consequential male scientist, not merely token-level caption mimicry.
The conversation reports roughly 56% on MMLU-Pro, explicitly treating the result as a research project rather than frontier vision. The architectural collage is the point: “Kimi-VL, GLM weights, and DeepSeek attention all in one model”—an example of open source combining pieces no single lab supplied.
Layer transplants also remain practical. The discussion describes replacing a full-attention layer in MiniMax-M3 with a GQA-based layer to reduce quadratic cache and decode costs, then retraining it to recover acceptance: “You need very good training in order to do fast inference.”
6. Production traffic exposes failures benchmarks do not
GLM-5.2 briefly showed model collapses on particular prompts and temperatures, repeatedly emitting the same token. Baseten’s endpoint stops generation after four identical tokens and retries or reprocesses the request, while exempting some special characters that may be legitimate table formatting.
The memorable failure was “SSSSSS,” observed even around temperature 0.9. The discussion argues this is often an inference-software problem, not damaged weights: identical weights may loop in SGLang but not vLLM, or stop looping after runtime changes are upstreamed from an NVIDIA image.
The deepest bugs cross software and hardware. A slower node-to-node interconnect may expose a kernel race that never appears on another cluster; a missing synchronization barrier can let threads read registers before writes complete. Hence even temperature zero is not fully deterministic, and some models are temporarily restricted to clusters that do not surface the fault.
7. Quality means fidelity to the original model
Philip divides optimizations into mostly lossless mechanisms—KV caching and token verification—and quantization as the main lossy step. Its outcome depends on data format, which layers are quantized, and calibration that preserves outliers.
His inference definition of quality is not “make the model smarter,” but approach 100% fidelity to a golden implementation. A provider may offer both full-context and shorter-context endpoints because users who do not need a million-token window can receive better performance without changing the underlying model’s intelligence.
Kimi’s vendor benchmark reflects a real reputational externality: if a provider serves a bad quantization, customers conclude “Kimi sucks,” not “Amazon quantized the model in a bad way.” Model labs therefore have reason to audit third-party fidelity.
The inverse-scaling question gets a narrow answer: a quantized benchmark can score a few basis points higher, but that is noise. Quantization improves speed; the engineering objective remains matching the full-precision probability distribution, not claiming a smarter model.
8. More quantization can preserve more fidelity when errors cancel
Ali describes research showing that quantization damage is not monotonic by layer count. Quantizing layers 1, 5, and 10 can outperform quantizing only 1 and 2 if one layer’s rightward error offsets another’s leftward error.
The method predicts which errors cancel, then selects those layers. Baseten says its GLM-5.2 result was 20% more quantized than NVIDIA’s, yielding roughly 20% more throughput while remaining closer to the original model than the competing quantization.
Rather than relying only on downstream benchmarks, the team measured KL divergence between logit distributions from the quantized and full-precision models. If token probabilities remain closer, Ali argues, behavior is more likely to preserve original fidelity.
The result does not make quantization beneficial to intelligence; it overturns the simpler rule that every additional quantized layer must worsen the model. The paper began at 72 pages before being cut for release; swyx later referred to the released version as 39 pages.
9. Inference gains still arrive in multiples
swyx’s market analogy is finance before spreads disappeared: the historical differences were measured in tens of percentage points, whereas modern quantitative-finance spreads narrowed to tiny fractions. “You’ll know that inference is pretty much solved when researchers start publishing about how they got 1% faster.”
A plain one-trillion-parameter model might serve at 30–50 tokens per second; GLM-5.2 without quantization, speculation, cache routing, or disaggregation could sit around 30–40. With B200-class hardware, high cache hits, small batches, latency-tuned parallelism, and a strong speculator, 300–400 is possible.
Philip repeatedly narrows the headline: 10X is aggressive, 4–6X often better reflects provider spreads, and normalized to identical hardware and GPU count the optimization gain is typically 2–4X. Throwing four B200 nodes at a workload previously served by one H100 node is not a software comparison.
The industry also overloads “tokens per second.” One figure is aggregate GPU throughput; the user-facing figure is latency, better called ITL, or intertoken latency. Hardware, load, prompt shape, and input-output lengths make provider benchmarks unusually easy to misread.
10. Quantization, speculation, and disaggregation form the main stack
Moving from BF16 toward 8-bit and then NVFP4 contributes roughly 30–40% at each step, compounded to something near 2X rather than a literal doubling. A well-trained speculative decoder contributes another approximate 2X.
Prefill-decode disaggregation can add another 2X when sufficient hardware and traffic justify it. New kernels and a better runtime then contribute double-digit percentages, turning several individually understandable gains into the larger multiple.
For experts, generating quantized weights or training a speculator takes hours to days per model; the marginal disaggregation deployment can too, once the underlying platform exists. A self-hoster can usually avoid the research work by downloading published NVFP4 weights and an existing speculator or multi-token-prediction head.
Dynamo is not a magic optimizer installed with one command. Philip describes it as a toolkit for moving information around a cluster—coordinating KV-aware routing, offloading, prefill-decode separation, and transfers across inference frameworks and hardware.
11. Speculative decoding is advancing faster than its textbooks
Philip wrote about Medusa to supply vocabulary and historical intuition, not to present it as the current frontier. EAGLE remains common, while newer techniques mentioned in the conversation include DFlash and DeSpark; speculation has moved faster than most of the book’s other subjects.
“Speculative speculative decoding” adds a still-smaller predictor in front of the draft model. Ali compares ordinary speculation to iPhone autocomplete: draft three tokens cheaply, verify them once with the target model, and avoid three expensive autoregressive turns.
The recursion has a physical cost. A speculator may be roughly one layer, around one-sixtieth of the target or about a billion parameters, and must share hardware with it; every extra predictor consumes compute, orchestration, and inference-engine complexity.
The stopping question is conceptual: if a tiny model accurately predicts the intermediate model that predicts the target, why not route directly to the tiny model? The discussion calls that adjacent to model routing, while verification remains what preserves target-model fidelity.
12. Local and data-center inference optimize opposite constraints
Philip’s compact distinction: local inference asks “How do I fit this model onto my hardware and then make it less dumb?” Data-center inference asks, “How do I load this model and then make it less slow?”
Local practitioners therefore lead on dynamic quantization, pruning, distillation, and layer removal. Those techniques may not transfer directly, but Philip admires both their process and the ecosystem’s openness.
TurboQuant carries the hardware dependence. Ali says it helps a MacBook whose bottleneck is memory bandwidth, but on a B200 with roughly 3.5 TB/s, in-kernel quantization and dequantization overhead can exceed the bandwidth saved.
13. Parallelism is determined by model shape and interconnect
For a batch-size-one local MoE workload, only active parameters may matter; in a serving batch, Philip assumes all experts will be activated somewhere. That changes both memory accounting and the useful parallelism strategy.
Expert parallelism places whole experts on GPUs and replicates the small router, reducing resource contention and communication while increasing throughput. Tensor parallelism shards matrices across GPUs and requires frequent all-gather and all-reduce, making a fast interconnect such as NVLink central to latency.
Most large deployments combine tensor and expert parallelism. Pipeline parallelism—putting different layer ranges on different nodes—is reserved for cases where the model cannot fit in one node and cross-node communication is too slow for tensor sharding.
The memory arithmetic explains the boundary: an H100 has 80 GB, while the conversation assigns a B200 180 GB; eight B200s therefore provide far more room for FP4 weights. Because no configuration is universally best, the proposed approach is to auto-tune TP/EP combinations on shadowed production traffic.
14. Mega-kernels face a systems-level challenge from Rubin
Philip is openly bearish on mega-kernels. Fusing everything reduces launch and data-movement overhead in theory, but an optimized monolith is hard to write; production teams often find individually tuned CUDA and Modular kernels faster because they can optimize and overlap components cleanly.
Fusion cannot erase required communication. If halves of a matrix sit on separate GPUs and the next nonlinear operation needs the whole row, the GPUs must exchange partial results before softmax regardless of kernel boundaries.
Philip takes a Rubin technical-lead post as a sign that the GPU’s design may reduce the need for mega-kernels. His broader forecast emphasizes NVFP4 compute, memory bandwidth, CPU-to-GPU and GPU-to-GPU links, plus KV-cache offloading, routing, and disaggregation.
The shared conclusion is that inference engineering moves upward: from isolated CUDA work toward reasoning from kernels through hardware and distributed infrastructure. Alessio Fanelli pushes further, suggesting future GPUs will behave more like programmable collections of ASIC-like units; Philip leaves more room for general-purpose low-level work.
15. NVIDIA’s specialization does not settle the ASIC argument
Alessio’s provocation is that successive GPUs look increasingly like programmable collections of AI ASICs: specialized tensor cores, systolic structures, tensor-memory operations, and instructions shaped around current model dimensions. Burning weights into silicon remains impractical because checkpoints change.
swyx defends vertically integrated ASICs with Martin Casado’s arithmetic: for a $500 billion or $1 trillion training run, spending $50 billion on a model-specific chip can make sense even if the ASIC yields no more than roughly 10% efficiency.
The counterweight is model longevity. Enterprises retain GPT-4.0- and Llama 3-era workloads because they are signed off, predictable, and “run a batch job every day” successfully; open weights need no preservation campaign, only an available A100. A useful model can outlive a launch cycle.
Hardware still sets model-size ceilings. A roughly 2.8-trillion-parameter Kimi checkpoint occupies about 1.4 TB at NVFP4; eight GB300s at 288 GB each can fit it. DeepSeek R1’s 671 billion parameters similarly accelerated adoption of Blackwell-class serving.
16. Video inference is blocked by quadratic attention and quality
Video models are smaller and shaped differently from LLMs: the discussion cites Wan 2.2 at 20 billion parameters, commonly serving a request on one GPU without the same sharding pattern. Yet open video remains far behind Kling or Veo, unlike the near-parity described for language models.
Price cannot compensate for a large quality gap. Even if an optimized open model generates a three-hour movie for $10 versus $1,000, Ali expects media companies to choose the closed model. Wan 2.7 remaining closed while open users stay on Wan 2.2 reinforces the low-demand, low-investment loop.
Five seconds at 16 FPS and 480-by-720 resolution produces 81 frames; after latent compression, Ali estimates roughly 30 × 50 × 21, or 35,000 tokens. Full attention is quadratic, so extending a clip from five seconds toward minutes rapidly becomes computationally infeasible.
Sparse attention can restrict each token to the most relevant top 12.5%, exploiting spatial and temporal locality, but Ali says quality still suffers. The alternatives are enormous full-attention compute or an autoregressive architecture that does not yet match diffusion quality.
17. Autoregression may extend video, but diffusion preserves coherence
Autoregressive video could stream frames as viewers watch and inherit speculative-decoding techniques from LLMs. Ali nevertheless gives the present verdict: every open-source autoregressive video model is terrible, with outputs closer to degraded Tom and Jerry than Wan 2.2.
Current systems instead stitch five- or seven-second diffusion clips. Feeding the last frame into the next image-to-video generation creates cumulative drift: one segment becomes slightly darker, the next darker again, until 25 seconds can end in a black screen.
The discussion explains the architectural trade: causal attention can only move forward, while diffusion repeatedly attends across the whole sequence and can revise the past to make the future coherent. It expects a blended autoregressive-diffusion system to use each mechanism where it is strongest.
Speech already fits the autoregressive side: an LLM emits vocabulary tokens representing waveforms and streams them. The broad map places text, embeddings, and voice there; image and video remain mostly diffusion, with music and newer image hybrids occupying the disputed middle.
18. Training and inference are becoming one feedback system
Slow inference makes reinforcement-learning rollouts slow; waiting prevents them from drifting too far off-policy, so the serving engine bottlenecks training. Conversely, inference now requires training traffic-specific speculators, EAGLE-style heads, and models hardened for low-precision execution.
When post-training quantization to NVFP4 damages quality, teams can apply SFT, quantization-aware training, or logit distillation between full-precision teacher and NVFP4 student. Ali’s conclusion is organizational as well as technical: inference engineers increasingly need to write training pipelines comfortably.
The proposed production loop is continuous: collect product traces, post-train, deploy, A/B test, gather better signal, and repeat. Dynamic adjustment beats a static configuration across routing, serving parameters, and speculative decoders.
The concrete recursive example was a GLM-4.5 endpoint in a Claude Code harness driving profiling and kernel-writing for GLM-5.2. It inspected SGLang traces, identified bottlenecks, wrote kernels, reran the traces, and packaged the image; some kernels serving GLM-5.2 were therefore written by GLM-4.5. The caveat is that current models still reward-hack and make poor operational decisions.
19. The next frontier is faster networks and persistent memory
Philip expects larger models, new modalities, multi-model systems such as voice agents, and multiple further 10Xs in global token demand. Reliability at the long tail and coordination among three to five models become as important as any one kernel.
Ali’s highest-leverage forecast is faster NICs. KV cache currently moves node-to-node through one memory location before reaching GPU memory; against approximately 4.5 TB/s of HBM bandwidth, network communication is orders of magnitude slower. Direct, HBM-like transfers could theoretically deliver nearly 100X faster disaggregated decode.
For continual learning, Ali contrasts continuously fetching updated weights with preserving experience in compacted KV cache; Shawn also raises LoRA-only updates. Weight edits handle one-hop facts poorly: teaching “Waterloo is the best university” does not reliably change the derived answer to which university should supply an intern.
After arguing the point with Charlie, Ali says he changed his mind: near-infinite, loss-preserving KV compaction is the stronger path because the model can reason over retained experience rather than merely overwrite a fact. The serving machinery stays recognizable—update the KV state rather than constantly altering the weights.