Autoregressive Transformer (LLM)
Autoregressive2018 · OpenAI / Google BrainParallel teacher-forced causal training; sequential KV-cached token decoding
Intuition & Key Idea
ELI5 GuideWhy this model was invented and how it transforms generation
"Predicts the probability of the very next word based on all words that came before it, repeating one word at a time in a serial loop."
Someone writing on a classic typewriter who looks back at everything written so far to guess the next word, but cannot change what was already typed.
Teacher forcing calculates loss for all T tokens in 1 forward pass.
Each new word requires a separate forward pass reading full weights.
Stores past Keys & Values in VRAM to avoid recomputing history.
Never looks ahead; commits permanently to each sampled token.
1. Parallel Prompt Prefill & KV Cache Init
Process all prompt tokens in one parallel batch (just like training) and store their Keys and Values in GPU HBM memory (K_cache, V_cache) so they never have to be recomputed.
Prefill is compute-bound and saturates GPU Tensor Cores cleanly.
GPU Memory Hierarchy & HBM Traffic for this Step
HBM ↔ SRAM on-chipWeights are loaded from High-Bandwidth Memory (HBM) into Streaming Multiprocessor (SM) registers and SRAM cache for computation.
Active Tensor Dimensions & Memory Shapes
Powers GPT-4, Claude, Gemini, and Llama. Understanding the asymmetry between parallel training and serial memory-bandwidth-bound inference explains why modern research focuses on KV compression, speculative decoding, and parallel hierarchies like NCM.
Training Objective:Next-Token Cross-Entropy Loss: L = -∑ log P_θ(x_t | x_<t)
Inference Bottleneck:O(T) serial forward passes (memory-bandwidth bound)
Foundational & Breakthrough Papers for Autoregressive Transformer (LLM)
Attention Is All You Need
Vaswani et al. (Google Brain)
Language Models are Unsupervised Multitask Learners (GPT-2)
Radford et al. (OpenAI)
Fast Transformer Decoding: One Write-Head is All You Need (MQA / KV Cache)
Noam Shazeer