gpt-oss · OpenAI
gpt-oss-120b
gpt-oss-120b from OpenAI has 116,829,156,672 parameters, of which about 5.71B are used for each token (a mixture of experts). Its weights take 234 GB in BF16 and about 58.4 GB at 4-bit (as released, with MXFP4 experts: 65.2 GB), and each token of context adds 73.7 KB of KV cache (2.4 GB at 32K tokens).
Part of the gpt-oss family: 20.9B · 117B
Architecture · VRAM · KV cache · Tensor shapes · Parameter count · FLOPs
Architecture
| Architecture | GptOssForCausalLM |
|---|---|
| Layers (L) | 36 |
| Hidden size (d) | 2,880 |
| Attention | GQA (8 query heads share each KV head); a learned sink per head |
| Heads | 64 query, 8 key/value, 64 each |
| Feed-forward | 128 experts of 2,880, 4 per token (SwiGLU), with biases |
| Vocabulary (V) | 201,088 |
| Tied embeddings | no: separate output head |
| Biases | on q, k, v and the output projection; on the router and every expert |
| Extra norms | pre-norm (RMSNorm before attention and FFN) |
| Max context | 131,072 tokens; 18 of 36 layers use a 128-token sliding window |
| Weights in the release | MXFP4 experts (4.25 bits a weight), BF16 for the rest |
How much memory the weights need
Each parameter takes 4 bytes in FP32, 2 in BF16, 1 at 8 bits and half a byte at 4 bits, so the weights alone need:
| Precision | Bytes per parameter | Weights | |
|---|---|---|---|
| FP32 | 4 | 467 GB | 435.22 GiB |
| BF16 / FP16 | 2 | 234 GB | 217.61 GiB |
| INT8 / FP8 | 1 | 117 GB | 108.81 GiB |
| INT4 | 0.5 | 58.4 GB | 54.40 GiB |
| As released | mixed | 65.2 GB | 60.77 GiB |
GB here is 109 bytes; GiB (230) is what tools like nvidia-smi show. Real 4-bit files are a little larger: they also store scales, and some layers are often kept at higher precision. Every expert has to be in memory, not just the active ones: the router picks different experts for each token. A running model also needs its KV cache, activations and the runtime's own buffers.
How the experts are stored: MXFP4
gpt-oss-120b is released with its expert weights already quantized to MXFP4: each run of 32 weights shares one 8-bit power-of-two scale, and each weight is a 4-bit float, two to a byte. In the files every expert matrix becomes two U8 tensors, e.g. gate_up_proj_blocks [128, 5,760, 90, 16] (16 bytes hold 32 weights) and gate_up_proj_scales [128, 5,760, 90].
The parameter count on this page is the logical one: 114,661,785,600 expert weights, whatever their storage. Stored, they take 114,661,785,600 ÷ 2 = 57,330,892,800 bytes of blocks plus 114,661,785,600 ÷ 32 = 3,583,180,800 bytes of scales: 4.25 bits a weight, 60.9 GB in all. Attention, the router, the embedding and the head (2,167,371,072 parameters) stay in BF16, 4.3 GB.
4.3 GB + 60.9 GB = 65.2 GB of weights as released
On common GPUs
Whether the weights plus a 8K-token KV cache fit in 90% of the card (how this is worked out):
KV cache
Every layer keeps a key and a value vector for each of its 8 KV heads, for every token in the context:
2 × L × K × h × 2 bytes = 2 × 36 × 8 × 64 × 2 = 73,728 bytes per token
Grouped-query attention is why this is small: with a KV head for each of the 64 query heads it would be 8 times larger.
| Context | KV cache, BF16 | 8-bit KV | With the sliding window | Weights + KV, BF16 |
|---|---|---|---|---|
| 4K | 302 MB | 151 MB | 156 MB | 234 GB |
| 32K | 2.4 GB | 1.2 GB | 1.2 GB | 236 GB |
| 128K (max) | 9.7 GB | 4.8 GB | 4.8 GB | 243 GB |
In the config, 18 of 36 layers use a 128-token sliding window. Runtimes that honour it never cache more than 128 tokens for those layers; the column shows what that saves.
For one sequence. Batching multiplies the KV cache by the number of sequences, not the weights.
Every tensor shape
The names are those in the Hugging Face checkpoint; shapes are [out, in] for weight matrices, as PyTorch stores them. One block is shown: the model repeats it 36 times.
| Tensor | Shape | Parameters |
|---|---|---|
| Embedding | ||
model.embed_tokens.weight | [201,088, 2,880] | 579,133,440 |
| Every block: model.layers.N.… | ||
self_attn.q_proj.weight | [4,096, 2,880] | 11,796,480 |
self_attn.q_proj.bias | [4,096] | 4,096 |
self_attn.k_proj.weight | [512, 2,880] | 1,474,560 |
self_attn.k_proj.bias | [512] | 512 |
self_attn.v_proj.weight | [512, 2,880] | 1,474,560 |
self_attn.v_proj.bias | [512] | 512 |
self_attn.o_proj.weight | [2,880, 4,096] | 11,796,480 |
self_attn.o_proj.bias | [2,880] | 2,880 |
self_attn.sinksone learned "sink" score per head, so a head can attend to nothing | [64] | 64 |
mlp.router.weightthe router: one score per expert | [128, 2,880] | 368,640 |
mlp.router.bias | [128] | 128 |
mlp.experts.gate_up_projstored as MXFP4: _blocks (two 4-bit values per byte) and _scales (one per 32 values) | 128 × [5,760, 2,880] | 2,123,366,400 |
mlp.experts.gate_up_proj_biasbiases stay in BF16 | 128 × [5,760] | 737,280 |
mlp.experts.down_proj | 128 × [2,880, 2,880] | 1,061,683,200 |
mlp.experts.down_proj_bias | 128 × [2,880] | 368,640 |
input_layernorm.weight | [2,880] | 2,880 |
post_attention_layernorm.weight | [2,880] | 2,880 |
| After the last block | ||
model.norm.weightfinal norm | [2,880] | 2,880 |
lm_head.weightscores every token in the vocabulary | [201,088, 2,880] | 579,133,440 |
The parameter count, step by step
Each line gives the formula, the numbers from config.json, and the subtotal. The symbols:
- V
- vocabulary 201,088
- d
- hidden size 2,880
- L
- layers 36
- H
- query heads 64
- K
- key/value heads 8
- h
- head size 64
- E
- routed experts 128
- k
- experts per token 4
- f_e
- expert FFN size 2,880
1. Embedding
One row of d numbers for each of the V tokens in the vocabulary.
2. Every block, ×36
3. Final norm and output head
4. Total
5. Active parameters per token
The router sends each token to 4 of the 128 experts in each MoE block, so only those experts' weights are used. One routed expert is 24,891,840 parameters.
OpenAI's model card gives 5.13B active: the same count without the 579M embedding table, which is a lookup rather than a multiply.
Hugging Face counts 116,829,156,672 parameters in the openai/gpt-oss-120b safetensors files (it counts the MXFP4 experts as logical weights, two per stored byte, and leaves the scales out). The arithmetic above matches exactly.
FLOPs per token
A forward pass costs about two floating-point operations (a multiply and an add) for every weight a token passes through: 2 × N, with N the active weights used in matrix multiplies (the embedding lookup is a read, not a multiply; the output head is a multiply). Here that is 2 × 5,711,982,912 = 11.4 GFLOPs per token.
Attention adds the work of comparing the token with every earlier one: 2 × L × T × H × (hqk + hv) for T tokens of context, which grows with the context while 2N does not. Layers with a window see at most 128 tokens, which the table allows for.
That is for one new token at position T, as when generating. Averaged over a whole training sequence of length T, each token sees T/2 earlier ones on average, which halves it.
| Context T | 2N | Attention | Total per token |
|---|---|---|---|
| 4K | 11.4 GFLOPs | 1.2 GFLOPs | 12.7 GFLOPs |
| 32K | 11.4 GFLOPs | 9.7 GFLOPs | 21.1 GFLOPs |
| 128K | 11.4 GFLOPs | 38.7 GFLOPs | 50.1 GFLOPs |
Training costs about three times the forward pass per token (6N): the backward pass does roughly twice the forward work.
Compare
gpt-oss-120b vs Llama 4 Scout (17B-16E) · Compare with any model →
Close in size: Llama 4 Scout (17B-16E) 108B · Mixtral 8x22B 141B · Qwen2.5 72B 72.7B · Llama 3.1 70B 70.6B · Llama 3.3 70B 70.6B
Source
Read from openai/gpt-oss-120b, fetched 2026-12-02.