Skip to content
Start here Foundation 27 min read

The map of AI at 10,000 ft

The whole field on one page: what the words mean, how the disciplines nest, how a modern model is made and served, the stack it runs on, and the families of models. Every region links to the track that teaches it. Come back here whenever you lose the plot.

10,000 ft

Artificial intelligence is the project of building machines that do things we would call intelligent. Since about 2012 almost all of the progress has come from one idea: instead of writing the rules, write a model with adjustable numbers and adjust them to fit data. That idea is machine learning. Stack many layers of it and you have deep learning. Train one very large network to predict the next token of most of the written internet, then teach it manners and you have the large language model behind every assistant. Around that core sit the mathematics that makes it work, the hardware and software that make it affordable, the engineering that turns it into products, and the science of measuring and governing what we have built. This page draws all of that as one map.

2,000 ft

Read the field as seven regions stacked on each other. Mathematics is the language. Learning from data (classical machine learning and deep learning) is the method. Model families (transformers, generative models, reinforcement learning) are what the method produces. Post-training turns a raw model into a useful one. Systems make training and serving possible at all. Applications wrap models in retrieval, tools and agents. Evaluation, safety and data run across everything, because you cannot improve what you cannot measure. History explains how we got here; the frontier is where it is going.

The field as seven regions
The field as seven regions. Mathematics linear algebra · calculus probability · information, Learning from data classical ML · deep learning, Model families transformers · generative · RL, Post-training SFT · RLHF · DPO · RLVR, Applications prompts · RAG · tools · agents, Systems GPUs · kernels distributed · serving, Evaluation, safety, data, makes it affordable, serves it, measures, guardsThe field as seven regions. Mathematics linear algebra · calculus probability · information, Learning from data classical ML · deep learning, Model families transformers · generative · RL, Post-training SFT · RLHF · DPO · RLVR, Applications prompts · RAG · tools · agents, Systems GPUs · kernels distributed · serving, Evaluation, safety, data, makes it affordable, serves it, measures, guards

Ground level

The words, defined precisely

Most confusion about AI is confusion about words. Here are the ones this site uses, each with the narrowest definition that is still correct.

  • Artificial intelligence (AI): the field of building systems that perform tasks requiring intelligence when done by people: perceiving, reasoning, planning, using language, acting. The term was coined for the 1956 Dartmouth summer workshop. It names a goal, not a technique.
  • Machine learning (ML): the subset of AI where behaviour is learned from data rather than hand-coded. Tom Mitchell's definition (1997) is still the best: a program learns from experience \(E\) on tasks \(T\) with performance measure \(P\) if its performance on \(T\), as measured by \(P\), improves with \(E\).
  • Deep learning (DL): machine learning with neural networks of many layers, trained end to end by gradient descent. "Deep" refers to the number of layers of learned transformations.
  • Foundation model: a large model trained on broad data, usually by self-supervision, that can be adapted to many downstream tasks. The term comes from Bommasani et al. (2021).
  • Large language model (LLM): a foundation model trained to predict the next token of text, typically a decoder-only transformer with billions of parameters.
  • Agent: a system that uses a model in a loop: it observes, decides on an action (often a tool call), acts, observes the result, and repeats until a goal is met.
  • Generative AI: models that produce new samples (text, images, audio, video) from a learned distribution, as opposed to models that only classify or score.

The disciplines nest. Symbolic AI (search, logic, planning, expert systems) is the older half of the field and is far from dead: chess engines search, compilers plan, and modern agents still run explicit loops and constraint checks around a learned core. Reinforcement learning is a way of learning (from reward rather than labels) that can use any kind of model, so it straddles the classical and deep worlds.

What contains what
What contains what. Artificial intelligence, Symbolic AI search · logic · planning, Machine learning, Classical ML linear models · trees · kernels, Reinforcement learning learning from reward, Deep learning, CNNs · RNNs · MLPs, Foundation models, LLMs, Diffusion and multimodal modelsWhat contains what. Artificial intelligence, Symbolic AI search · logic · planning, Machine learning, Classical ML linear models · trees · kernels, Reinforcement learning learning from reward, Deep learning, CNNs · RNNs · MLPs, Foundation models, LLMs, Diffusion and multimodal models

AI is not a synonym for LLMs

