This document is relevant for: Trn2, Trn3

GPT-OSS Model Recipe#

Introduction#

gpt-oss is an open-weight Mixture-of-Experts (MoE) language model family released by OpenAI, designed for strong reasoning, tool use, and long-context generation. The published checkpoints ship with MXFP4-quantized expert weights.

gpt-oss is supported for inference serving with vLLM using the Neuron SDK on AWS Trainium2 (trn2) and Trainium3 (trn3) hardware.

Compatible model checkpoints:

Model

HuggingFace

Hardware

Quantization

gpt-oss-20b

openai/gpt-oss-20b

Trn2, Trn3

BF16 (Trn2), MXFP4 (Trn3)

gpt-oss-120b

openai/gpt-oss-120b

Trn2, Trn3

BF16 (Trn2), MXFP4 (Trn3)

On Trn3, MXFP4-quantized weights are auto-selected from the published checkpoints. On Trn2, both models run in BF16. MXFP4 is Trn3 only.

Features#

Per-model feature availability for gpt-oss. See the features guide for configuration details.

Category

Feature

Status

Inputs

Text

✅

Quantization

MXFP4 weights (Trn3)

✅

BF16 weights (Trn2)

✅

KV cache FP8

✅

Parallelism

Tensor parallelism (TP)

✅

Data parallelism (DP)

✅

Expert parallelism (EP)

✅

Pipeline parallelism (PP)

❌

Performance

Continuous batching

✅

Segmented prefill

✅

Prefix caching (APC)

✅

Speculative decoding (EAGLE3)

✅

Speculative decoding (P-EAGLE)

✅

Disaggregated inference (1P1D / xPyD)

✅

Decode megakernel at LNC=1 (Trn3, DI decode, 120B)

✅

EAGLE3 with the decode megakernel (Trn3, DI decode, 120B; see EAGLE3 with the decode megakernel)

✅

On-device sampling (greedy, top-k, top-p)

✅

Serving

Structured outputs / tool calling

✅ (asynchronous scheduling needs MXFP4, the native route, no speculative decoding, the per-layer decode (gk_decode: false), and a batch queue depth of 2; otherwise use --no-async-scheduling. See Structured outputs on MRv2)

Compilation

torch.compile (XLA backend)

✅

CPU mode (testing)

✅

Runtime

Model Runner V2

✅ (the default, also for the decode megakernel). EAGLE3 with the decode megakernel: MRv2 only

Status legend:

  • ✅ Supported: integrated and tested for gpt-oss

  • ❌ Not supported: may be considered for future releases

This model runs on Model Runner V2 (MRv2) by default. EAGLE3 with the decode megakernel runs on MRv2 only.

The deployment tutorial walks through deploying gpt-oss 20B and 120B on Trn3 (MXFP4) or Trn2 (BF16) via two paths: a single-instance server and a disaggregated-inference (separate prefill and decode) deployment.

EAGLE3 with the decode megakernel#

On the decode server of a disaggregated deployment, the decode megakernel also verifies EAGLE3 drafts. One kernel runs all decoder layers on the last token and the draft tokens of each sequence. As an option, one NKI kernel also runs the whole EAGLE3 draft step. This configuration runs on MRv2 only.

These values are the validated configuration:

Setting

Validated value

Hardware and weights

Trn3, openai/gpt-oss-120b with MXFP4 weights

Draft model

RedHatAI/gpt-oss-120b-speculator.eagle3, num_speculative_tokens 3

Deployment

Six prefill replicas and one decode server (6P1D) on two Trn3 instances, as in the 8K/1K tutorial

Decode server

TP8 DP16 EP128 at NEURON_LOGICAL_NC_CONFIG=1, --max-num-seqs 8, num_seqs_buckets: [8], embedding_dp_size: 1, and lm_head_dp_size: 16

Prefill replicas

TP4 DP1 EP2 at NEURON_LOGICAL_NC_CONFIG=2, with the same EAGLE3 draft model

KV cache

Packed FP8 on both roles: --kv-cache-dtype fp8 --block-size 128 and neuron_config.fp8_packed_kv

Shape

8,192 input tokens and 1,024 output tokens, --max-model-len 10240

Compile route

VLLM_NEURON_BACKEND=neuron_native

rejection_sample_method

standard (the default) or synthetic

Set this configuration for the EAGLE3 servers. A decode server that does not meet a requirement of the decode megakernel uses the per-layer decode. With neuron_config.gk_decode: true, it stops at startup and gives the reason.

  • Set VLLM_USE_V2_MODEL_RUNNER=1 on the decode server. Without it, the decode server uses the per-layer decode. The prefill replicas use MRv2 by default.

  • Keep neuron_config.gk_variant unset on the decode server, or set it to c128. The c512 and c1024 decode megakernels have no form that verifies drafts.

  • Keep num_speculative_tokens 3 and the packed FP8 KV cache on the decode server. The decode megakernel verifies drafts only in this validated setup.

  • Set VLLM_NEURON_DRAFT_GIGA_KERNEL=1 on the decode server to run the draft step as one kernel. The kernel is off by default. Keep it off on the prefill replicas. No prefill step uses the kernel, and the flag makes the PyTorch draft slower.

  • Set VLLM_NEURON_NIXL_PROGRESS_THREAD_DELAY_US=1000 on the decode server. The prefill replicas use 250.

  • Set VLLM_NEURON_RESERVED_HEADROOM_GIB=12.04 on the decode server.

  • Set VLLM_NEURON_RESERVED_HEADROOM_GIB=15.5 and VLLM_NEURON_MIN_KV_BUDGET_GIB=0.5 on each prefill replica. On MRv2, this headroom gives a prefill KV budget of 0.70 GiB. This is less than the default minimum of 1.0 GiB. These two values are temporary. They change when the KV budget of MRv2 counts the draft weights correctly.

  • The DMA-order schedule applies only to the decode graph without drafts. Unset VLLM_NEURON_MEGA_DMA_ORDER_CONSTRAINTS_FILE and VLLM_NEURON_MEGA_DMA_ORDER_DERIVE on the decode server. The run_decode.sh script of the 8K/1K tutorial sets the schedule file.

MRv2 also accepts drafts at fixed synthetic rates. Use this to benchmark at a known acceptance length. Add "rejection_sample_method": "synthetic" to --speculative-config. Also add synthetic_acceptance_length or synthetic_acceptance_rates. For example, set "synthetic_acceptance_length": 2.44. MRv2 does not support other rejection methods.

Known limitations:

  • The prefill replicas give a higher time to first token (TTFT). The cause in the prefill step is not known.

  • At partial load, the time per output token (TPOT) is higher. The padding rows of the decode batch cause the higher TPOT. At 32 concurrent requests, 96 of the 128 rows of the decode batch are padding. All padding rows have the same input, so they route to the same experts. The ranks of these experts then set the time of each verify step. This limitation stays until the expert router ignores the padding rows.

Accuracy Evaluation#

Accuracy measured on real hardware with MXFP4 weights (Trn3), medium reasoning effort.

Benchmark

gpt-oss-120b (MXFP4)

GSM8K-CoT

88.8%

AIME25 (avg@8, medium)

78.75%

GPQA-diamond (medium)

72.22%

Tutorials#

This document is relevant for: Trn2, Trn3