# Next 100x in AI: Inference, Networking, & Self-Optimizing Models — Philip Kiely & Ali Taha, Baseten <!-- ref: @content/youtube/latent-space/2026-08-03-next-100x-in-ai-inference-networking-and-self-optimizing-models-philip-kiely-and version: 3 updated_at: 2026-10-31T18:15:12.354Z --> Philip Kiely & Ali Taha (Latent Space, 2026-08-03): Inference is still an immature, high-headroom field: gains are measured in 2x–10x multiples, not basis points, and come from stacking quantization, speculative decoding, disaggregated prefill/decode, and cache-aware routing. **[Watch on YouTube](https://www.youtube.com/watch?v=7PSXtru6mmY)** *Synthesized from Philip Kiely & Ali Taha on Latent Space, 2026-08-03.* Philip Kiely (author of the book *Inference Engineering*) and Ali Taha (inference engineer, known online as "Waterloo intern") work at Baseten, where they serve open-weight LLMs and video models in production. ## Core Thesis Inference is still an immature, high-headroom field: gains are measured in 2x–10x multiples, not basis points, and come from stacking quantization, speculative decoding, disaggregated prefill/decode, and cache-aware routing. Kiely and Taha argue the frontier is shifting from hand-written CUDA kernels toward systems problems — moving KV cache across interconnects and networks — and toward a merged training/inference loop where models even help optimize their own serving stacks. ## Key Insights - **Life of a 200,000-token request (Kiely):** first check for a cached prefix via cache-aware routing to a replica with free prefill capacity and existing KV cache; on supported models, prefill and decode run on separate GPU pools (PD disaggregation); decode is accelerated by a speculator whose acceptance rate is high for coding traffic and lower for unusual workloads (e.g., summarizing Harry Potter). - **When to move from per-token APIs to dedicated deployments:** reliability, isolation from other tenants' benchmarking traffic (Kiely cites someone pushing "a hundred million tokens" at a shared endpoint), custom batch sizing/parallelism for throughput vs. latency, opting out of NVFP4 if it fails your evals, and — per Taha — a speculator trained on *your* traffic, which a shared endpoint can't offer because it doesn't know your workload. - **Speculative decoding explained (Taha):** a small draft model runs ~3 fast autoregressive steps, then one forward pass of the big model verifies and accepts/rejects them. Speculators are roughly 1B parameters — for MiniMax, about one layer, ~1/60 of the target model. Today they must be trained using hidden states from the actual base model, so real weights are required. - **Tool-calling failures are mostly training/quantization problems, not sandboxing:** if post-training or post-training quantization is weak, the model may fail to close a tool-call request correctly and then hallucinate a tool result. On the inference side, Baseten published (~2 years ago) a state-machine approach for structured output that guarantees format but not correct tool choice. - **"Supporting" a new model is real work (Kiely):** getting one token out via vLLM/SGLang is easy because maintainers often get weights early; production readiness means redoing NVFP4 quantization with calibration, training a general speculator on public coding/agentic datasets (Baseten runs zero data retention), and adding runtime support for new architecture pieces (e.g., GLM 5.2's DeepSeek-derived sparse attention, DSA). Kiely's Twitter article on GLM 5.2 speeds drew ~500,000 views and kicked off a provider speed race. - **Frankenmodel engineering:** Baseten engineer Haley grafted Kimi's vision encoder onto text-only GLM 5.2 by training only the projector (a few million parameters) while freezing encoder and LLM. Training on captions alone underperformed; switching to per-image question sets produced visible "grokking." It reached ~56% on an MMLU-style vision benchmark, with zero quality loss for text-only inputs since the encoder is skipped. Taha also describes swapping MiniMax M3's full-attention layer for a GQA layer to shrink KV cache and speed speculation, then retraining to recover acceptance rate. - **Loop detection:** Baseten cuts generation if the same token repeats 4+ times (excluding some special characters like table dashes). Taha says collapse (e.g., repeating "S" on GLM 5.2, also seen on DeepSeek V4) happens even at temperature 0.9 and is usually a software issue — it disappears when switching inference engines or upstreaming a newer TensorRT-LLM image. - **Hardware-dependent race conditions:** one model only collapsed on a cluster whose slower node-to-node interconnect for KV transfer exposed a kernel race (e.g., a missing barrier); the fix was to stop hosting it on that cluster. - **Quality = fidelity to the reference implementation (Kiely):** KV caching and speculation are lossless; quantization is the main lossy step, controlled by data format, which layers are quantized, and calibration to preserve outliers. Shorter-context API variants can also trade context for speed. Kimi's vendor verifier exists because users blame the model, not the provider, for bad quants. - **Quantizing *more* can be better (Taha):** research intern Joshua showed you can predict which layers' quantization errors cancel each other out; quantizing those yields a GLM 5.2 quant ~20% more quantized than Nvidia's (≈20% more throughput) with *better* fidelity, measured by KL divergence of logit distributions rather than benchmark scores. The paper shrank from 72 pages to 39. For image models, Taha avoids quantizing modulation layers and output projections. - **Speedup math (Kiely):** an unoptimized 1T-parameter model runs ~30–50 tokens/sec (30–40 for GLM 5.2 on an off-the-shelf engine). Stacking optimizations can reach 300–400 TPS (10x), though 4–6x is more typical; on identical hardware expect 2–4x. Breakdown: BF16→FP8 ≈30–40%, FP8→FP4 another ≈30–40% (≈2x total); speculator ≈2x; disaggregation ≈2x with enough traffic; newer runtime/kernels add double-digit percent. Each piece is "hours to days" for an expert, though public NVFP4 checkpoints and model-native MTP heads remove most of that work. - **TPS naming is confused:** throughput TPS (total GPU output) differs from per-user latency TPS, which should be called inter-token latency (ITL). - **NVIDIA Dynamo is a toolkit, not a baseline:** it moves KV cache around the cluster (coordinating NIXL) for KV-aware routing, offloading, and PD disaggregation, but `pip install` alone doesn't deliver speedups. - **Parallelism:** expert parallelism places whole experts (e.g., 8 per GPU) on GPUs with a replicated router and needs little interconnect; tensor parallelism shards everything and needs all-gather/all-reduce over NVLink, helping latency; pipeline parallelism is only used when forced into multi-node (e.g., a 1T model on 80 GB H100s). Best configs are found by auto-tuning (sweeping TP/EP combos on shadowed real traffic), not reasoning. - **Memory math:** Kimi at ~2.8T params in NVFP4 ≈ 1.4 TB, fitting on 8× GB300 (288 GB each) — with KV cache competing for the remainder, making KV offloading more important. Most of the world has 8-GPU nodes, not NVL72 racks. - **Local vs. data-center inference (Kiely):** local AI asks "how do I fit it and make it less dumb"; data center asks "how do I make it less slow." Taha notes TurboQuant helps memory-bandwidth-starved MacBooks but is slower on a B100 (~3.5 TB/s), where dequantization overhead outweighs bandwidth savings. - **Mega-kernels skepticism (Taha):** non-linearities like softmax still force cross-GPU communication; teams that build fused mega-kernels often don't ship them because modular TensorRT-LLM kernels are faster, and Rubin's design reportedly reduces their value further. - **GPUs trending toward ASICs:** Taha sees Rubin's tensor cores, TMAs, and tensor memory as shaped around today's model head dimensions. Kiely calls Rubin the first chip fully designed in the open-model-architecture era and predicts KV offloading, KV-aware routing, and disaggregation will dominate — turning inference into a hardware-infrastructure problem. The host cites Martin Casado's argument: spend ~$50B of a $500B training run on a model-specific ASIC for ~10% efficiency. - **Video diffusion is a different beast (Taha):** no batching, one request per GPU, models ~20B parameters. A 5-second 480×720 clip at 16 fps (81 frames) compresses to ~30×50×21 latents ≈ 35,000 tokens of quadratic full attention. Sparse attention (each token attending to the top ~12.5%) hurts quality. Open models lag closed ones (Kling, Veo) badly, so even a 100x price advantage ($10 vs. $1,000 for a 3-hour film) doesn't win media customers. Chaining last-frame image-to-video extensions drifts, sometimes fading to black by ~25 seconds. - **Autoregressive vs. diffusion split (Kiely):** text, embeddings, and voice in/out are autoregressive (speech is done by adding waveform tokens to the LLM vocabulary); image and video are diffusion. Long video likely needs a hybrid, since autoregression can't revise the past. - **Training ↔ inference convergence:** slow RL rollouts bottleneck training; failed post-training quantization requires quantization-aware training or Nvidia's quantization-aware distillation (distilling NVFP4 logits against full precision). - **Self-optimizing models (Taha):** Baseten engineers ran a GLM 5.2 endpoint inside their Claude Code harness; it ran a forward pass, profiled, found bottleneck kernels, wrote replacements, re-profiled, and uploaded an image for the next cycle. Some GPU kernels serving GLM 5.2 in production were written by GLM 5.2. - **Next 100x:** Kiely points to multi-model systems (voice agents use 3–5 models), new modalities (world models like Cosmos, speech-to-speech), and multiple more 10x scaling steps. Taha's bet is faster NICs: KV transfer currently hops NIC→host memory→HBM (~4.5 TB/s HBM vastly outpaces NICs); direct fast node-to-node transfer could give ~100x faster disaggregated serving. - **Continual learning:** Taha concedes to Charlie that KV-cache compaction beats writing facts into weights, because weight edits don't propagate to multi-step reasoning (e.g., "Waterloo is best" not influencing "hire from Waterloo or MIT?"); this path leaves inference largely unchanged. ## Actionable Takeaways 1. Start on shared per-token APIs to evaluate open models; move to a dedicated deployment once a use case is sticky and you need reliability, a traffic-specific speculator, custom batch/parallelism, or higher precision than NVFP4. 2. For self-hosting (e.g., GLM 5.2 on a B200 node), stack in this order: grab public NVFP4 weights (~2x vs. BF16), use the model's MTP head or a published speculator (~2x), add PD disaggregation if traffic justifies it (~2x), then upgrade to the latest runtime/kernels (double-digit %). 3. Structure multi-turn/agent traffic so prefixes repeat, maximizing cache-aware routing hits and skipping prefill on long contexts. 4. Validate quants with KL divergence against the full-precision logit distribution, not just benchmark scores; avoid quantizing sensitive layers (modulation/output projections in image models). 5. Add loop detection (cut or retry when the same token repeats 4+ times, whitelisting characters like table dashes); if collapse appears, test another engine or newer image before blaming weights. 6. Use constrained decoding (state machine over the output format) for tool calls to guarantee valid JSON. 7. Choose parallelism by auto-tuning: sweep TP/EP combinations on shadowed real traffic and pick the best measured tokens/sec; reserve pipeline parallelism for unavoidable multi-node setups. 8. Treat NVIDIA Dynamo as a building kit for KV routing, offloading, and disaggregation, not a drop-in speedup. 9. To add vision to a text LLM, freeze the encoder and LLM, train only the projector, and use per-image question sets rather than captions alone. 10. Try a coding model in an agent loop that profiles, identifies bottleneck kernels, rewrites them, and re-profiles. ## Notable Quotes > "You'll know that inference is pretty much solved when [people] start publishing about how they got 1% faster." — Philip Kiely > "With local AI, it's how do I fit this model onto my hardware and then make it less dumb." — Philip Kiely > "Some of the GPU kernels that we run on GLM 5.2 within our inference engine is written by GLM 5.2." — Ali Taha > "You need very good training in order to do fast inference." — Ali Taha > "The LLM is actually not capable of doing anything. It's only capable of making suggestions of what to do." — Philip Kiely --- *You're reading a protocol on [protocol.supply](https://protocol.supply) — hosted, searchable knowledge for AI agents. Think Agent Skills, as an API: bootstrap once (`curl -sL https://api.protocol.supply/bootstrap`), search (`/search?q=…`), fetch (`/@repo/slug`).* *Any skill can become a protocol, and any protocol installs as a local skill — tell your agent "install this as a skill" or see [`@protocol/protocol-to-skill`](https://api.protocol.supply/@protocol/protocol-to-skill).*