Recommendation systems, fraud detection, credit scoring, protein structure prediction, chess engines and the route planner on your phone are all AI. LLMs are the most visible slice, and the one this site spends most time on, because they are where the frontier currently moves fastest. A good engineer still reaches for gradient-boosted trees for a tabular problem (Classical ML) and for plain code when the answer must be exact.

Four ways a machine can learn

What distinguishes learning methods is where the training signal comes from. Every model in this site is trained by one of these four, or a combination.

Paradigm Training signal Typical loss Example Learn it in
Supervised human-provided labels \(y\) for inputs \(x\) cross-entropy, squared error spam filter, image classifier Classical ML
Self-supervised labels manufactured from the data itself (the next word, a masked patch) next-token cross-entropy GPT pre-training, BERT, CLIP Transformers
Unsupervised structure in unlabelled data reconstruction, likelihood clustering, PCA, VAEs Clustering
Reinforcement a scalar reward after acting negative expected return AlphaZero, RLHF, reasoning RL Reinforcement learning

Self-supervision is the quiet hero of the boom. Labels are expensive; text is nearly free. Turning "predict the next token" into a training signal let models learn from trillions of tokens without anyone labelling them, and everything else (instruction following, chat, tool use) is built on top of that pre-trained base.

The regions, one by one

Each paragraph below is the 10,000-ft view of one track. Follow the link when you want the 2,000-ft map of that region.

Mathematical foundations. Four branches do nearly all the work. Linear algebra is the language of data and models: an embedding is a vector, a layer is a matrix, a batch of activations is a tensor (vectors, matrices). Calculus tells you how to change parameters to reduce a loss (gradients, the chain rule). Probability is what a model outputs and what a loss measures (probability, MLE and Bayes). Information theory explains why cross-entropy is the right loss and what "bits per token" means (entropy and KL). Numerics and statistics keep you honest about floating point and about whether a result is real.

Classical machine learning. The ideas deep learning never stopped using: fitting a model by minimising a loss (linear regression), turning scores into probabilities (logistic regression), the trade-off between fitting and generalising (bias and variance), and how to measure all of it without fooling yourself (validation and leakage). Trees, kernels, clustering and dimensionality reduction are still the right tools for many real problems.

Deep learning. Stack layers of linear maps and non-linearities, compute gradients of the loss with respect to every weight by backpropagation, and step downhill with an optimiser. The tricks that made deep networks trainable (sensible initialisation and normalisation, residual connections, good activations) are as important as the architectures (CNNs, RNNs).

Transformers and LLMs. The architecture of the boom. Text becomes tokens; tokens become vectors; attention lets each position read from every earlier one; a stack of transformer blocks is trained on the language-modelling objective. The scaling laws say how loss falls with parameters, data and compute. The advanced pages cover how to make it fast and long (KV cache and efficient attention, long context, mixture of experts) and what may replace it (state-space models, reasoning models).

Post-training and alignment. A pre-trained model completes text; it does not follow instructions. Post-training fixes that in stages: supervised fine-tuning on demonstrations, preference learning by RLHF or DPO, and, since 2024, reinforcement learning on verifiable rewards that teaches models to reason. LoRA makes fine-tuning cheap enough to do on a laptop.

Reinforcement learning. Learning to act from reward. The core objects are Markov decision processes and the Bellman equations; the core algorithms are value-based (Q-learning) and policy-based (policy gradients, PPO). RL won games (AlphaZero) and now trains LLMs (RL for language models).

Generative models and multimodal. Models of the data distribution itself, so you can sample from it: VAEs, GANs, and the diffusion and flow-matching models behind image and video generation. The same track covers how vision and language meet (ViT and CLIP, vision-language models), speech, and world models.

AI systems and infrastructure. Why it costs what it costs. How a GPU works, why most LLM work is limited by memory bandwidth rather than arithmetic, mixed precision, distributed training, the compute maths you can do on a napkin, quantisation, serving, and running models on your own Mac.

LLM application engineering. Building products on models: prompting, structured outputs and tool calls, retrieval, agents, context engineering, MCP, evals, security and shipping. The track ends with a case study of Jarvis, Finny's own assistant.

Evaluation, safety and interpretability. How we know what a model can do (benchmarks and their contamination), what is going on inside it (mechanistic interpretability), whether it does what we intend (the alignment problem, red-teaming), and how society governs it (regulation).

