↑↓ move Enter open ⌘K find from any page 256 of 256 tabs
Loading the recording…

Six years of changes, one at a time

GPT-2 (2019) and gpt-oss (2025) are both decoder-only transformers trained to predict the next token, yet almost every part between the embedding and the output was replaced in between. Published comparisons change several things at once and train at different scales, so it is hard to say what each change buys. This tab climbs a ladder: it starts from a GPT-2-style model and adds one change per rung, keeping everything else the same.

Every rung is the shared small GPT of the Pretraining tabs, 4 layers of width 256 with 4 heads, a context of 256 tokens and the output layer tied to the token embedding, trained for 1,000 steps of 8,192 TinyStories tokens (8.2M tokens) on the same batches, with AdamW at the AdamW tab's peak learning rate of 4e-3, 100 warmup steps, cosine decay to a tenth of the peak, and the gradient norm clipped to 1. Each weight is drawn from a generator seeded by the run's seed and the weight's name, so weights that two rungs share start identical. The rungs:

  • GPT-2: learned position embeddings, LayerNorm before each block, a 4× GELU MLP, four heads with their own keys and values;
  • + RoPE: rotary positions instead of the learned table;
  • + RMSNorm instead of LayerNorm;
  • + SwiGLU: a gated MLP, then , with a hidden size of 680, of the width, so the parameters stay the same;
  • + GQA: grouped-query attention, two key/value heads shared by the four query heads;
  • + MoE: eight SwiGLU experts of half the size, two per token, chosen by a router, with a load-balancing loss;
  • + sinks + sliding window: gpt-oss's attention, a learned sink logit per head and a 64-token window on every other layer.

The real gpt-oss differs in more ways (YaRN-scaled rotary positions, a clamped SwiGLU, 32 or 128 experts with four active, untied embeddings, 128-token windows at a much longer context); the ladder keeps the changes that its architecture is known for, at this model's size.

What each change bought

The What each change bought panel lists each rung's final validation loss on 128 TinyStories windows. GPT-2 ends at 2.178 and the last rung at 2.002, 0.176 nats lower. Before reading the steps in between, the noise: the first and last rungs were trained a second time with seed 1, and the two seeds end 0.021 apart for GPT-2 and 0.010 apart for the last rung, with differences of up to 0.046 and 0.057 along the way. A change smaller than that is not a result at this scale.

By that measure one change stands out. RoPE lowers the final loss by 0.148, and the Over training panel shows that its lead was larger earlier: 0.37 nats at step 100 and 0.21 at step 500. SwiGLU (−0.040) and the sinks and sliding window (−0.029) end ahead by more than the seeds' final spread but by less than the seeds drift apart during training, so they are likely gains, not certain ones. RMSNorm (+0.025), GQA (+0.002) and the mixture of experts (+0.015) are within it: at 8.2M tokens this experiment cannot tell them from no change. That is not a statement about large models, where the mixture of experts in particular is chosen for what it does at scale.

Where each change shows inside

Final losses hide most of what changed. The Inside panel measures each rung's final weights on 32 validation windows.

RoPE rotates each query and key by an angle proportional to its position, so the score between two tokens depends on how far apart they are. In the Attention by distance panel, the weight a query gives the token right before it rises in the middle layers, from 0.079 and 0.059 in layers 1 and 2 with learned positions to 0.152 and 0.190, while layer 0, which already leaned on the previous token, goes from 0.155 to 0.134. Removing the position table also removes 65,536 parameters.

RMSNorm divides by the root mean square without first subtracting the mean. With LayerNorm, whatever the stream holds along the all-ones direction is invisible to the next block, and the models keep it below 0.01 % of each token's squared size; with RMSNorm it is 0.42 % to 0.66 %, about what a random direction in 256 dimensions gets (0.39 %).

SwiGLU makes the MLP's hidden activations signed: in the rung before, GELU's are negative 73 % to 91 % of the time and then small, while SiLU(gate) × up is negative half the time (49.8 % to 50.2 %) in every layer.

