selfhost.directory

The index of self-hostable projects — ranked, categorized and served with live updates.
Own your data and stop giving it to big tech.

openai logo

gpt-oss-20b

openai·Instruct·released 4 Aug 2025

Apache 2.020.9BA4.2BMoE128K ctx ≈13 GB
Your GPU
ollama run gpt-oss:20b
All 7 runners ↓

gpt-oss-20b is an open-weight chat and text generation model from OpenAI, part of the GPT OSS family. It has 20.9B parameters, of which 4.2B are active, and uses a mixture-of-experts design. It accepts text input and produces text output, with a context length of 131,072 tokens. It is released under the Apache 2.0 licence, which permits commercial use. The other size in the family is gpt-oss-120b.

How much VRAM does gpt-oss-20b need?

At Q4_K_M gpt-oss-20b needs about 13 GB with an 8K context (13 GB at Q4, 42 GB at full precision). Pick your GPU to see what fits and how fast it runs.

--vram
any
--gpus
--quant

Needs: ≈12 GB · Q4_K_M · 8K context — Pick a GPU to check the fit.

Change quant, context or KV cache to compare
Advanced: context 8K · KV cache 16-bit
Context
KV cache

Smallest GPU for each quant and context (KV cache 16-bit)

Quantisation4K8K16K32K64K128K
Q3_K_M
Q4_K_M
Q5_K_M
Q6_K
Q8_0
FP16

≤16 GB card24–32 GB48–96 GBmore

QuantisationQualityWeightsKV cacheTotal
Q2_KHeavy lossSmallest, noticeably worse qualityHeavy loss11 GB file0.4 GB≈12 GB
Q3_K_MNoticeable lossSmall, some quality lossNoticeable loss11 GB file0.4 GB≈12 GB
Q4_K_MrecommendedSmall lossRecommended default for local useSmall loss11 GB file0.4 GB≈12 GB
Q5_K_MNear-losslessNear-lossless for most tasksNear-lossless11 GB file0.4 GB≈12 GB
Q6_KNear-losslessPractically losslessNear-lossless11 GB file0.4 GB≈13 GB
Q8_0LosslessLossless in practice, twice the size of Q4Lossless11 GB file0.4 GB≈13 GB
FP16 / BF16LosslessFull precision, as releasedLossless13 GB file0.4 GB≈14 GB

Estimates for 8K tokens of context: weights + KV cache + runtime overhead. All experts stay in memory, but only the active ones are read per token. Speed assumes memory-bound decoding at your GPU’s bandwidth. Pick a GPU above and the fit column checks every row against it. Weights marked “file” use the real GGUF download size; “est.” rows are computed from the parameter count.

How to pick a quant

Take the biggest quant that fits with room left for context. Q4_K_M is the usual sweet spot. Below Q4 quality drops fast, above Q6 you mostly pay memory for nothing. Big models (70B+, large MoE) tolerate low quants better than small ones.

  • LosslessF16, Q8_0
  • Near-losslessQ6_K, Q5_K_M
  • Small lossQ5_K_S, Q4_K_M, IQ4_NL, IQ4_XS, Q4_K_S
  • Noticeable lossQ4_0, Q3_K_L, Q3_K_M, IQ3_M
  • Heavy lossIQ3_XXS, Q3_K_S, IQ2_M, Q2_K

Typical quality loss, not measured per model. Tiers come from KL divergence against FP16 on Llama 3 8B: llama.cpp perplexity README: LLaMA 3 8B scoreboard (KLD and ΔPPL vs FP16, Wikitext-2); llama.cpp quantize tool: ΔPPL per quant type @ Llama-3-8B

How much context fits?

Model quant
KV cache

At 8K context, Q4_K_M needs ≈12 GB(11 GB weights + 0.4 GB KV cache + 1.0 GB overhead). Pick a GPU above to see how much context fits.

051015201K2K4K8K16K32K64K128KGB

Weights + overheadKV cache

Can the Tesla T4 run gpt-oss-20b? →

Speed vs quality per quant

Smaller quants run faster and fit in less memory, but lose quality.

Q2_KQ3_K_MQ4_K_MQ5_K_MQ6_KQ8_0F16

Fits in VRAMTight fitCPU offload✕ won't runQuality is typical KL divergence vs FP16, not measured for this model.

Real-world speed of gpt-oss-20b