Data for AI. The ingredient people forget. Where training data comes from and what you may legally use (collection), how it is filtered and deduplicated, how human feedback is gathered, and how data drifts once a model is in production.

The story of AI, the research frontier, projects and the library complete the map: how we got here, where it is going, what to build to make it stick, and the canon to read.

How a modern model is made: the lifecycle

Every frontier model of 2026 goes through roughly the same pipeline. The stages differ enormously in cost: pre-training is the expensive part, measured in thousands of GPUs for months; the later stages are far cheaper but decide most of what users actually experience.

The lifecycle of a modern model
The lifecycle of a modern model. Data web · code · books filtered, deduplicated, Pre-training next-token prediction on trillions of tokens, Post-training, SFT demonstrations, Preference tuning RLHF · DPO, RL on verifiable rewards, Evals and red-teaming, Serving quantise · batch · cache, Applications RAG · tools · agents, logs and feedbackThe lifecycle of a modern model. Data web · code · books filtered, deduplicated, Pre-training next-token prediction on trillions of tokens, Post-training, SFT demonstrations, Preference tuning RLHF · DPO, RL on verifiable rewards, Evals and red-teaming, Serving quantise · batch · cache, Applications RAG · tools · agents, logs and feedback
  1. Data. Crawl, licence and buy text, code, images and more; strip boilerplate; filter for quality; remove near-duplicates; balance the mixture. Data work decides more of a model's quality than any architecture change of the last five years (Pre-training data, Data for AI).
  2. Pre-training. Train a transformer to predict the next token over the whole corpus. Meta's Llama 3 405B, for example, was pre-trained on 15.6 trillion tokens using \(3.8\times10^{25}\) FLOPs on up to 16,000 H100 GPUs (Llama 3 paper). The result is a base model: an extraordinary autocomplete with broad knowledge and no particular wish to help you.
  3. Post-training. Supervised fine-tuning on curated demonstrations teaches the format of a helpful answer. Preference tuning (reward model plus RL, or DPO directly) teaches which of two answers people prefer; InstructGPT showed that a 1.3B model tuned this way was preferred over the 175B base GPT-3 (Ouyang et al., 2022). RL against checkable rewards (unit tests, maths answers) teaches long chains of reasoning (DeepSeek-R1).
  4. Evaluation. Benchmarks, private test sets, human ratings, and red-teaming for dangerous capabilities. Evaluation is not a final gate but a loop run throughout training.
  5. Serving. Quantise weights, batch requests, cache attention keys and values, decode speculatively. Serving cost per token, not training cost, dominates the economics of a successful product (Serving LLMs).
  6. Applications. Most products wrap a model with retrieval, tools, memory and guardrails. The logs and feedback they produce become data for the next round.

The stack from chips to products

The same lifecycle, viewed as layers of technology. Each layer is a separate industry with its own companies and its own bottlenecks, and a change at the bottom (a new chip, a new numeric format) ripples to the top as lower prices and new products.