GQA halves what has to be cached per token for generation, from 2,048 numbers (keys and values of 4 heads in 4 layers) to 1,024, and saves 262,144 parameters. It also makes the heads that share keys and values attend alike: averaged over layers, their attention patterns' similarity (one minus the Jensen–Shannon divergence) is 0.59, against 0.45 for heads that do not share, while the same pairs in the multi-head model score 0.50 and 0.45.

Experts and sinks

The mixture of experts holds 22.02M parameters but uses 15.75M per token, the same as the dense model. Its router specializes without being told to: in layer 0 one expert takes "Once", "Tim", "mom" and "little" far more often than they occur, another the end-of-text token, "Lily", "Tom" and "upon"; in layer 1 one takes the pronouns "She", "They" and "He". The balance loss keeps every expert in use, between 8 % and 27 % of the routed slots at the end, but not evenly as first choice: on the 32 windows measured, one expert in layer 0 is never any token's first choice and is only ever picked second.

Attention sinks were observed by Xiao et al.: large language models put much of their attention on the first tokens of a sequence when they have nowhere useful to look. gpt-oss gives each head a learned logit that enters the softmax like an extra key and is then dropped,

so a head can give part of its attention to nothing. Here the heads use it most where they see least: the two sliding-window layers, which attend to the last 64 tokens only, send 14.4 % and 8.0 % of their attention to the sink, the two full layers 1.7 % and 5.3 %. None of the rungs piles attention on the window's first token (at most 0.6 % in any layer), so at this size the learned sink adds an option rather than replacing an emergent sink.

Where it came from

GPT-2 set the starting point. Su et al.'s RoFormer introduced rotary positions; Zhang and Sennrich proposed RMSNorm; Shazeer compared gated MLPs and found SwiGLU best; LLaMA combined these three into the layout most open models then copied. Ainslie et al. introduced grouped-query attention as the middle ground between multi-head and multi-query attention. Shazeer et al. and then Fedus et al.'s Switch Transformer made sparse mixtures of experts practical, with the load-balancing loss used here. Xiao et al. described attention sinks, and the gpt-oss model card combines learned sinks with alternating sliding-window and full attention. The Attention explainer's RoPE and YaRN tabs show rotary positions in a full-size model; the Init & norm tab compares LayerNorm and RMSNorm placements in a deeper network.

Papers

  1. Language Models are Unsupervised Multitask Learners Alec Radford et al. · 2019 GPT-2, the bottom rung: learned positions, pre-LayerNorm, a GELU MLP and multi-head attention.
  2. gpt-oss-120b & gpt-oss-20b Model Card OpenAI · arXiv 2025 The top rung's model: rotary positions, RMSNorm, SwiGLU experts, grouped-query attention, learned attention sinks and alternating sliding-window layers.
  3. RoFormer: Enhanced Transformer with Rotary Position Embedding Jianlin Su et al. · arXiv 2021 Rotary position embedding, the change that buys the most here.
  4. Root Mean Square Layer Normalization Biao Zhang et al. · NeurIPS 2019 RMSNorm: normalizing by the root mean square without centring.
  5. GLU Variants Improve Transformer Noam Shazeer · arXiv 2020 Compares gated MLPs and finds SwiGLU best, with the hidden size cut to 2/3 to keep the parameters.
  6. GQA: Training Generalized Multi-Query Transformer Models from Multi-Head Checkpoints Joshua Ainslie et al. · EMNLP 2023 Grouped-query attention: a few key/value heads shared by groups of query heads.
  7. Switch Transformers: Scaling to Trillion Parameter Models with Simple and Efficient Sparsity William Fedus et al. · JMLR 2022 A sparse mixture of experts with a router and the load-balancing loss the MoE rung uses.
  8. Efficient Streaming Language Models with Attention Sinks Guangxuan Xiao et al. · ICLR 2024 Finds that language models dump attention on the first tokens and keeps them as sinks; gpt-oss learns a sink instead.

See also