How GPT, Claude, and Gemini are actually trained and served – Reiner Pope
Key insights
Media referenced
- Unified Scaling Laws for Routed Language Models - paper - Pulled up mid-conversation to show empirically how model quality changes as mixture-of-experts sparsity increases at fixed active-parameter count.
- GShard - paper - Cited as an earlier mixture-of-experts technique that predates DeepSeek's approach.
- Switch Transformer - paper - Cited alongside GShard as an older MoE technique whose results don't fully generalize to modern sparsity levels.
- RevNets (reversible networks, 2017 paper) - paper - The paper that ported the cryptographic Feistel-cipher construction into neural networks to make transformer layers invertible and avoid storing activations for the backward pass.
- Reiner Pope's blog post on cryptography and neural network convergent evolution - article - The starting point for the closing discussion of how cipher design and neural net design converge on similar mixing/scrambling architectures for opposite purposes.
- Character AI blog post on alternating long/short context attention - article - Cited as a real-world example of dense attention with KV cache reuse across layers, used to sanity-check the bytes-per-token estimate derived from Gemini's pricing.
- Dwarkesh's prior podcast interview with Dario Amodei - podcast - Referenced for Amodei's claim that in-context learning, not continual learning, may be sufficient for AGI - which Dwarkesh uses to ask whether infra could ever support 100-million-token context windows.
Companies
- MatX - Reiner Pope is CEO of this AI chip startup; Dwarkesh discloses he is an angel investor in it.
- Google - Pope previously worked on TPU architecture there; Google's scale-up domains are cited as historically larger than Nvidia's.
- Nvidia - Its Blackwell NVL72 rack (72 GPUs) and upcoming Rubin generation (~500+ GPU scale-up) are the reference hardware for the whole roofline analysis.
- DeepSeek - DeepSeek V3's 37B active / 700B total parameters and its published sparse-attention and MoE routing techniques are used as running examples throughout.
- OpenAI - GPT-4's release timing and rumored >1 trillion parameter count anchor the discussion of why model sizes stalled and then jumped.
- Google DeepMind / Gemini - Gemini's tiered API pricing (context length and cache-hit discounts) is reverse-engineered to infer KV cache byte size and memory-bandwidth bottlenecks.
- Anthropic / Claude - Claude's Fast Mode/Slow Mode pricing motivates the opening question about why latency and cost trade off the way they do.
- Character AI - Cited for its dense-attention architecture with shared KV cache across layers, also used in Gemma models.
- Jane Street - Dwarkesh mentions a conversation with a GPU performance engineer there about why pipelining requires micro-batching.
Techniques and frameworks
- Roofline analysis - The core analytical method used throughout: modeling inference time as the max of memory-fetch time and compute time to predict latency and cost.
- Batching (continuous/dynamic batching) - Grouping concurrent user requests so weight-fetch cost is amortized across many tokens; the single biggest lever on cost and latency.
- KV cache - The stored internal representation of past tokens that each new token attends to during decode; dominates memory bandwidth and capacity demands.
- Expert parallelism - Sharding different MoE experts across GPUs within one rack, matched to the all-to-all communication pattern of routing.
- Pipeline parallelism - Splitting model layers across racks; reduces per-GPU weight memory footprint but does not reduce KV cache footprint per GPU.
- Tensor parallelism - Older technique of splitting computation within a single expert/layer; described as no longer profitable now that experts are small.
- Sparse attention - Attending to only a subset of past tokens to reduce the memory-bandwidth scaling of context length; discussed as a partial but not complete fix for the memory wall.
- Chinchilla scaling laws - The baseline for compute-optimal training token counts, used to estimate that frontier models are now trained on roughly 100x the Chinchilla-optimal token count once RL and inference costs are amortized in.
- Feistel cipher / RevNets (reversible networks) - A cryptographic invertibility construction imported into neural nets so that transformer layers can be run backward and activations rematerialized instead of stored, saving training memory.
- Rematerialization - Recomputing a KV cache from scratch from token IDs rather than storing it, one of several memory-tier tradeoffs (HBM vs. DDR vs. flash vs. disk) analyzed via API cache-pricing.
Summary
Dwarkesh Patel interviews Reiner Pope, CEO of chip startup MatX and formerly a TPU architect at Google, in a new "blackboard lecture" format built around first-principles derivation rather than free-form conversation. The episode opens with a concrete question - why does Claude's Fast Mode cost 6x more for 2.5x the speed - and uses it to motivate a full roofline analysis of transformer inference: modeling total time as the maximum of memory-fetch time (loading model weights plus the KV cache) and compute time (multiplying activations by active parameters). From this simple model, Pope derives that batch size is the dominant lever on both cost and latency, that there is a hardware-determined optimal batch size of roughly 300 times a model's sparsity ratio, and that running inference unbatched can be a thousand times more expensive than running it batched.
The conversation then moves to how mixture-of-experts models are physically laid out across GPU clusters. Expert parallelism (spreading different experts across GPUs) is the natural fit for a rack's fully-connected internal network, while pipeline parallelism (spreading layers across racks) trades a real reduction in weight-memory footprint for no reduction in KV cache footprint, because avoiding pipeline bubbles forces exactly enough concurrent micro-batches to cancel out the savings. This leads into a discussion of why Nvidia's scale-up domains have grown from 8 GPUs (Hopper) to 72 (Blackwell) to 500+ (Rubin): not primarily to solve memory capacity, which pipelining already handles for weights, but to aggregate more memory bandwidth in parallel and cut decode latency, which in turn is what unlocked training and serving much larger, sparser models than were feasible a few years ago.
A central analytical set-piece works out how much frontier labs may be over-training models relative to Chinchilla-optimal now that reinforcement learning post-training and inference serving costs both compete with pre-training for compute budget. By assuming the three cost buckets (pre-training, RL, inference) tend to be minimized when roughly equalized, and working backward from rough estimates of global inference token throughput and model deployment lifetimes, Pope and Patel arrive at pre-training token counts on the order of 100-200 trillion tokens - about 100x Chinchilla-optimal for a model with roughly 100 billion active parameters. They flag this as necessarily approximate, built on unreported industry numbers, but argue the method itself - solving for cost equalization - is a powerful way to sanity-check public claims.
The back half turns to reverse-engineering real infrastructure signal from public API pricing: Gemini's price jump above 200k-token contexts is interpreted as the crossover point where KV cache memory time exceeds weight-fetch time, which lets them estimate roughly 1.5-2 kilobytes of KV cache per token, matching plausible dense-attention configurations like those Character AI has described publicly. The gap between input and output token pricing (roughly 5x) is read as evidence that decode is heavily memory-bandwidth-bound while prefill is compute-bound, since prefill amortizes memory time over many parallel tokens. This section closes with an explanation of why context lengths have plateaued around 100-200K tokens for the past year or two: it is a memory-bandwidth ceiling, not a compute ceiling, and sparse attention only partially relieves it before quality degrades.
The episode ends with a shorter, less mathematical discussion prompted by a Pope blog post on convergent evolution between cryptography and neural networks - both rely on architectures that thoroughly mix and scramble their inputs, but for opposite purposes: ciphers destroy structure to produce apparent randomness, while neural nets extract structure from apparently random data. Pope traces a concrete lineage from cipher design into deep learning: the Feistel cipher construction, which makes non-invertible functions invertible by carrying forward both inputs, was directly imported into 2017's RevNets to make transformer layers invertible, allowing training to rematerialize activations during the backward pass instead of storing them, trading additional compute for reduced memory - the mirror image of the KV cache tradeoff (more memory to save compute) discussed throughout the rest of the episode.
Notable Quotes
"The big effect is batch size. What we're going to do now is quantify exactly what that looks like and what its implications are on latency and cost." - Reiner Pope
"If you do not batch together many users, the cost and the economics you get can be a thousand times worse than if you do batch many users together." - Reiner Pope
"The cutting matches the model architecture." - Reiner Pope
"The number of inference tokens should be about the same as the number of pre-training tokens, which should be about the same as the number of RL tokens, within factors that we're not able to reason about." - Reiner Pope
"It's kind of empowering to just set A equal to B and figure it out." - Reiner Pope