The AI stack, chips to products
The AI stack, chips to products. Products assistants · copilots · vertical apps, Orchestration prompts · RAG · tools · agents · evals, Models and APIs closed frontier · open weights, Training and serving software FSDP · vLLM · llama.cpp · MLX, Frameworks and compilers PyTorch · JAX · Triton · CUDA, Accelerators GPUs · TPUs · Apple silicon, Data centres power · cooling · networkingThe AI stack, chips to products. Products assistants · copilots · vertical apps, Orchestration prompts · RAG · tools · agents · evals, Models and APIs closed frontier · open weights, Training and serving software FSDP · vLLM · llama.cpp · MLX, Frameworks and compilers PyTorch · JAX · Triton · CUDA, Accelerators GPUs · TPUs · Apple silicon, Data centres power · cooling · networking
  • Data centres and energy set the ceiling on how much compute exists. Epoch AI estimates that training compute for frontier language models has grown about 5× per year since 2020 (Epoch AI trends, Feb 2026); that growth is now limited by power and chip supply as much as by money. See Hardware, chips and deep tech.
  • Accelerators (NVIDIA GPUs, Google TPUs, Apple's unified-memory chips and others) do the matrix multiplications. What matters is arithmetic throughput, memory bandwidth and memory capacity (How a GPU works).
  • Kernels and frameworks turn maths into fast code. PyTorch dominates research; JAX runs much of Google; MLX targets Apple silicon; Triton and CUDA are where the speed is (Kernels).
  • Training and serving software spreads a model across thousands of chips and serves it to millions of users (Distributed training).
  • Models come either as closed APIs or as open weights you can download, fine-tune and run yourself.
  • Orchestration is where most engineers work: the code around the model (LLM engineering).
  • Products are where value is captured, and where the hardest problems are usually not the model at all but data, UX, trust and cost (Shipping AI products).

The families of models

Architectures differ mainly in their inductive bias: the assumption about the data that is built into the wiring. A convolution assumes nearby pixels matter together and that a pattern means the same thing anywhere in the image. A recurrent network assumes sequence order and a running memory. Attention assumes almost nothing, which is why it needs more data and why, given enough data, it wins.

Data shapes and the architectures built for them
Data shapes and the architectures built for them. Images, audio (grids), Sequences (text, time series), Very long sequences, Tables, CNN locality · translation, RNN / LSTM recurrence, Transformer all-pairs attention, State-space models linear-time recurrence, Boosted trees, MLPs, ViT: patches as tokensData shapes and the architectures built for them. Images, audio (grids), Sequences (text, time series), Very long sequences, Tables, CNN locality · translation, RNN / LSTM recurrence, Transformer all-pairs attention, State-space models linear-time recurrence, Boosted trees, MLPs, ViT: patches as tokens

The table lists the families you will meet, the landmark paper that defined each, and where this site teaches it.

Family Core idea Landmark Learn it in
Decoder-only transformer LMs predict the next token with causal self-attention GPT-3, 2020 Build a GPT
Encoder-only transformers predict masked tokens; produce embeddings BERT, 2018 Embeddings and vector search
Mixture of experts route each token to a few of many sub-networks Shazeer et al., 2017 Mixture of experts
State-space models a learned linear recurrence, linear time in length Mamba, 2023 Beyond transformers
Diffusion models learn to reverse a gradual noising process DDPM, 2020; latent diffusion, 2021 Diffusion models
Vision transformers and CLIP images as sequences of patches; align images with text ViT, 2020; CLIP, 2021 ViT and CLIP
Deep RL agents a neural network estimates value or policy from reward DQN, 2013 Q-learning and DQN
Reasoning models RL teaches the model to think at length before answering DeepSeek-R1, 2025 Reasoning models
Retrieval-augmented models condition generation on retrieved documents RAG, 2020 RAG
Tool-using agents interleave reasoning with actions and observations ReAct, 2022 Agents

Three booms in one paragraph

AI has boomed and busted before. The symbolic era (1956 to the late 1980s) bet on hand-written logic and expert systems and ran into the brittleness of rules. The statistical era (1990s and 2000s) learned from data with careful features and convex models. The deep learning era began when GPUs, large labelled datasets and better training tricks met in 2012, and it turned into the scale era after the transformer (2017), when it became clear that the same architecture kept improving as you added data and compute. The assistant era started with ChatGPT in November 2022. The story of AI tells it properly.

First principles

Why does any of this work? Three forces explain most of the last fifteen years.

1. Learning is compression with a bias. No learner can generalise from finite data without assumptions; the "no free lunch" theorems make this precise. Every model therefore carries an inductive bias, and progress comes from biases that match the world: convolutions for images, attention for language, and, above all, a bias for simple explanations, which gradient descent on over-parameterised networks turns out to provide implicitly. Prediction and compression are the same thing (a model that assigns probability \(p\) to the next symbol can encode it in \(-\log_2 p\) bits), which is why "predict the next token well" is such a demanding objective: to predict text written by people about the world, a model benefits from modelling the people and the world.

2. General methods plus computation beat cleverness, over time. Rich Sutton's essay The Bitter Lesson (2019) observes that, across chess, Go, speech and vision, methods that exploited human knowledge won in the short run and lost in the long run to general methods (search and learning) that scale with computation. The transformer era is the strongest confirmation yet: one architecture, one objective, and predictable gains from scale.

3. Loss falls as a power law in scale. Hestness et al. (2017) and then Kaplan et al. (2020) found that test loss falls smoothly and predictably as a power law in parameters, data and compute across many orders of magnitude (Hestness, Kaplan). Predictability changed the economics of the field: a lab can fit a curve on small runs and know roughly what a run 1,000 times larger will achieve before spending the money. That is why compute investment grew as it did.

Underneath all three is an engineering fact: the operations neural networks need (big matrix multiplications, in reduced precision, in parallel) are exactly what GPUs do well. The field's direction has been shaped as much by what hardware makes cheap as by what theory suggests.

The picture to keep

A model is a function with billions of knobs. Data defines a landscape of how wrong the function is. Training is rolling downhill on that landscape. Scale gives more knobs, more landscape and more rolling, and the valley it finds has, so far, kept getting deeper.

The maths

Three equations hold the field together. Each gets its own track; here is the whole set on one screen.

Learning is optimisation

Given examples \((\mathbf{x}_i, y_i)\), \(i = 1,\dots,N\), a model \(f_\theta\) with parameters \(\theta\), and a loss \(\ell\) that says how wrong a prediction is, learning means minimising the empirical risk:

\[ \hat{\theta} = \arg\min_\theta \; \frac{1}{N}\sum_{i=1}^{N} \ell\big(f_\theta(\mathbf{x}_i),\, y_i\big) \;+\; \lambda\, R(\theta), \]

where \(R\) is an optional regulariser with strength \(\lambda\). For a neural network we cannot solve this in closed form, so we follow the negative gradient, one mini-batch \(B\) at a time, with learning rate \(\eta\):

\[ \theta_{t+1} = \theta_t - \eta\, \nabla_\theta \frac{1}{|B|}\sum_{i\in B} \ell\big(f_{\theta_t}(\mathbf{x}_i), y_i\big). \]

Backpropagation is the algorithm that computes that gradient efficiently; Adam and friends are better ways to use it (Derivatives, Optimisation, Backpropagation).

Language modelling is maximum likelihood on sequences

By the chain rule of probability, any distribution over a sequence of tokens factorises exactly:

\[ p(x_1, \dots, x_T) = \prod_{t=1}^{T} p(x_t \mid x_1, \dots, x_{t-1}). \]

A language model \(p_\theta\) approximates each factor. Training minimises the average negative log-likelihood of the next token, which is the cross-entropy between the data and the model:

\[ \mathcal{L}(\theta) = -\frac{1}{T}\sum_{t=1}^{T} \log p_\theta(x_t \mid x_{<t}), \qquad \text{perplexity} = e^{\mathcal{L}}. \]

A loss of 2.0 nats per token means perplexity \(e^{2} \approx 7.4\): the model is, on average, as uncertain as if it were choosing uniformly among about seven tokens. In bits, 2.0 nats is \(2.0/\ln 2 \approx 2.89\) bits per token. No model can go below the entropy of the text itself, which is why loss curves flatten towards a floor rather than zero (Information theory, The language-modelling objective).

Scaling: compute, parameters and data

For a dense transformer with \(N\) parameters trained on \(D\) tokens, the training compute is

\[ C \approx 6ND \ \text{FLOPs}. \]

The 6 comes from counting: each parameter takes part in one multiply and one add (2 FLOPs) per token in the forward pass, and the backward pass costs about twice the forward pass (4 FLOPs), because it computes gradients with respect to both activations and weights. Hoffmann et al. (2022) fitted the final loss of hundreds of training runs to

\[ L(N, D) = E + \frac{A}{N^{\alpha}} + \frac{B}{D^{\beta}}, \qquad E = 1.69,\; A = 406.4,\; B = 410.7,\; \alpha = 0.34,\; \beta = 0.28, \]

where \(E\) is the irreducible entropy of the text, the second term is the penalty for a finite model and the third the penalty for finite data (Chinchilla paper, eq. 10).

Derivation: the compute-optimal split of a budget

Minimise \(L(N, D)\) subject to \(6ND = C\). Substitute \(D = C/(6N)\):

\[ L(N) = E + A N^{-\alpha} + B \left(\tfrac{C}{6}\right)^{-\beta} N^{\beta}. \]

Set \(dL/dN = 0\):

\[ -\alpha A N^{-\alpha-1} + \beta B \left(\tfrac{C}{6}\right)^{-\beta} N^{\beta-1} = 0 \;\;\Longrightarrow\;\; N^{\alpha+\beta} = \frac{\alpha A}{\beta B}\left(\tfrac{C}{6}\right)^{\beta}. \]

So

\[ N_{\text{opt}} = G\left(\tfrac{C}{6}\right)^{a},\quad D_{\text{opt}} = G^{-1}\left(\tfrac{C}{6}\right)^{b},\quad a = \frac{\beta}{\alpha+\beta},\; b = \frac{\alpha}{\alpha+\beta},\; G = \left(\frac{\alpha A}{\beta B}\right)^{\frac{1}{\alpha+\beta}}. \]

With \(\alpha = 0.34\) and \(\beta = 0.28\): \(a = 0.45\), \(b = 0.55\). Parameters and data should grow at nearly the same rate as compute grows, which is the Chinchilla result; Kaplan et al. had found \(a \approx 0.73\), which is why models of 2020–2021 were too big for their data.

Worked example. Using \(C = 6ND\) with the numbers each paper reports:

Model \(N\) \(D\) \(C = 6ND\) tokens per parameter
GPT-3 (2020) 175B 300B \(3.15\times10^{23}\) 1.7
Chinchilla (2022) 70B 1.4T \(5.88\times10^{23}\) 20
Llama 3 405B (2024) 405B 15.6T \(3.79\times10^{25}\) 38.5

GPT-3's paper reports \(3.14\times10^{23}\) FLOPs for its largest model, and Llama 3 reports \(3.8\times10^{25}\): the six-\(ND\) rule is accurate to the first two digits. Chinchilla matched Gopher's budget (\(5.76\times10^{23}\)) with a model four times smaller trained on four times more data, and beat it. Modern models go well past 20 tokens per parameter on purpose: a smaller model trained longer costs more to train but less to serve, and serving is where the money goes.

10²²10²³ 10²⁴10²⁵10²⁶ GPT-3 3.15e23 Chinchilla 5.88e23 Llama 3 405B 3.79e25

Training compute on a log axis. Each grid step is 10×: Llama 3 405B used about 120 times GPT-3's compute, four years later.

Play with the trade-off yourself: pick a compute budget and watch where the compute-optimal model size lands.

Scaling-law constants are estimates, not laws of nature

Plug the published, rounded constants into the closed form above and Chinchilla's own budget gives about 32B parameters and 3T tokens, not the 70B and 1.4T that the paper's other two methods recommended (the code below prints it). Besiroglu et al. tried to replicate the fit and found it inconsistent with the paper's other estimates and its confidence intervals implausibly tight (Chinchilla Scaling: A replication attempt). The shape of the law held up; the exact constants depend on the data, the architecture and the fitting procedure. Treat any single number from a scaling law as having wide error bars.

Build it

Two short programs. The first does the scaling arithmetic above. The second runs the entire lifecycle of a language model in miniature, in NumPy: data, tokenisation, a model, a loss, training, and sampling. A GPT differs from it in the model (a transformer instead of a lookup table) and in scale, not in kind.

# Training compute C ≈ 6·N·D, and what Chinchilla's fitted loss law predicts.
models = {                      # N = parameters, D = training tokens (from each paper)
    "GPT-3 (2020)":        (175e9, 300e9),
    "Chinchilla (2022)":   (70e9, 1.4e12),
    "Llama 3 405B (2024)": (405e9, 15.6e12),
}
E, A, B, alpha, beta = 1.69, 406.4, 410.7, 0.34, 0.28   # Hoffmann et al. 2022, eq. 10

def loss(N, D):
    return E + A / N**alpha + B / D**beta

for name, (N, D) in models.items():
    C = 6 * N * D
    print(f"{name:20s} C = {C:.2e} FLOPs  tokens/param = {D/N:5.1f}  "
          f"L(N,D) = {loss(N, D):.3f}")

# Same compute as GPT-3, spent the Chinchilla way (D ≈ 20 N):
C = 6 * 175e9 * 300e9
N = (C / (6 * 20)) ** 0.5
print(f"\nGPT-3 budget, 20 tokens/param: N = {N/1e9:.0f}B, D = {20*N/1e9:.0f}B, "
      f"L = {loss(N, 20*N):.3f}")

# Closed form: minimise L(N, D) subject to 6ND = C.
a, b = beta / (alpha + beta), alpha / (alpha + beta)
G = (alpha * A / (beta * B)) ** (1 / (alpha + beta))
for C in (5.88e23, 3.79e25):
    N_opt = G * (C / 6) ** a
    D_opt = (C / 6) / N_opt
    print(f"C = {C:.2e}: N_opt = {N_opt/1e9:.0f}B, D_opt = {D_opt/1e12:.2f}T, "
          f"tokens/param = {D_opt/N_opt:.0f}")

Output:

GPT-3 (2020)         C = 3.15e+23 FLOPs  tokens/param =   1.7  L(N,D) = 2.002
Chinchilla (2022)    C = 5.88e+23 FLOPs  tokens/param =  20.0  L(N,D) = 1.937
Llama 3 405B (2024)  C = 3.79e+25 FLOPs  tokens/param =  38.5  L(N,D) = 1.819

GPT-3 budget, 20 tokens/param: N = 51B, D = 1025B, L = 1.961
C = 5.88e+23: N_opt = 32B, D_opt = 3.02T, tokens/param = 93
C = 3.79e+25: N_opt = 213B, D_opt = 29.62T, tokens/param = 139

The loss column is only meaningful for data like Chinchilla's (the law was fitted on DeepMind's MassiveText; GPT-3 and Llama 3 used different data and tokenisers), but the comparison is instructive: at GPT-3's budget, a 51B model on a trillion tokens would have reached a lower loss than the 175B model on 300B tokens.

