gpt-oss 20B: how much VRAM does it need?
gpt-oss 20B has 20.91B parameters in 24 layers. It uses grouped-query attention: 64 query heads share 8 key-value heads, so its KV cache is 8× smaller than full multi-head attention would need. It is a Mixture-of-Experts model with about 3.60B of its 20.91B parameters active per token: memory has to hold all of them, while each token passes through only the active share. It takes up to 131,072 tokens of context; one user at that length needs 3.10 GiB of KV cache at FP16 on top of the weights.
38.96 GiB of weights, 291 MiB of KV cache and 1.98 GiB of vLLM's overhead. At INT4 the same workload needs 15.08 GiB.
- 24 layers
- hidden 2880
- 64/8 heads
- head_dim 64
- 128k max context
- MoE
gpt-oss 20B memory by precision and context
| Precision | 8k context | 32k context | 128k context |
|---|---|---|---|
| BF16 | 41.22 GiBKV cache 291 MiB | 41.78 GiBKV cache 867 MiB | 44.03 GiBKV cache 3.10 GiB |
| FP8 | 22.82 GiBKV cache 291 MiB | 23.38 GiBKV cache 867 MiB | 25.63 GiBKV cache 3.10 GiB |
| INT4 | 15.08 GiBKV cache 291 MiB | 15.64 GiBKV cache 867 MiB | 17.89 GiBKV cache 3.10 GiB |
One user, FP16 KV cache and vLLM's overhead on one GPU at its defaults for a card under 70 GB. Quantizing shrinks the weights, not the KV cache, so the saving narrows as the context grows.
Which single GPUs hold it
- BF16 (41.22 GiB): RTX 6000 Ada, RTX A6000, AMD Ryzen AI Max+ 395 (64GB), Apple M4 Max (64GB)
- FP8 (22.82 GiB): RTX 5090, Apple M4 Pro, A100 40GB, NVIDIA L40S
- INT4 (15.08 GiB): NVIDIA L4, Apple M4, NVIDIA A30, RTX 3090 / Ti
At 8k context for one user, the smallest cards first. A discrete card is budgeted at vLLM's default 92% of its memory, a unified-memory device at the share its GPU can address, and each carries vLLM's overhead at its own defaults.
How many users fit
| GPU | BF16 | FP8 | INT4 |
|---|---|---|---|
| RTX 4090 | does not fit | does not fit | 21 |
| RTX 5090 | does not fit | 22 | 46 |
| RTX 6000 Ada | 9 | 74 | 98 |
| H100 SXM 80GB | 82 | 131 | 151 |
| RTX PRO 6000 Blackwell | 120 | 169 | 188 |
| AMD Ryzen AI Max+ 395 (128GB) | 123 | 172 | 189 |
| H200 141GB | 230 | 279 | 300 |
| B200 180GB | 321 | 370 | 388 |
Users at 8k context each, on one card. ✗: the weights leave no room for even one.
Fine-tuning gpt-oss 20B
| Method | Memory | Smallest GPU |
|---|---|---|
| Full fine-tune | 312.9 GiB | Apple M3 Ultra (512GB) |
| LoRA (rank 16, attention) | 40.31 GiB | NVIDIA L40S |
| QLoRA (rank 16, attention) | 11.41 GiB | NVIDIA T4 |
Sequence length 2,048, batch size 1, gradient checkpointing on, Adam. Full fine-tuning keeps 16 bytes per parameter before activations; QLoRA stores the frozen base in 4-bit NF4.
Where the numbers come from
Weights are parameters × bytes per parameter. The KV cache is 2 × layers × key-value heads × head dimension × bytes × context × users. For gpt-oss 20B that is 48.0 KiB per token at FP16. 12 of its 24 layers attend over a sliding window of the last 128 tokens and hold no more than that, so past it each further token adds 24.0 KiB, the other 12 layers' share. These are capacity-planning figures: the serving engine — vLLM, TGI, llama.cpp — and its paged-attention efficiency still move the real number.
More on KV cache size and on GQA, MQA and MLA.
Work with gpt-oss 20B
- Size it for your workload
- Fine-tuning memory
- vLLM parameters
- Model anatomy
- Its config.json, explained
- What its files say about serving it