Language Modeling as Next-Token Prediction Language modeling is the task of predicting the next token in a sequence, a formulation that the chain rule of probability shows is sufficient to capture all statistical regularities in language. This approach, used by modern LLMs like GPT and LLaMA, traces back to Claude Shannon's 1948 information theory and his experiments estimating English entropy at 0.6–1.3 bits per character. Language Modeling as Next-Token Prediction Welcome to Arc 2. In Arc 1 we built up the mathematical tools: vectors, matrices, probability distributions, cross-entropy, gradients, optimizers, floating point. Now we get to use them. This arc covers how people modeled language before transformers, because every design choice in modern LLMs is a reaction to something that came before. If you skipped Arc 1, you can probably still follow along, but the cross-entropy post /blog/cross-entropy-and-loss and the probability distributions post /blog/probability-distributions are the most directly relevant prerequisites. So. What is a language model? A language model is a system that assigns a probability to the next token, given all the tokens that came before it. Given a sequence of words or subwords, or bytes , it outputs a probability distribution over what comes next. Every GPT, every LLaMA, every Claude, every n-gram model from the 1990s does some version of this. The architectures are wildly different, but the objective is the same: predict the next token from context. BERT and its descendants use a related but distinct objective, masked language modeling, where you predict held-out tokens from their bidirectional surroundings rather than predicting strictly left-to-right. We'll come back to that in Arc 4. That objective is doing more work than it looks like. The Chain Rule: Why This Works Why does predicting the next token let you model entire sequences? Because of a fact from probability theory that we covered in Post 1.3 /blog/probability-distributions : the chain rule. Any joint probability over a sequence of tokens can be decomposed into a product of conditionals: Or more compactly: This is an identity, not an approximation. It's true for any distribution over sequences, no matter how complex. And it says something important: if you can model each conditional accurately, you can reconstruct the full joint distribution over any sequence. The chain rule guarantees that a next-token predictor is, in principle, sufficient to capture any pattern in language. Here's what that factorization looks like in practice, for the first few words of a sentence: tP w t| w