Now the lifecycle in miniature:

# The whole lifecycle in miniature: data -> tokens -> model -> loss -> training -> sampling.
import numpy as np
rng = np.random.default_rng(0)

# 1. Data: a tiny "corpus".
text = ("the cat sat on the mat. the dog sat on the log. "
        "the cat saw the dog. the dog saw the cat. ") * 20

# 2. Tokenisation: one token per character.
vocab = sorted(set(text))
stoi = {ch: i for i, ch in enumerate(vocab)}
ids = np.array([stoi[c] for c in text])
V = len(vocab)
x, y = ids[:-1], ids[1:]                 # predict the next token from the current one

# 3. Model: a V x V table of logits (a bigram model; GPT replaces this with a transformer).
W = np.zeros((V, V))

def softmax(z):
    z = z - z.max(axis=1, keepdims=True)
    e = np.exp(z)
    return e / e.sum(axis=1, keepdims=True)

# 4-5. Loss (cross-entropy) and training (full-batch gradient descent).
for step in range(501):
    P = softmax(W[x])                    # (T, V) predicted next-token distributions
    loss = -np.log(P[np.arange(len(y)), y]).mean()
    G = P.copy(); G[np.arange(len(y)), y] -= 1    # dL/dlogits
    dW = np.zeros_like(W); np.add.at(dW, x, G / len(y))
    W -= 20.0 * dW
    if step % 100 == 0:
        print(f"step {step:3d}  loss {loss:.3f}  (uniform guess = ln V = {np.log(V):.3f})")

