This document is relevant for: Trn2, Trn3
Reference: SGLang-Neuron configuration#
Note
SGLang-Neuron is in public preview. Features, APIs, and supported models can change in later releases.
Applies to#
SGLang-Neuron 0.1.0 in the container image public.ecr.aws/neuron/pytorch-inference-sglang-neuron:v0.1.0-neuron-py314-sdk-2.33.0-ubuntu26.04.
Overview#
You configure an SGLang-Neuron server with the standard SGLang server flags. The plug-in also reads environment variables for settings that SGLang has no flag for. This page lists the container options, the variables of the example scripts, and the environment variables that most deployments use.
The plug-in refuses any unknown SGLANG_NEURON_* name in the launch environment, so a misspelled variable stops the launch. The plug-in also sets some variables itself for every process, and it refuses a launch that sets a different value for them. For the full list, including the debug and test variables, see the configuration reference in the sglang-neuron repository.
Container options#
A server container takes these docker run options:
Option |
Description |
|---|---|
|
Passes each Neuron device to the container. Set |
|
Reaps the worker processes of the server. |
|
Gives the SGLang processes the shared memory that they use to exchange tensors. The default Docker |
|
Lets the NUMA library and NIXL place memory. Without it, NIXL cannot map its network rails to NUMA nodes. |
|
Mounts the checkpoints. Put each checkpoint in its own directory, such as |
|
Mounts the compile cache. Use the same path every time, and use one directory for each image version and node role. |
|
One-node servers only. Publishes the server port on the loopback address of the host. For a client on a different computer, forward the port over SSH ( |
|
On a host without internet access. Keep the checkpoints and the tokenizer files under the models directory. |
A server of a prefill-decode (PD) pair also takes these options:
Option |
Description |
|---|---|
|
Passes each EFA device to the container. Add |
|
Uses the network of the node. |
|
Let NIXL lock memory for the KV transfer over EFA. |
Do not mount a volume at /workspace, and do not start processes from /workspace. The Neuron SDK container installs torch-neuronx from /workspace/torch_neuronx.
Compile cache variables#
Set these variables in the container to keep the compiled programs in the mounted cache directory. The example scripts set them from CACHE_DIR.
Variable |
Value |
|---|---|
|
|
|
|
|
|
Example script variables#
The example scripts at /opt/sglang-neuron/examples/<folder>/ read these variables. The README of each example gives the defaults for its model.
Variable |
Script |
Description |
|---|---|---|
|
|
Required. An address of this node that the other node and the balancer reach. |
|
|
The address that the server listens on. The default is |
|
Server scripts |
The server port. |
|
Server scripts, |
The checkpoint, |
|
Server scripts |
The compile cache. The default is |
|
|
Required. The two servers, |
|
|
The balancer, |
|
|
The balancer, |
|
|
The number of questions (default 100), and a local copy of the GSM8K |
Arguments after the script name go to its command: SGLang server flags for a server script, and the balancer options (--host, --port, or one more --decode) for run_balancer.sh.
Launch environment#
Variable |
Description |
|---|---|
|
|
|
The NeuronCores of the server, as a range list such as |
Plug-in environment variables#
Variable |
Default |
Description |
|---|---|---|
|
|
The sampler. |
|
|
The maximum number of top logprobs that a request can ask a device sampler for. The maximum is 256 under |
|
|
Kimi-K3 prefill with |
|
A twentieth of the page slots |
Kimi-K3 prefill: the host state slots of each rank. |
|
|
The GLM-5.2 decode point, on both PD roles: |
|
Unset |
SGLang Diffusion (Wan2.2): the patch-parallel group size of the VAE. The Wan2.2 example script sets |