Tokens per second measured by people running it at home. A GPU shows a median once 3 reports agree on the same setup. Reports far from our estimate wait for a review. Measure yours with llama-bench →

No medians yet. Be one of the first 3 to report a setup.

All reports

Run gpt-oss-20b locally

--quantQ4_K_Mdefault; pick your GPU to tailor itunsloth/gpt-oss-20b-GGUF

From the Ollama librarydocs
ollama run gpt-oss:20b

The library build picks its own default quantisation.

Q4_K_M straight from Hugging Facedocs
ollama run hf.co/unsloth/gpt-oss-20b-GGUF:Q4_K_M

Install Ollama

OpenAI-compatible server with a web UIdocs
llama-server -hf unsloth/gpt-oss-20b-GGUF:Q4_K_M

Downloads the GGUF on first run. Installed through llama.app? The same flags work with `llama serve`.

Install llama.cpp

Download with the lms CLIdocs
lms get unsloth/gpt-oss-20b-GGUF@Q4_K_M

Then load it from the LM Studio app or with `lms load`.

Install LM Studio

Apple Silicon with mlx-lmdocs
bash
pip install mlx-lm
mlx_lm.generate --model lmstudio-community/gpt-oss-20b-MLX-8bit --prompt "Hello"

Use `mlx_lm.chat` with the same --model for an interactive chat.

OpenAI-compatible serverdocs
mlx_lm.server --model lmstudio-community/gpt-oss-20b-MLX-8bit --port 8080

API on http://localhost:8080/v1.

Install MLX

Serve an OpenAI-compatible APIdocs
vllm serve openai/gpt-oss-20b
Smaller FP8 builddocs
vllm serve amd/gpt-oss-20b-WFP8-AFP8-KVFP8
Docker Compose (NVIDIA)docs
yaml
services:
  vllm:
    image: vllm/vllm-openai:latest
    command: openai/gpt-oss-20b
    ports:
      - "8000:8000"
    ipc: host
    volumes:
      - ~/.cache/huggingface:/root/.cache/huggingface
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: all
              capabilities: [gpu]

API on port 8000.

Install vLLM

Serve an OpenAI-compatible APIdocs
sglang serve openai/gpt-oss-20b --host 0.0.0.0 --port 30000
Docker Compose (NVIDIA)docs
yaml
services:
  sglang:
    image: lmsysorg/sglang:latest
    command: sglang serve openai/gpt-oss-20b --host 0.0.0.0 --port 30000
    ports:
      - "30000:30000"
    ipc: host
    volumes:
      - ~/.cache/huggingface:/root/.cache/huggingface
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: all
              capabilities: [gpu]

API on port 30000.

Install SGLang

Chat with the pipeline APIdocs
python
from transformers import pipeline

pipe = pipeline("text-generation", model="openai/gpt-oss-20b", dtype="auto", device_map="auto")
messages = [{"role": "user", "content": "Explain self-hosting in one paragraph."}]
out = pipe(messages, max_new_tokens=512)
print(out[0]["generated_text"][-1]["content"])

Install Transformers

Benchmarks

BenchmarkScoreRankSourceDate
MMLU-Pro73.6%#55 / 409 independentJun 2026
GPQA Diamond58.6%#75 / 104 independentApr 2026
Humanity's Last Exam8.8%#61 / 63 self-reportedAug 2025
SWE-bench Verified53.2%#54 / 57 self-reportedAug 2025
LMArena Text1287#69 / 127 independentOct 2026

Self-reported scores come from the model card and are not independently verified. Rank is among all models with a score on that benchmark.

Quantised versions and downloads

RepositoryFormatQuantSizeDownloads
unsloth/gpt-oss-20b-unsloth-bnb-4bitSafetensorsBNB-4BIT—75.4K
unsloth/gpt-oss-20b-bnb-4bitSafetensorsBNB-4BIT—548
amd/gpt-oss-20b-WFP8-AFP8-KVFP8SafetensorsFP8—494
unsloth/gpt-oss-20b-GGUFGGUFQ3_K_S11 GB602K
unsloth/gpt-oss-20b-GGUFGGUFQ2_K11 GB602K
unsloth/gpt-oss-20b-GGUFGGUFQ3_K_M12 GB602K
unsloth/gpt-oss-20b-GGUFGGUFQ4_012 GB602K
unsloth/gpt-oss-20b-GGUFGGUFQ4_112 GB602K
unsloth/gpt-oss-20b-GGUFGGUFQ4_K_S12 GB602K
unsloth/gpt-oss-20b-GGUFGGUFQ4_K_M12 GB602K