# The floor: no bigram model can beat the corpus's conditional entropy H(next | current).
C = np.zeros((V, V)); np.add.at(C, (x, y), 1)
Pxy = C / C.sum(); Py_x = C / C.sum(axis=1, keepdims=True)
H = -(Pxy[C > 0] * np.log(Py_x[C > 0])).sum()
print(f"entropy floor H(next|current) = {H:.3f}")

# 6. Serving: sample text one token at a time.
t, out = stoi["t"], "t"
for _ in range(40):
    p = softmax(W[[t]])[0]
    t = rng.choice(V, p=p)
    out += vocab[t]
print(repr(out))

Output:

step   0  loss 2.708  (uniform guess = ln V = 2.708)
step 100  loss 0.703  (uniform guess = ln V = 2.708)
step 200  loss 0.698  (uniform guess = ln V = 2.708)
step 300  loss 0.696  (uniform guess = ln V = 2.708)
step 400  loss 0.694  (uniform guess = ln V = 2.708)
step 500  loss 0.694  (uniform guess = ln V = 2.708)
entropy floor H(next|current) = 0.692
'the caw the cathe sat cathe the og. lon m'

Everything on the map is visible in these forty lines. The loss starts at \(\ln V\) (a uniform guess over 15 characters) and falls towards the entropy floor \(E\) of this "language" under this model class: the bigram can never know whether "the " is followed by "cat", "dog", "mat" or "log", so it cannot do better than 0.692 nats. The sample has the right local statistics and no meaning, which is exactly what a model with one character of context should produce. A transformer's job is to use far more context to push that floor down.

