最关键的一点:MXFP4 就是原版
本站几乎所有其他模型都是 BF16 发布、社区事后量化,所以"找 Q4_K_M"是对的直觉。GPT-OSS 打破了这个直觉:OpenAI 在后训练阶段就把 MoE 权重做成了 MXFP4(约 4.25 bit),而 MoE 权重占参数量 90% 以上。这份 MXFP4 权重不是某个更好版本的有损副本——它本身就是模型。把它转成 Q8_0 或平移到 Q4_K_M,只会得到一个更大但并不更准的文件,因为你补回去的精度从来就不存在。
gpt-oss-20b MXFP4 (native) ~12.8 GB ← use this
gpt-oss-20b Q8_0 (upcast) ~13.8 GB bigger, not better
gpt-oss-120b MXFP4 (native) ~61 GB ← use this
Rule: for GPT-OSS, "bigger quant" buys you nothing.
Spend the VRAM on context length instead.按你的显卡估算
20B 在 16GB 卡上可跑,且还剩下够用的上下文空间。注意 GPT-OSS 的 head dim 是 64 而非常见的 128,同层数下 KV cache 直接减半——长上下文在这个模型上便宜得反常。用显存计算器时记得选 MXFP4 档;选 Q4_K_M 会把权重高估约 14%。
gpt-oss-20b @ MXFP4, batch=1
weights ~12.8 GB
KV cache @ 8K ctx ~0.4 GB
KV cache @ 32K ctx ~1.5 GB
KV cache @ 131K ctx ~6.2 GB
16GB card → comfortable to ~32K ctx
24GB card → full 131K ctx with headroom最省事:Ollama
Ollama 默认拉取的就是 MXFP4 构建,没有量化档位可选,也就不会误拿到重新量化的版本。除非你需要自定义参数,否则从这里开始最合适。
ollama pull gpt-oss:20b
ollama run gpt-oss:20b
# 120B — needs ~61GB of combined VRAM+RAM
ollama pull gpt-oss:120b
# OpenAI-compatible endpoint stays on :11434
curl http://localhost:11434/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model":"gpt-oss:20b","messages":[{"role":"user","content":"hi"}]}'llama.cpp:必须加 --jinja,否则输出会很怪
GPT-OSS 使用 OpenAI 的 "harmony" 响应格式训练,该格式把推理通道与最终回答分开。这个结构写在模型的 chat template 里,所以 llama.cpp 需要 --jinja 才会套用。不加这个参数,你会看到通道标记直接漏进回复里,或者模型停不下来——这个现象很像量化坏了,其实纯粹是模板问题。
# 20B, all layers on a 16GB+ GPU
llama-server \
-hf ggml-org/gpt-oss-20b-GGUF \
--jinja \
-ngl 99 \
--ctx-size 32768 \
--host 0.0.0.0 --port 8080
# --jinja applies the harmony chat template (do not omit)
# -ngl 99 offload every layer to the GPU
# --ctx-size raise freely — KV cache is cheap on this model在 24GB 消费级显卡上跑 120B
这正是 MoE 架构的价值所在。每个 token 只激活 5.1B 参数,专家权重是稀疏读取的——因此它们最适合留在系统内存里。把注意力层和稠密层放显卡、MoE 专家推给 CPU,61GB 的模型就能在 24GB 卡上跑起来。速度不快,但这和"装不下"是两种结果。
# Offload the MoE experts of N layers to CPU RAM
llama-server \
-hf ggml-org/gpt-oss-120b-GGUF \
--jinja \
-ngl 99 \
--n-cpu-moe 28 \
--ctx-size 16384
# Tune --n-cpu-moe down until you OOM, then back off by 2.
# Lower value = more experts on GPU = faster.
# Needs ~64GB system RAM. Expect single-digit tok/s.推理强度是可调的,不是固定开销
GPT-OSS 支持 low / medium / high 三档推理强度。high 会在回答前消耗多得多的 token 思考,在本地硬件上这就是"响应利落的助手"和"卡一分钟"的区别。日常对话和补全用 low,只在真正需要思维链的问题上开 high。
Simplest portable form — put it in the system message:
System: Reasoning: low
Rough local cost on a 16GB card (20B):
low fast, chat-grade latency
medium noticeably more thinking tokens
high can multiply time-to-first-answer several times over
Start at low. Raise it per-task, not globally.常见故障对照
本地跑 GPT-OSS 报的问题绝大多数是以下四种之一,且没有一种是量化的锅。换构建之前先对照检查。
Channel markers in the output, or it never stops
→ missing --jinja (harmony template not applied)
"unknown model architecture" on load
→ llama.cpp / Ollama predates gpt-oss support; update
Slower than expected on the 120B
→ --n-cpu-moe too high; lower it until GPU VRAM is nearly full
File is much bigger than ~12.8GB (20B)
→ you downloaded an upcast build; get the MXFP4 one接下来
看看 🟢 RTX 4090 还能跑哪些模型反向查询 —— 24GB、32768 上下文,按质量排序本文涉及的模型