About gpt-oss-20b

Welcome to the gpt-oss series, OpenAI’s open-weight models designed for powerful reasoning, agentic tasks, and versatile developer use cases. We’re releasing two flavors of these open models: - gpt-oss-120b — for production, general purpose, high reasoning use cases that fit into a single 80GB GPU (like NVIDIA H100 or AMD MI300X) (117B parameters with 5.1B active parameters) - gpt-oss-20b — for lower latency, and local or specialized use cases (21B parameters with 3.6B active parameters) Both models were trained on our harmony response format and should only be used with the harmony format as it will not work correctly otherwise.

Full model card on Hugging Face →

Other GPT OSS models

Whole family →
openai logo117BA5.8BCommercial OK≈70 GB↓ 2.4M

Alternatives to gpt-oss-20b

All alternatives →

NVIDIA Nemotron™ is a family of open models with open weights, training data, and recipes, delivering leading efficiency and accuracy for building specialized AI agents.

31.6BA3B256K ctx openmdw-1.1
1.1MAug 2026gguf
LiquidAI logo

LFM2.5-24B-A2B

LiquidAI·Chat

≈15 GB

LFM2.5-24B-A2B is a 24B-parameter reasoning model with only 2B active parameters, built for fast, private agents on-device. It is the largest and final model in the LFM2.5 family, which now spans two orders of magnitude: from LFM2.5-230M to LFM2.5-24B-A2B.

24BA2B128K ctx lfm1.0
36.2KOct 2026gguf
farbodtavakkoli logo

OTel-2.0-LLM-31B-IT

farbodtavakkoli·Chat

≈27 GB

Versioning notice: This card describes the current OTel 2.0 OSFT checkpoint. The model weights may be updated over time. For reproducible evaluation or production deployment, pin a specific model revision, checkpoint hash, or release tag rather than relying on the floating latest version.

31.3B256K ctx Apache 2.0
633.7KJul 2026gguf
Qwen logo

Qwen3-14B

Qwen·Chat

≈11 GB

Qwen3 is the latest generation of large language models in Qwen series, offering a comprehensive suite of dense and mixture-of-experts (MoE) models.

14.8B40K ctx Apache 2.0
12.9MApr 2025ollama
ornith-ai logo

Ornith-1.0-35B

ornith-ai·Chat

≈22 GB

Aloha! 🌺 Today, we are releasing Ornith-1.0, a self-improving family of open-source models for agentic coding.

35BA3.8B256K ctx MIT
1.5MJun 2026gguf
poolside logo

Laguna-XS-2.1

poolside·Chat

≈22 GB

Laguna XS 2.1 is a 33B total parameter Mixture-of-Experts model with 3B activated parameters per token designed for agentic coding and long-horizon work on a local machine.

33.4BA2.2B256K ctx Custom licence
734.1KJun 2026ollama

gpt-oss-20b FAQ

How much VRAM does gpt-oss-20b need?
About 13 GB at Q4_K_M with an 8K context. Q8_0 needs about 23 GB and full precision about 42 GB. Longer contexts need more memory for the KV cache.
Can gpt-oss-20b run on the Tesla T4?
Yes. It fits at FP16 / BF16 (about 14 GB), at an estimated 21 tokens/s. It fits comfortably on the Arc A770 16GB, Radeon RX 7800 XT, Tesla P40.
Can I use gpt-oss-20b commercially?
Yes. It is released under Apache 2.0. Permissive: use, modify and sell freely; keep the notice and licence text.
What is the context length of gpt-oss-20b?
131,072 tokens (128K). The full window needs far more memory than an 8K context.
How do I run gpt-oss-20b with Ollama or llama.cpp?
With Ollama: ollama run gpt-oss:20b. With llama.cpp: llama-server -hf unsloth/gpt-oss-20b-GGUF:Q4_K_M, which starts an OpenAI-compatible server.

Data from Hugging Face, the model card and public leaderboards. Memory and speed figures are estimates; real numbers depend on the runtime, context length and drivers. Always check the licence yourself before commercial use.