Things to try

  • Set the learning rate to 50 and rerun. The loss stalls near 0.79: the step is too large for the frequent rows of the table and they oscillate. You have just met the most common training bug there is (A recipe for training).
  • Replace the bigram with a trigram (condition on two previous characters, a \(V^2 \times V\) table). The floor drops. That is what more context buys.
  • Add a temperature to the sampler (softmax(W[[t]] / T)) and try \(T = 0.5\) and \(T = 2\) (Decoding).
  • In the scaling script, find the compute budget at which the law predicts a loss of 1.9.

Common misconceptions

  • "The model looks things up." A base LLM stores no documents; it stores parameters that make some continuations likely. That is why it can be fluent and wrong. Retrieval (RAG) is how you add lookup.
  • "Bigger is always better." Bigger is better at fixed data and compute-optimal training; an under-trained giant loses to a well-trained smaller model, as Chinchilla showed, and a smaller model is cheaper to serve.
  • "Training is the expensive part." For a successful product, inference usually costs more in total than training, because it is paid on every request forever (Compute maths).
  • "Deep learning replaced everything else." On tabular data, gradient-boosted trees remain strong defaults, and many production systems are mostly ordinary software with a model in the middle.

Check yourself

In one sentence each: what is the difference between AI, ML, deep learning and an LLM?

