What gpt-oss combines
gpt-oss-20b is a decoder-only transformer with four features this page follows. Its 24 blocks alternate between sliding-window attention over the last 128 tokens and full attention over every earlier token. Every head has a learned attention sink, an extra term in its softmax. Each MLP is a mixture of 32 experts, of which 4 run for each token, and the experts are stored in the 4-bit MXFP4 format. The model has 20,914,757,184 parameters, 4,187,440,704 of them active per token, and its checkpoint is 13.8 GB.
The recording runs the real checkpoint one block at a time, on the CPU in float32. The prompt, in OpenAI's Harmony chat format, is the opening paragraph of Conan Doyle's A Scandal in Bohemia without its last sentence, followed by Who is “the woman” in this passage? Answer with her name. The model answers Irene Adler. The page stops after its first reasoning words, We know it's, where the next token is Irene with probability 0.911.
Sliding and full blocks
Both kinds of block are causal. In a sliding block, query reads only keys to ; in a full block it reads every key from 0 to . At the last position, 305, a sliding block therefore sees keys 178 to 305, while the passage names Irene Adler once, at positions 114 and 115. Only full blocks can read the name. The Every block · what “it's” at 305 reads panel draws that row's attention in every block: in sliding blocks every key before 178 is exactly 0, and full block 22, head 32 puts 0.957 of its attention on Irene Adler.
Attention is grouped-query: 64 query heads of 64 dimensions share 8 key and value heads, each serving 8 query heads. Every projection has a bias, and each block normalises its input with RMSNorm before attention and before the experts.
Learned attention sinks
A softmax makes a head's weights sum to one, so a head with nothing useful to read must still put its weight somewhere. Trained models often park it on the first token. gpt-oss gives each head one learned logit that joins the softmax's denominator but belongs to no token and carries no value:
where is the set of keys query may read. The sink's share is simply dropped, so a head can attend to almost nothing. A sink also stays in view when the first token has slid out of a 128-token window. The head card draws it as an extra key column; in the default view, block 22, head 32, and the sink takes 0.6 % of the last row. The Learned sinks panel maps the share in all 24 × 64 heads.
RoPE with YaRN
Positions enter through rotary embedding with base 150,000. To reach 131,072 positions from the 4,096 the rotation was first set for, gpt-oss applies YaRN with factor 32: slowly rotating frequencies are stretched by 32, fast ones are left alone, and those in between are blended. YaRN also scales cos and sin by , so every query–key score grows by ; this is YaRN's temperature correction for the stretched positions.
Top-4 experts and the clamped SwiGLU
A linear router with a bias scores the 32 experts, keeps the 4 largest and softmaxes over just those 4; the other 28 experts are not run:
Each expert is a SwiGLU from 2880 to 2880 with two changes: the gate and up projections are clamped at 7, and the gate's sigmoid is sharpened by 1.702:
The Top-4 routing panel shows how unevenly the router uses its experts: in block 22, expert 24 takes 277 of the 306 tokens and 3 experts get none.
MXFP4 experts
OpenAI released the expert weights only in MXFP4, a microscaling format. Weights are stored in groups of 32 that share one 8-bit scale, a power of two; each weight is a 4-bit float (E2M1) taking one of the values :
Sixteen bytes hold the 32 codes and one more byte the exponent : 17 bytes for 32 weights, 4.25 bits each. The MXFP4 expert panel decodes one group of expert 28 in block 12, whose scale byte 119 means . That expert's gate-and-up matrix has 16,588,800 weights in 8.8 MB, against 33.2 MB in bfloat16. Since no unquantised expert exists, the page shows the format's rounding error on block 12's query projection instead, rounded with the same scheme: a relative RMS error of 12.0 %.
Where these ideas came from
Child et al. (2019) used fixed sparse attention patterns, including local bands, for long sequences, and GPT-3 (Brown et al., 2020) alternated dense and locally banded layers as gpt-oss does. Xiao et al. (2023) found that models park attention on the first tokens and that keeping those tokens lets a sliding window run indefinitely; a learned sink makes that dump explicit. Mixtures of experts go back to Shazeer et al. (2017), and the MX formats to Rouhani et al. (2023). The LG tab shows Gemma 3's five-to-one mix of local and global layers, and the MoE tab a top-8 router over 32 experts.
Papers
- gpt-oss-120b & gpt-oss-20b Model Card The model this page records: alternating banded and dense attention, learned sinks, top-4 mixture of experts in MXFP4 and the Harmony chat format.
- Efficient Streaming Language Models with Attention Sinks Attention sinks: models dump attention on the first tokens, and keeping them lets sliding-window decoding run on.
- Microscaling Data Formats for Deep Learning The MX formats, MXFP4 among them: blocks of 32 low-bit values sharing one power-of-two scale.
- Generating Long Sequences with Sparse Transformers Sparse attention patterns, including local bands, that later models alternate with dense attention.
- Language Models are Few-Shot Learners GPT-3, which alternates dense and locally banded sparse attention layers, the pattern gpt-oss returns to.
- YaRN: Efficient Context Window Extension of Large Language Models The RoPE extension gpt-oss uses to reach 131,072 positions, with its attention scale factor.
- Outrageously Large Neural Networks: The Sparsely-Gated Mixture-of-Experts Layer The sparsely gated mixture-of-experts layer: a router picks a few experts per token from many.
See also
- AttentionSinks Attention sinks · StreamingLLM
- AttentionWindow Sliding-window attention · Gemma 3
- AttentionYaRN YaRN · RoPE stretched past the trained context · Qwen2.5
- EfficiencyFP8 FP8 · E4M3 weights and activations with per-tensor scales
- AttentionCompare KV heads compared · MHA, MQA and GQA on the same prompts
- PretrainingArch ladder GPT-2 to gpt-oss · one architecture change at a time on the same run