This document is relevant for: Trn2, Trn3
What is SGLang-Neuron?#
Note
SGLang-Neuron is in public preview. Features, APIs, and supported models can change in later releases.
The SGLang-Neuron plug-in is a Neuron platform for SGLang. With SGLang-Neuron, you serve open models on AWS Trainium with the same SGLang launcher, server flags, and HTTP API that you use on other hardware. SGLang-Neuron is released by RadixArk in collaboration with the AWS Neuron team. Its source code is in the sglang-neuron repository on GitHub.
Applies to#
LLMs: trn3.48xlarge instances. Kimi-K3 needs a Trn3 UltraServer, with at least two trn3.48xlarge instances connected by a switch.
Diffusion models: trn2.48xlarge instances.
Software: SGLang-Neuron 0.1.0 on Neuron SDK 2.33.0, in the container image
public.ecr.aws/neuron/pytorch-inference-sglang-neuron:v0.1.0-neuron-py314-sdk-2.33.0-ubuntu26.04.
How SGLang-Neuron works#
SGLang selects its hardware platform at start. The container image sets SGLANG_PLATFORM=neuron, so SGLang loads the Neuron platform from the plug-in. You do not set more options to select it. The plug-in runs the models on TorchNeuron (torch-neuronx), and it compiles each model’s graphs with the Neuron compiler.
The plug-in runs all supported LLMs on one runtime with fully asynchronous scheduling and execution. The diffusion models run on a separate Neuron platform for SGLang Diffusion, with NKI kernels for attention and for the variational autoencoder (VAE).
The plug-in checks each launch before it starts. If a launch asks for a feature or a layout that the plug-in does not serve, the launch stops with a message that names the setting. The plug-in also refuses a request that it cannot serve exactly. It does not serve the request with the option removed. For the features that each model serves, see Reference: SGLang-Neuron feature compatibility.
The first start of a model compiles its programs. The server writes the compiled programs to the directories that TORCH_NEURONX_NEFF_CACHE_DIR, TORCH_NEURONX_HLO_CACHE_DIR, and NKI_COMPILE_CACHE_URL name. The example scripts point them at the mounted /cache directory. Later starts with the same cache directory load the programs and do not compile them again.
Aggregated and disaggregated serving#
SGLang-Neuron serves LLMs in two layouts:
Aggregated serving. One server on one node does both the prefill (the prompt) and the decode (the answer). Use this layout for the smaller models, such as Qwen3-8B.
Prefill-decode (PD) disaggregated serving. A prefill server on one node computes the KV cache of each prompt. It sends the KV cache to a decode server on a different node with NIXL over Elastic Fabric Adapter (EFA). The decode server generates the answer. A balancer in front of the two servers sends each request to both. The large models, such as GPT-OSS-120B, Kimi-K3, and GLM-5.2, use this layout.
Both servers of a PD pair must run the same container image, because the KV transfer uses the patched NIXL in the image. For the layout of each model, see Reference: SGLang-Neuron supported models.
What the container image contains#
In this public preview, the container image is the only supported way to run SGLang-Neuron. The image contains:
SGLang at commit
43881a7, with its runtime dependencies and the SGLang Diffusion packages for all five diffusion models in Reference: SGLang-Neuron supported models.The SGLang-Neuron plug-in.
The Neuron SDK 2.33.0 packages: the compiler, the runtime,
torch, andtorch-neuronx.NIXL, with the patches that disaggregated serving needs.
Example scripts for each model at
/opt/sglang-neuron/examples/<folder>/.The Hugging Face CLI (
hf), to download checkpoints.
When to use SGLang-Neuron#
Use SGLang-Neuron when:
Your serving stack already uses SGLang, and you want to run it on Trainium with no change to your launch commands or clients.
You serve one of the models in Reference: SGLang-Neuron supported models.
You generate reinforcement learning (RL) rollouts with SGLang.
Use vLLM Neuron when your stack uses vLLM, or when you serve a model that SGLang-Neuron does not support.
Further reading#
This document is relevant for: Trn2, Trn3