AI is the goal of intelligent behaviour by machines; ML is the approach of learning behaviour from data; deep learning is ML with many-layered neural networks trained by gradient descent; an LLM is a deep (transformer) network trained by self-supervision to predict the next token, usually then post-trained to follow instructions.

Why was self-supervision the key to scaling language models?

Because it manufactures labels from raw data: every position in every document supplies a "correct next token" for free. That removed the human-labelling bottleneck and made trillions of training examples available.

A model reaches a loss of 1.5 nats per token. What is its perplexity, and how many bits per token is that?

Perplexity \(e^{1.5} \approx 4.48\). Bits per token \(= 1.5 / \ln 2 \approx 2.16\).

Estimate the training compute of a 7B-parameter model trained on 2 trillion tokens.

\(C \approx 6 \times 7\times10^{9} \times 2\times10^{12} = 8.4\times10^{22}\) FLOPs. At a sustained \(4\times10^{14}\) FLOP/s per GPU (about 40% of an H100's dense BF16 peak), that is \(2.1\times10^{8}\) GPU-seconds, about 58,000 GPU-hours.

Where in the lifecycle would you intervene to make a model (a) know more facts, (b) refuse unsafe requests, © answer faster?

(a) Data and pre-training, or at application time with retrieval. (b) Post-training (preference tuning, constitutional methods) plus guardrails in the application. © Serving: quantisation, batching, KV caching, speculative decoding, or a smaller distilled model.

Why do modern labs train well past 20 tokens per parameter, if Chinchilla says 20 is compute-optimal?

Chinchilla minimises training compute for a given loss. A product pays for inference on every request, and inference cost scales with \(N\). Training a smaller model on more tokens spends extra training compute once to save serving compute forever.

Using the derivation, why does a smaller data exponent β mean data must grow faster?

The optimal data share grows as \(C^{b}\) with \(b = \alpha/(\alpha+\beta)\), so the smaller \(\beta\) is relative to \(\alpha\), the larger \(b\). Intuitively, the data penalty \(B/D^{\beta}\) shrinks slowly as \(D\) grows, so at the optimum, where an extra FLOP must buy the same loss reduction whether spent on \(N\) or on \(D\), you have to push \(D\) further. With \(\alpha = 0.34\) and \(\beta = 0.28\), \(b = 0.55 > a = 0.45\).

Go deeper

Papers

Videos and lectures

Articles and blog posts

  • The Bitter Lesson — Rich Sutton, 2019. Two pages; the most-cited argument for why scale wins.
  • Epoch AI trends — Epoch AI. Live data on compute, cost and hardware; check it whenever you need a number about scale.
  • The 2026 AI Index Report — Stanford HAI. The annual state of the field: research, industry, policy, in charts.

Courses and books

Where this leads