This document is relevant for: Trn2, Trn3
How to use vLLM Neuron features in your deployment#
This guide covers every significant feature the vLLM Neuron plugin exposes, organized by feature. For each feature: what it is, when to use it, how to enable it, and trade-offs.
For supported models and per-model feature availability, see the model cards and the Supported Models section in the README.
Prerequisites#
Completed Set up vLLM Neuron and one of the quickstarts
A running vLLM server or
LLMinstance on a Trn2 or Trn3 instance
Compilation#
vLLM Neuron uses PyTorch’s torch.compile API with the vllm_neuron
backend — the same torch.compile compilation pattern used in vLLM
upstream. Under the hood, the vllm_neuron backend lowers FX graphs
through XLA and HLO to the Neuron Compiler (neuronx-cc), which
produces optimized NEFF binaries for Trn2 and Trn3 hardware.
Compilation happens automatically during server warmup — one NEFF per bucket (sequence length × batch size combination). Compiled NEFFs are cached on disk and reused on subsequent restarts.
For production, you can pre-compile on a Neuron instance or a CPU instance and distribute artifacts via a shared filesystem so production nodes never compile at startup. See compilation cache and CPU compilation.
Pre-compiled model artifacts#
You can also use NEURON_COMPILED_ARTIFACTS to point at a directory of
pre-compiled models:
export NEURON_COMPILED_ARTIFACTS=/path/to/cache
vllm serve meta-llama/Llama-3.3-70B-Instruct --tensor-parallel-size 32
If the path contains valid artifacts, they are loaded directly with no recompilation. If the path is empty, the model is compiled and saved there for future use.
Model Runner V2#
vLLM Model Runner V2 (MRv2) is a re-implementation of the vLLM model runner, the component that prepares the inputs, runs the model forward pass, and samples tokens for each step. For background, see the vLLM Model Runner V2 design document and the Model Runner V2 announcement.
Starting with vLLM Neuron 0.32.0.1.3.0 (Neuron 2.34), Model Runner V2 is the default runner for every model. The configurations in Configurations that use MRv1 still run on the original Neuron model runner (Model Runner V1, MRv1). Both runners run inside the vLLM V1 engine.
Compared with MRv1, MRv2 keeps per-request state on the device and runs input preparation, the model forward pass, sampling, and the state update in one compiled graph. MRv1 builds the inputs on the host for every step. With async scheduling, finished requests and reordered batches do not break the async flow on MRv2, because the batch state does not need a host round trip. When new requests join the batch, MRv2 waits for the previous step’s output before it admits them, and then continues asynchronously.
How the runner is selected#
The plugin resolves the runner once per server, when the configuration is
built, and every engine and worker process uses the same decision. The
resolved decision is exposed as the VllmConfig.use_v2_model_runner
property. You control it with the VLLM_USE_V2_MODEL_RUNNER environment
variable:
|
Behavior |
|---|---|
Unset (default) |
MRv2, except for the configurations in Configurations that use MRv1. |
|
Use MRv1. A configuration that only MRv2 serves, such as MTP or a hybrid model, fails at startup instead. |
|
Always use MRv2, with no fallback to MRv1. For most unsupported features, the server logs |
# Default: MRv2 when the configuration is supported
vllm serve meta-llama/Llama-3.1-8B-Instruct --tensor-parallel-size 8
# Force MRv1
VLLM_USE_V2_MODEL_RUNNER=0 vllm serve meta-llama/Llama-3.1-8B-Instruct \
--tensor-parallel-size 8
To confirm which runner is active, check the worker log. MRv2 logs
Using the standalone V2 Neuron model runner. at startup. If the line is
absent, the server is running MRv1. Use this line to confirm the runner:
not every MRv1 selection is logged.
Supported dense features#
Feature |
MRv2 |
Notes |
|---|---|---|
Tensor parallelism (TP) |
✅ |
|
Asynchronous scheduling |
✅ |
On by default. Requires on-device sampling. See Async scheduling. |
Data parallelism (DP) |
✅ |
Replica DP with |
Disaggregated inference (1P1D / xPyD) |
✅ |
Dense prefill and decode servers with TP, including EAGLE3. See Disaggregated inference. |
Decode-context parallelism (DCP) |
✅ |
|
Continuous batching |
✅ |
|
Prefix caching and segmented prefill |
✅ |
|
CPU KV offloading |
✅ |
vLLM’s own offloading backend: |
On-device sampling (greedy, top-k, top-p) |
✅ |
Required. CPU sampling selects MRv1. On-device sampling does not support a per-request |
KV cache FP8 |
✅ |
Unpacked and packed ( |
DFlash speculative decoding |
✅ |
|
Structured outputs and tool calling |
✅ |
|
Pooling (embedding) models |
✅ |
Native pooling models and |
Prompt embeddings |
✅ |
Not with disaggregated inference or speculative decoding. |
Multi-LoRA |
✅ |
|
Structured outputs on MRv2#
With asynchronous scheduling, MRv2 serves structured outputs with split
sampling: the forward graph ends at the logits, and a sampler graph applies
the grammar mask and samples. Each step runs both graphs, also when no request
uses a grammar. The launch of the second graph adds host time to each step. See
Structured outputs and tool calling
for a measured value.
Logprobs come from the logits before the grammar mask, as on MRv2 with
--no-async-scheduling; vLLM on GPU masks first.
VLLM_NEURON_CPU_COMPILE compiles the forward graphs only. Each rank compiles
its sampler graphs in the warmup, one for each row count of the forward graphs,
so a server that starts from a CPU-compiled cache still compiles them.
GPT-OSS MXFP4, Llama 3, and Qwen3 support split sampling on the native
route. With another model on MRv2, for example Qwen3-VL or Qwen3-ASR, the server
refuses to start and names --no-async-scheduling. Split sampling also refuses
jump-forward decoding and a VLLM_NEURON_BATCH_QUEUE_DEPTH above 2.
MRv1 serves structured outputs only with synchronous scheduling. Structured
outputs with speculative decoding select MRv1 (see
Configurations that use MRv1). With
asynchronous scheduling, a server on MRv1 starts and logs a warning, but it
rejects each structured-output request. Start such a server with
--no-async-scheduling.
The GPT-OSS decode megakernel (gk_decode) has no split sampling, so a decode
server with the megakernel, structured outputs, and asynchronous scheduling
refuses to start. With gk_decode unset, vLLM Neuron selects the megakernel
when the server meets its requirements, for example a GPT-OSS 120B MXFP4 decode
server (kv_consumer) on Trn3. To keep asynchronous scheduling, decode with the
per-layer model: set gk_decode to false in neuron_config. Unset
VLLM_NEURON_BATCH_QUEUE_DEPTH too (the
GPT-OSS 120B 8K/1K tutorial
sets it to 4). Or use --no-async-scheduling.
Configurations that use MRv1#
The model families in this release run on MRv2 in their common
configurations. When VLLM_USE_V2_MODEL_RUNNER is unset, the plugin selects
MRv1 only for the configurations below.
Every architecture that vLLM Neuron registers runs on MRv2 by default:
LlamaForCausalLM, GptOssForCausalLM, Qwen3ForCausalLM,
Qwen3VLForConditionalGeneration, Qwen3ASRForConditionalGeneration, and the
EAGLE3, P-EAGLE and DFlash draft models. A custom architecture that you
register outside vLLM Neuron selects MRv1 without a log message when it is a
Mixture-of-Experts, expert-parallel, sliding-window, multimodal,
encoder-decoder, attention-free, or diffusion model, unless it is a hybrid
model (see below). To run a custom Mixture-of-Experts or sliding-window model
on MRv2, set VLLM_USE_V2_MODEL_RUNNER=1.
A hybrid model (attention and recurrent layers) always uses MRv2, because
MRv1 has no recurrent cache. This includes a hybrid Mixture-of-Experts,
expert-parallel or sliding-window model. A hybrid configuration with a feature
that MRv2 does not support, such as --enforce-eager, fails at startup with
the list of the features, instead of using MRv1. MRv2 serves MTP speculative
decoding for a hybrid model, also with a Mixture-of-Experts target, when the
model implementation keeps a recurrent state for each verified token
(SupportsRecurrentStateCheckpoints) and returns its final hidden states
(SupportsMTPHiddenStates). Another hybrid model with MTP fails at startup
with a message. MTP does not support expert parallelism across data-parallel
ranks. With EAGLE3,
DFlash, or another speculative method, a hybrid model fails at startup, because
MRv1 cannot keep the recurrent state after speculative verification.
vLLM enables prefix caching by default for a hybrid model. MRv2 serves prefix
caching, also together with MTP. To also reuse the blocks that a decode filled,
pass --prefix-cache-retention-interval with the block size. See “Hybrid model
prefix caching and MTP” in reference-configuration.md for the block size
rules and the KV capacity. The example passes --prefix-match-unit 128, so a
later request reuses a shared prompt in steps of 128 tokens. For a model with a
head dimension of 128 or less, a unit smaller than the block makes segmented
prefill use the slower torch attention. For a model that supports MTP, also
pass a speculative configuration, for example
--speculative-config '{"method": "mtp", "num_speculative_tokens": 4}':
vllm serve /path/to/hybrid-model --tensor-parallel-size 8 \
--prefix-match-unit 128
Qwen3-VL and Qwen3-ASR run on MRv2 as one server, as data-parallel replicas, and as the encoder-only and language-only pools of an EPD deployment (see the EPD tutorial). With pooling, prompt embeddings, speculative decoding, or another KV or encoder-cache transfer role, they select MRv1 and log the reason.
The following features select MRv1. For most of them, the server logs
Neuron Model Runner V2 does not yet support <features>; using V1. with the
list of features:
Speculative decoding other than EAGLE3 (including P-EAGLE), DFlash and MTP. A dense model with MTP stays on MRv2, where the MTP speculator rejects it: MTP is validated only with a hybrid target.
Structured outputs with speculative decoding, and structured outputs with synchronous scheduling and
lm_head_dp_sizegreater than 1Custom logits processors, and logprobs modes other than
raw_logprobsandraw_logitsPrompt embeddings with disaggregated inference or speculative decoding
Pooling models with async scheduling or disaggregated inference
Decode context-length bucketing (
decode_context_length_buckets) combined with expert or component parallelism across data-parallel ranksAttention or MLP data parallelism (
attention_dp_sizeormlp_dp_sizegreater than 1)CPU sampling (
on_device_sampling_configset tonull)Prefill-context parallelism
Eager execution (
enforce_eager)KV cache offloading with the LMCache backend or with
VLLM_USE_SIMPLE_KV_OFFLOAD=1, tensor capture, and tensor replacement
The GPT-OSS decode megakernel (gk_decode) with EAGLE3 runs on MRv2 only. Set
VLLM_USE_V2_MODEL_RUNNER=1 on its decode server. Without this variable, the
server uses the per-layer decode. With gk_decode: true, the server stops at
startup. See
EAGLE3 with the decode megakernel.
These lists cover the common cases. The Using the standalone V2 Neuron model runner. log line and the VllmConfig.use_v2_model_runner value are
authoritative.
For per-model runner support, see the feature table on each model recipe page.
Bucketing and dynamic shapes#
Neuron compiles models into static-shape programs (NEFFs). To handle varying input lengths and batch sizes at runtime, vLLM Neuron uses bucketing — compiling multiple NEFFs at different sizes and selecting the smallest one that fits each request.
There are three bucketing dimensions:
Prefill token buckets (
num_batched_tokens_buckets) — compiled prefill token counts for prompt processing. Inputs are padded to the nearest bucket.Decode batch buckets (
num_seqs_buckets) — compiled batch sizes for token generation. Active requests are padded to the nearest bucket.Decode context-length buckets (
decode_context_length_buckets) — optional second dimension that compiles smaller decode NEFFs sized to typical KV lengths rather thanmax_model_len. Useful for disaggregated inference where effective context is much shorter than the maximum.
Trade-offs#
More buckets = slower startup (more compilations), less padding waste at runtime
Fewer buckets = faster startup, more padding waste
Each bucket consumes device memory
Recommended approach#
Start with minimal buckets during development (single prefill bucket, single decode batch)
Profile your workload to understand prompt length and concurrency distribution
Add buckets matching your traffic percentiles
Remove unused buckets to speed up startup
For the full parameter reference, see Configuration options. For the decode context-length bucketing design, see Decode context-length bucketing.
Continuous batching#
Continuous batching is enabled by default. The Neuron scheduler automatically interleaves prefill and decode requests, admitting new requests without waiting for in-flight requests to complete.
No configuration is needed – this is the default behavior when serving with vLLM Neuron. For details on how the scheduler works internally, see Scheduler design.
Streaming#
Streaming is supported by default via the OpenAI-compatible API. No additional configuration is needed:
from openai import OpenAI
client = OpenAI(base_url="http://localhost:8000/v1", api_key="EMPTY")
response = client.chat.completions.create(
model="meta-llama/Llama-3.3-70B-Instruct",
messages=[{"role": "user", "content": "Hello"}],
stream=True,
)
for chunk in response:
print(chunk.choices[0].delta.content, end="")
Segmented prefill#
Segmented prefill breaks long prompts into smaller segments, processing them over multiple iterations. This enables serving long-context models (64K, 128K+) without compiling a single NEFF for the full sequence length.
Segmentation is controlled by max_num_batched_tokens — prompts
exceeding this limit are processed in multiple iterations:
vllm serve meta-llama/Llama-3.3-70B-Instruct \
--tensor-parallel-size 32 \
--max-model-len 131072 \
--max-num-batched-tokens 8192
In this example, a 32K prompt is processed in 4 iterations of 8192 tokens each.
Note
Unlike chunked prefill (mixed batching) in vLLM upstream, prefill and decode always run in separate batches on Neuron — they are never mixed in the same batch.
When to use segmented prefill#
Long-context models where compiling a single bucket for the full context is impractical
Reducing peak memory during prefill by processing fewer tokens per iteration
For the full design, see Prefill processing design.
Prefix caching#
Prefix caching allows you to reuse the KV cache from shared prompt prefixes across requests. This improves time-to-first-token (TTFT) for workloads where many requests share common system prompts or context.
Prefix caching is enabled by default on vLLM Neuron, the same as vLLM upstream. You do not need to configure anything to benefit from it — requests that share a prompt prefix automatically reuse the cached KV.
To disable it, pass --no-enable-prefix-caching (CLI) or
enable_prefix_caching=False (LLM constructor).
Sizing the KV cache#
Prefix caching only helps when there are enough KV cache blocks to retain
prefixes across requests. On Neuron, block count is set explicitly via
num_gpu_blocks_override, and block_size must be specified:
vllm serve meta-llama/Llama-3.3-70B-Instruct \
--tensor-parallel-size 32 \
--max-model-len 4096 \
--max-num-seqs 8 \
--block-size 32 \
--num-gpu-blocks-override 4096
The equivalent LLM invocation:
from vllm import LLM
llm = LLM(
model="meta-llama/Llama-3.3-70B-Instruct",
tensor_parallel_size=32,
max_model_len=4096,
max_num_seqs=8,
block_size=32,
num_gpu_blocks_override=4096,
)
For more blocks to reuse (higher hit rate on repeated prefixes), increase
num_gpu_blocks_override. See the
prefix caching benchmark tutorial
for a worked example measuring the TTFT improvement.
How prefix caching works#
vLLM hashes each block of prompt tokens and reuses the cached KV for any request whose leading blocks hash-match a previously computed prefix. For the full design, see Prefix caching design.
When to use prefix caching#
Workloads with long, repeated system prompts shared across requests
RAG applications where the same retrieved context appears in multiple queries
Chat applications where conversation history is re-sent with each turn
CPU KV offloading#
CPU KV offloading adds a host-memory tier to the prefix cache. vLLM stores full KV blocks to host memory. When a request reuses a prefix that HBM no longer holds, vLLM loads the blocks back instead of computing them again.
vllm serve meta-llama/Llama-3.1-8B-Instruct \
--tensor-parallel-size 8 \
--enable-prefix-caching \
--max-num-batched-tokens 512 \
--kv-offloading-size 64
For the configuration, sizing, copy modes and troubleshooting, see How to use CPU KV offloading.
When to use CPU KV offloading#
Agentic and multi-turn workloads whose reused prefixes do not all fit in HBM
Hosts that can give the tier more memory than the HBM KV cache. A smaller tier adds few hits.
Tensor, data, and expert parallelism#
vLLM Neuron exposes three parallelism dimensions:
Tensor parallelism (TP) — Shards each weight matrix across ranks. Required to fit large models. Always used; pick the smallest size that fits the model and meets target latency.
Data parallelism (DP) — Runs independent model replicas to increase concurrent throughput. Use when you have spare cores beyond what TP requires.
Expert parallelism (EP) — Distributes MoE experts across ranks. Use for MoE models when intermediate sharding becomes too small under high TP.
# TP only, single replica
vllm serve meta-llama/Llama-3.3-70B-Instruct \
--tensor-parallel-size 64
# TP + DP, multiple replicas
vllm serve openai/gpt-oss-20b \
--tensor-parallel-size 8 \
--data-parallel-size 8
# TP + EP, full expert parallelism for MoE
vllm serve openai/gpt-oss-20b \
--tensor-parallel-size 8 \
--enable-expert-parallel
# TP + EP with explicit ep_degree
vllm serve openai/gpt-oss-20b \
--tensor-parallel-size 8 \
--enable-expert-parallel \
--additional-config '{"neuron_config": {"ep_degree": 2}}'
Trade-offs: Each dimension adds collective traffic. EP reduces per-rank memory at the cost of routing all tokens through the EP collective. DP increases throughput linearly with replicas, at the cost of cores per replica. Match the parallelism to your bottleneck.
Neuron-specific notes:
With
--enable-expert-paralleland no explicitep_degree, the worker defaultsep_degreeto--tensor-parallel-size(full EP).Setting
ep_degree > 1without--enable-expert-parallelfails at startup.Combining DP with EP requires
ep_degree = TP × DP. Other combinations are rejected.Component-level data parallelism (per-layer DP for attention, MLP, embedding, or LM head) requires disaggregated inference — the worker rejects component DP without a
--kv-transfer-config.Encoder parallelism — For multimodal models, all ranks run both the text model and the encoder — ranks are not partitioned between them. The encoder has its own TP and DP degrees, decoupled from the text model’s parallelism, and only runs during prefill. EP does not apply (no MoE component). By default the encoder uses full DP (
tp_size=1, dp_size=world_size) with no additional configuration. To override, passencoder_neuron_configin--additional-config:vllm serve Qwen/Qwen3-VL-32B-Instruct \ --tensor-parallel-size 8 \ --max-model-len 8192 \ --max-num-batched-tokens 8192 \ --additional-config '{ "encoder_neuron_config": { "tp_size": 1, "dp_size": 8 } }'
Constraint:
tp_size * dp_sizemust equalworld_size. See Encoder parallelism design for block-level DP semantics, process groups, and configuration details.
Logical NeuronCore configuration (LNC)#
The Logical NeuronCore configuration (LNC) sets how many physical NeuronCores make one logical NeuronCore. The Neuron runtime, the compiler, and the NKI kernels all use this degree. For the architecture, see Logical NeuronCore configuration in the Neuron documentation.
vLLM Neuron counts each rank and each visible core in logical NeuronCores. Thus the degree changes the hardware that a parallel configuration uses:
LNC 1 |
LNC 2 |
|
|---|---|---|
Physical NeuronCores in one logical NeuronCore |
1 |
2 |
Logical NeuronCores on a |
128 |
64 |
Physical NeuronCores for |
8 |
16 |
HBM for each rank on a |
12 GiB |
24 GiB |
HBM for each rank on a |
18 GiB |
36 GiB |
Default degree#
Starting in Neuron 2.34 (vLLM Neuron 0.32.0.1.3.0), vLLM Neuron uses LNC 1 by
default. Earlier versions of vLLM Neuron use LNC 2.
When NEURON_LOGICAL_NC_CONFIG is set in the environment, vLLM Neuron uses
that value. On Kubernetes, the Neuron device plugin sets this variable. See
LNC on Kubernetes.
At LNC 1 a rank has half the HBM of a rank at LNC 2. To move a configuration
from LNC 2 to LNC 1 on the same physical NeuronCores, double the
tensor-parallel degree. For example, --tensor-parallel-size 8 at LNC 2 and
--tensor-parallel-size 16 at LNC 1 use the same 16 physical NeuronCores.
Each worker logs its degree in the Neuron HBM line:
Neuron HBM: 3.90 GiB used, 8.10 GiB free (trn2, LNC 1)
Set the LNC degree#
Set logical_nc_config in --additional-config:
vllm serve meta-llama/Llama-3.3-70B-Instruct \
--tensor-parallel-size 32 \
--additional-config '{"logical_nc_config": 2}'
In the Python API, set the same key in additional_config:
from vllm import LLM
llm = LLM(
model="meta-llama/Llama-3.3-70B-Instruct",
tensor_parallel_size=32,
additional_config={"logical_nc_config": 2},
)
You can also set the NEURON_LOGICAL_NC_CONFIG environment variable to 1 or 2.
When both are set and the values are different, logical_nc_config wins, and
vLLM Neuron logs a warning. Tools that read a compiled NEFF outside the server,
for example a profiler, read only the environment variable. Set the same degree
for them.
The compiled graphs are specific to the degree. A server at a different degree compiles its graphs again.
For all the considerations, see logical_nc_config.
When to use LNC 2#
LNC 1 is the default. Use LNC 2 in these cases:
The model does not fit at LNC 1, and you cannot increase the tensor-parallel degree. A rank at LNC 2 has twice the HBM. The tensor-parallel degree cannot be larger than the number of attention heads of the model.
A kernel needs 2 physical NeuronCores. Some NKI kernels have no LNC 1 path. At LNC 1, vLLM Neuron runs a fallback path for such a kernel and logs one warning that starts with
[lnc1-fallback]. The fallback path can be slower. If the server log shows this warning, compare the throughput at LNC 2.A kernel does not fit in the on-chip memory of one physical NeuronCore. The compile then stops with an
NCC_INKI016error, for exampleStack out of memory. For an example, see the known issues of the Llama 3 model recipe.A parallel layout makes process groups that the runtime cannot build at LNC 1. On Trn2, the runtime builds a group that spans chips only for some rank strides. At LNC 1, the strides 1, 8 and 32 work. At LNC 2, the strides 1, 4 and 16 work. For example, a group of stride 4 works at LNC 2 only. For a refused group, vLLM Neuron or the runtime stops at startup. Change the tensor-parallel degree, the data-parallel degree, or the LNC degree, so that each group has a stride that works.
A deployment selects cores by ID at LNC 2.
NEURON_RT_VISIBLE_CORESandNEURON_VISIBLE_DEVICEScount logical NeuronCores. At LNC 1, the IDs of a script for LNC 2 select other physical NeuronCores. Some tutorials set"logical_nc_config": 2for this reason.You compare with results from LNC 2. For example, keep LNC 2 for a performance baseline that you measured at LNC 2.
Some features need LNC 1. For example, the GPT-OSS decode megakernel and the sequence-parallel decode of Qwen3-32B dense MXFP8 run at LNC 1 only. See the GPT-OSS and Qwen3-32B model recipes.
LNC on Kubernetes#
The Neuron device plugin for Kubernetes sets NEURON_LOGICAL_NC_CONFIG in each
container that requests Neuron devices. On Trn2 and Trn3 it sets 2, unless the
node is configured for LNC 1. vLLM Neuron keeps a value that it finds in the
environment. Thus a server on such a node runs at LNC 2, not at the vLLM Neuron
default. Check the Neuron HBM line in the worker log.
To run at LNC 1, configure the node for LNC 1. The device plugin then sets 1. See “Trn2 LNC configuration” in EKS prerequisites.
Warning
A pod that requests NeuronCores (aws.amazon.com/neuroncore) also gets
NEURON_RT_VISIBLE_CORES from the device plugin. These core IDs count cores at
the degree of the device plugin. For such a pod, configure the node. Do not set
a different degree in the server, because the core IDs then select other
physical NeuronCores.
A pod that requests whole Neuron devices (aws.amazon.com/neuron) can instead
set "logical_nc_config": 1 in --additional-config. vLLM Neuron then logs a
warning, because the value is different from the environment.
Disaggregated inference#
Disaggregated inference separates prefill (prompt processing) and decode (token generation) onto different instances, allowing each phase to be scaled and optimized independently.
Disaggregated inference transfers the KV cache over NIXL/LIBFABRIC (EFA),
which requires the libcuda.so.1 and libfabric.so.1 shared libraries on the
loader path. If your environment does not already ship them, see
Install dependencies for disaggregated inference.
Configurations#
1P1D: 1 prefill instance + 1 decode instance
xPyD: Multiple prefill instances + multiple decode instances for higher throughput
When to use disaggregated inference#
High-throughput serving where prefill and decode have different resource requirements
Large-scale deployments where you need to scale prefill and decode independently
Workloads with long prompts but short generations (or vice versa)
Quantization#
Quantization reduces model memory footprint and improves throughput by using lower-precision arithmetic for inference. vLLM Neuron supports two model-weight quantization paths — FP8 static (Trn2) and MXFP4 (gpt-oss on Trn3) — plus FP8 KV-cache quantization. See the model recipes for per-model feature support.
Always validate with the accuracy debugging guide after enabling any quantization.
FP8 static weight quantization#
FP8 static weight quantization is driven by the checkpoint, not a
runtime flag. Point the server at a ModelOpt-calibrated checkpoint carrying
per-tensor static FP8 scales in its quantization_config; vLLM Neuron
detects the format and loads the FP8 weights automatically:
vllm serve <path-to-modelopt-fp8-checkpoint> \
--tensor-parallel-size 32 \
--max-model-len 4096
Do not set vLLM’s --quantization flag — the checkpoint’s
quantization_config selects the path. A checkpoint whose config requests
an unsupported scheme (e.g. weight quantization from compressed-tensors,
which the platform validator rejects — only KV-cache q_scale/k_scale/
v_scale is accepted) fails at startup with a clear error rather than
silently falling back to BF16.
MXFP4 weight quantization (gpt-oss on Trn3)#
gpt-oss supports MXFP4 (mixed-precision FP4) weights on Trn3 for maximum
throughput. MXFP4 is Neuron-specific: pass it under
neuron_config.quantization, not the upstream --quantization flag:
vllm serve openai/gpt-oss-120b \
--tensor-parallel-size 64 \
--additional-config '{"neuron_config": {"quantization": "mxfp4"}}'
MXFP4 is supported only for gpt-oss on Trn3. The worker rejects mxfp4 on Trn2
(gpt-oss falls back to BF16 there), failing at startup with a clear error.
KV cache FP8 quantization#
Separate from model weight quantization, you can quantize the KV cache
to FP8 to reduce memory footprint and increase concurrent request
capacity. This is controlled through vLLM’s standard kv_cache_dtype
parameter (not neuron_config).
from vllm import LLM
llm = LLM(
model="meta-llama/Llama-3.3-70B-Instruct",
tensor_parallel_size=32,
max_model_len=4096,
kv_cache_dtype="fp8", # FP8 KV cache
)
Or via CLI:
python3 -m vllm.entrypoints.openai.api_server \
--model meta-llama/Llama-3.3-70B-Instruct \
--tensor-parallel-size 32 \
--kv-cache-dtype fp8
How it works:
K and V tensors are quantized to FP8 before being written to the cache and dequantized back to BF16 when read
Attention matmuls still run in BF16 (memory reduction, not compute speedup)
Cache footprint is roughly halved, allowing more concurrent requests
Scale calibration. Scales must be provided by the model checkpoint
(produced offline via llm-compressor calibration). Without checkpoint
scales, values default to 1.0 which degrades accuracy.
TRN2 vs TRN3 clamp range. TRN2 FP8 E4M3 has a max finite value of 240.0, whereas TRN3 supports up to 448.0. The correct clamp is resolved automatically based on the detected platform.
When to use quantization#
Large models that don’t fit in available HBM at full precision
Throughput-bound workloads where slight accuracy loss is acceptable
Deploying on smaller instance types with limited memory
KV cache FP8: when you need more concurrent requests without changing model precision
On-device sampling#
On-device sampling performs the sampling step (argmax, top-k, top-p) directly on the Neuron device rather than transferring logits back to CPU. This is enabled by default and reduces latency.
Supported sampling parameters#
When on-device sampling is enabled, the following parameters are supported:
temperaturetop_ktop_p
Note
When top_k is set to -1, it is internally limited to 256. When
temperature is set to 0, greedy decoding is used (equivalent to
top_k=1).
On-device sampling does not support a per-request seed, on both model
runners. The server rejects a request that sets seed with a temperature
above 0. A greedy request (temperature 0) can set seed, because greedy
decoding does not use a random value.
Async scheduling#
Async scheduling overlaps CPU work (scheduling, input preparation, output processing) with Neuron device execution (NEFF forward pass) to reduce per-step latency.
How async scheduling works#
In synchronous mode, the CPU idles while the device runs the forward pass, and the device idles while the CPU prepares the next step. Async scheduling eliminates this idle time by:
Batch queue (depth 2). The engine core schedules one step ahead so the worker always has work ready.
Device-to-device token passing. The previous step’s sampled token future is fed directly as
input_idsinto the next forward pass – no CPU roundtrip. The Neuron async runtime enqueues NEFF executions ahead of time.Async output materialization. Tokens are materialized to CPU on a separate thread, overlapped with scheduling the next step.
Steady-state async (batch unchanged):
CPU: | schedule(N+1) | prepare(N+1) | schedule(N+2) |
Device: |====== forward(N) ======|====== forward(N+1) ======|
Async: | materialize(N-1) | materialize(N) |
Breaking the async flow#
The async flow is “broken” when:
Batch composition changes (requests finish or new requests join)
The previous sampled-token future shape does not match the next decode input shape
The request order changed (future is remapped but still forced)
When broken, the pending device future is materialized on the critical
path, batch state is updated, and CPU-built input_ids are used for
that step. The async flow automatically reinstates on the next
steady-state decode step.
The list above describes MRv1. For MRv2, see Model Runner V2.
Configuration#
Async scheduling is on by default and requires on-device sampling.
# Disable async scheduling
python3 -m vllm.entrypoints.openai.api_server \
--model meta-llama/Llama-3.3-70B-Instruct \
--no-async-scheduling
When to disable#
Debugging: disable to simplify the execution flow for troubleshooting
Very short responses: if most responses are 1-2 tokens, the overhead of managing futures may not be worth the overlap benefit
CPU sampling: async scheduling requires on-device sampling; it cannot be used with CPU sampling
When async scheduling helps most#
Smaller models (faster NEFF execution): CPU overhead is a larger fraction of total step time, so hiding it yields greater relative speedup
Longer average response length: more consecutive decode steps means the async path is active for a larger fraction of total generation
Speculative decoding#
Speculative decoding accelerates autoregressive inference without changing the output distribution. A lightweight draft model predicts several tokens ahead, and the target model verifies them in a single forward pass.
Note
EAGLE3 and DFlash are supported speculative methods. A hybrid model, such as Qwen3.8, supports MTP on MRv2 instead. The examples below use EAGLE3. For per-model compatibility, see the model recipes. For compatible target/draft pairings and worked examples, see the EAGLE3 speculative decoding tutorials for Llama 3.1 and GPT-OSS, or the DFlash speculative decoding tutorial.
How it works#
The target model generates a token and produces hidden states.
The draft model proposes
Kspeculative tokens from those hidden states.The target model verifies all
Ktokens in one forward pass.A rejection sampler accepts tokens sequentially until the first mismatch.
The process repeats.
This guarantees output is identical to the target model alone while improving throughput by accepting multiple tokens per step.
Enable speculative decoding (CLI)#
python3 -m vllm.entrypoints.openai.api_server \
--model meta-llama/Llama-3.3-70B-Instruct \
--tensor-parallel-size 32 \
--speculative-config '{"method": "eagle3", "model": "eagle3-llama3.3-70b", "num_speculative_tokens": 5}' \
--max-model-len 4096 \
--max-num-seqs 8 \
--additional-config '{"neuron_config": {"on_device_sampling_config": {"temperature": "0"}}}'
Enable speculative decoding (Python)#
from vllm import LLM, SamplingParams
llm = LLM(
model="meta-llama/Llama-3.3-70B-Instruct",
tensor_parallel_size=32,
max_model_len=4096,
max_num_seqs=8,
speculative_config={
"method": "eagle3",
"model": "eagle3-llama3.3-70b",
"num_speculative_tokens": 5,
},
additional_config={
"neuron_config": {
"on_device_sampling_config": {
"temperature": "0"
}
}
}
)
sampling_params = SamplingParams(max_tokens=256, temperature=0.0)
outputs = llm.generate(["Explain quantum computing"], sampling_params)
Key parameters#
Parameter |
Description |
|---|---|
|
JSON config selecting the speculative method ( |
|
Speculative method; |
|
Path or name of a compatible draft model |
|
Number of tokens the draft proposes per step; this must match the selected method and draft checkpoint |
|
Required for on-device rejection sampling |
On-device vs CPU sampling#
Speculative decoding uses on-device sampling for the rejection step.
The target model verifies draft tokens and the rejection sampler runs
entirely on the Neuron device, avoiding the latency of transferring
logits to CPU. This requires on_device_sampling_config to be set.
When to use speculative decoding#
Latency-sensitive deployments where TTFT is acceptable but inter-token latency matters
Workloads where the draft model acceptance rate is high (structured outputs, code generation)
Structured outputs and tool calling#
Structured outputs guarantee that model responses conform to a specified schema (JSON schema, regex, choice enum, or BNF grammar). Tool calling builds on the same infrastructure – vLLM converts tool schemas into structured output constraints internally.
How structured outputs work#
Structured outputs use the same on-device bitmask approach as vLLM upstream — a grammar-derived bitmask is applied to logits before sampling, ensuring only grammar-valid tokens can be selected. For implementation details, see Structured outputs design.
Enable structured outputs#
Set enable_structured_outputs in neuron_config:
vllm serve meta-llama/Llama-3.3-70B-Instruct \
--tensor-parallel-size 32 \
--additional-config '{"neuron_config": {"enable_structured_outputs": true}}'
The vLLM default backend is auto, which selects xgrammar when xgrammar
supports the request. For jump-forward decoding, set
structured_outputs_config.backend to xgrammar. For the configurations that
need --no-async-scheduling, see
Structured outputs on MRv2.
Then use the standard OpenAI API parameters:
from openai import OpenAI
client = OpenAI(base_url="http://localhost:8000/v1", api_key="EMPTY")
response = client.chat.completions.create(
model="meta-llama/Llama-3.3-70B-Instruct",
messages=[{"role": "user", "content": "List 3 colors as JSON"}],
response_format={
"type": "json_schema",
"json_schema": {
"name": "colors",
"schema": {
"type": "object",
"properties": {
"colors": {
"type": "array",
"items": {"type": "string"}
}
},
"required": ["colors"]
}
}
}
)
Tool calling#
Tool calling uses two paths, depending on tool_choice and the tools:
none, or auto without a
stricttool or--tool-strict-level: no structured output constraints. The model generates free text, and the tool parser (for exampleLlama3JsonToolParser) extracts tool calls after generation.required, a named tool, or auto with a
stricttool or--tool-strict-level: a structured-output request. vLLM converts the tool schema into a grammar constraint and routes it through the same bitmask pipeline as structured outputs.
response = client.chat.completions.create(
model="meta-llama/Llama-3.3-70B-Instruct",
messages=[
{"role": "user", "content": "What's the weather in Seattle?"}
],
tools=[{
"type": "function",
"function": {
"name": "get_weather",
"parameters": {
"type": "object",
"properties": {
"location": {"type": "string"}
},
"required": ["location"]
}
}
}],
tool_choice="required"
)
Note
tool_choice="required" and named tool choice require on-device
sampling. With CPU sampling, the logit_mask is not applied and the
model may produce tokens that violate the grammar FSM.
Multimodal support#
vLLM Neuron supports vision-language models and audio transcription models. They accept image, video, audio, and text inputs.
For the supported models, feature matrix, and accuracy results, see the model cards. See the Qwen3-VL deployment tutorial for vision input and Qwen3-ASR deployment tutorial for audio input.
Multimodal Input#
Multimodal requests use the standard vLLM interfaces.
Audio transcription. Pass audio through multi_modal_data with the offline
LLM.generate() interface. Use the OpenAI-compatible
/v1/audio/transcriptions endpoint for online requests.
Offline (LLM.generate). Build the prompt with the model’s chat template
and pass the images and/or videos under multi_modal_data:
Offline inference example
from transformers import AutoProcessor
from vllm import LLM, SamplingParams
from vllm.assets.image import ImageAsset
from vllm.assets.video import VideoAsset
processor = AutoProcessor.from_pretrained("Qwen/Qwen3-VL-32B-Instruct")
llm = LLM(
model="Qwen/Qwen3-VL-32B-Instruct",
tensor_parallel_size=16,
max_model_len=32768,
max_num_seqs=8,
additional_config={
"neuron_config": {"quantization": "bf16"},
# Encoder graphs are auto-generated; see the reference config
# to tune encoder_graph_shapes.
},
)
sampling_params = SamplingParams(max_tokens=256, temperature=0.0)
# Image input
image = ImageAsset("cherry_blossom").pil_image
messages = [{
"role": "user",
"content": [
{"type": "image"},
{"type": "text", "text": "Describe this image in detail."},
],
}]
prompt = processor.apply_chat_template(
messages, tokenize=False, add_generation_prompt=True
)
outputs = llm.generate(
{"prompt": prompt, "multi_modal_data": {"image": [image]}},
sampling_params,
)
# Video input
video = VideoAsset("baby_reading", num_frames=4)
messages = [{
"role": "user",
"content": [
{"type": "video"},
{"type": "text", "text": "Describe what happens in this video."},
],
}]
prompt = processor.apply_chat_template(
messages, tokenize=False, add_generation_prompt=True
)
outputs = llm.generate(
{
"prompt": prompt,
"multi_modal_data": {
"video": (video.np_ndarrays, video.metadata),
},
},
sampling_params,
)
For multiple images, add more {"type": "image"} entries and pass a list under
multi_modal_data={"image": [...]}. For video, use a {"type": "video"}
content part and pass the frames-and-metadata tuple the vLLM video parser
expects (multi_modal_data={"video": (frames, metadata)}).
Online (OpenAI-compatible API). Send images as image_url content parts —
either a remote URL or a base64 data URL:
Online request example
from openai import OpenAI
client = OpenAI(base_url="http://localhost:8000/v1", api_key="EMPTY")
response = client.chat.completions.create(
model="Qwen3-VL-32B-Instruct",
messages=[{
"role": "user",
"content": [
{"type": "image_url",
"image_url": {"url": "https://vllm-public-assets.s3.us-west-2.amazonaws.com/vision_model_images/cherry_blossom.jpg"}},
{"type": "text", "text": "What's in this image?"},
],
}],
)
Refer to the vLLM docs for more detailed examples. For more details on how to configure the encoder, refer to the multimodal encoder options.
Encoder-disaggregated inference (EPD)#
Encoder-disaggregated inference separates the vision encoder from the language
model onto a Vision Encoder (VE) pool and a Prefill+Decode (PD) pool,
allowing each stage to be scaled and given its own parallelism, with an
OpenAI-compatible router fronting both. Unlike
disaggregated inference, which moves KV cache over a
--kv-transfer-config connector, EPD moves vision embeddings over an
--ec-transfer-config connector. EPD is strictly two-way; prefill and decode
stay co-located in one PD engine.
Each engine sets a construction role (--mm-encoder-only for a VE,
"mm_language_model_only": true for a PD; see
EPD construction roles) and
a transport role (ec_producer or ec_consumer). EPD transfers embeddings over
NIXL/LIBFABRIC (EFA) as an HBM→HBM RDMA read, which requires NIXL plus the
libcuda.so.1 and libfabric.so.1 shared libraries on the loader path — see
Install dependencies for disaggregated inference.
EPD configurations#
1E1PD: 1 vision encoder pool + 1 prefill+decode pool
xEyPD: Multiple VE and PD engines, scaled independently — add VEs for image-heavy traffic, PDs for token-heavy traffic
When to use EPD#
Multimodal serving where image encoding and text generation saturate at different rates, so one monolithic engine leaves one of the two idle
Workloads whose image-to-text ratio shifts over time, where you want to add encoder capacity without recompiling or resizing the language-model pool
Deployments that want asymmetric parallelism between the two stages
For the full launch commands, the required EFA environment variables, core alignment rules, and the failure modes with their error signatures, see the EPD tutorial. For how embeddings are stored and read on device, see On-device encoder cache.
Prompt embeddings#
Prompt embeddings allow you to pass precomputed embedding tensors instead of token IDs. This is useful when another system has already produced embeddings (e.g., a multimodal encoder or retrieval pipeline).
Enable prompt embeddings#
from vllm import LLM
llm = LLM(
model="meta-llama/Llama-3.3-70B-Instruct",
tensor_parallel_size=32,
enable_prompt_embeds=True,
)
Or via CLI:
python3 -m vllm.entrypoints.openai.api_server \
--model meta-llama/Llama-3.3-70B-Instruct \
--tensor-parallel-size 32 \
--enable-prompt-embeds
How prompt embeddings work#
Send a request with
prompt_embeds(shape[seq_len, hidden_size]) instead of prompt textvLLM schedules it like any other request (batching and padding unchanged)
The model merges your embeddings with token-derived hidden states during the forward pass
For implementation details, see Prompt embeddings design.
When to use prompt embeddings#
Multimodal pipelines where an encoder produces embeddings
Retrieval-augmented generation with pre-embedded passages
Any workflow where embeddings are computed externally
Multi-LoRA#
Multi-LoRA serving runs several LoRA adapters on one base model. Each request
selects the base model or one adapter. vLLM Neuron takes the LoRA
configuration from the vLLM LoRA arguments, as vLLM on GPU does:
--enable-lora, --max-loras, --max-lora-rank, --lora-modules,
--lora-target-modules, and --lora-dtype. This section gives the Neuron
behavior. For the general LoRA features of vLLM, see the
vLLM LoRA documentation.
For a step-by-step example, see the multi-LoRA tutorial. For the internal design, see Multi-LoRA serving design. To add LoRA to your own model, see Add LoRA to a custom model.
When to use multi-LoRA#
You have several fine-tuned variants of one base model, and you want to serve them from one server.
Each tenant or task has its own adapter, and the requests arrive mixed.
You want to add or change adapters without a recompile.
Supported models#
Multi-LoRA supports BF16 Llama models (LlamaForCausalLM). To add LoRA to
your own model, see
Add LoRA to a custom model.
Model |
Status |
Validated on hardware |
Notes |
|---|---|---|---|
Llama 3.1 8B (BF16) |
✅ |
Trn2: TP 8, 16, and 32. Trn3: TP 8. |
Accuracy, mixed-adapter batches, eviction, and performance. |
Llama 3.1 70B (BF16) |
✅ |
Trn2: TP 64 at LNC 2. |
Set |
Other in-tree models, for example Qwen2, Qwen3, GPT-OSS, and Qwen3-VL |
❌ |
They do not declare |
|
MoE expert weights, and quantized or packed (MX) base weights |
❌ |
Not supported on in-tree or custom models. |
Enable multi-LoRA#
Start the server with the vLLM LoRA arguments:
vllm serve meta-llama/Llama-3.1-8B \
--tensor-parallel-size 32 \
--enable-lora \
--max-loras 2 \
--max-lora-rank 32 \
--lora-modules sql=/path/to/adapters/sql math=/path/to/adapters/math
Or in Python:
from vllm import LLM
from vllm.lora.request import LoRARequest
llm = LLM(
model="meta-llama/Llama-3.1-8B",
tensor_parallel_size=32,
enable_lora=True,
max_loras=2,
max_lora_rank=32,
)
sql = LoRARequest("sql", 1, "/path/to/adapters/sql")
Argument |
Description |
|---|---|
|
Enables multi-LoRA. |
|
The number of adapter slots in HBM. It is also the largest number of different adapters in one step. |
|
The rank of the slot tensors. Each adapter must have this rank or a smaller rank. vLLM Neuron pads a smaller rank with zeros. vLLM accepts 1, 8, 16, 32, 64, 128, 256, 320, and 512. The default is 16. |
|
The adapters that the server registers at startup. |
|
The LoRA modules that get LoRA weights. The default is all the LoRA modules of the model. For Llama, these are |
|
The dtype of the LoRA weights. On Llama, use |
Set --max-lora-rank to the largest rank of the adapters that you serve, not
to a larger value. The HBM of the slots and the LoRA compute time grow with the
rank.
As on vLLM on GPU, one projection of a packed module selects all the
projections of that module. For example, --lora-target-modules gate_proj
gives LoRA weights to gate_proj and up_proj. vLLM Neuron does not use the
adapter weights of a projection that is not a target, and it logs a warning.
Select an adapter for each request#
Online: set
modelin the request to the adapter name from--lora-modules. To use the base model, setmodelto the base model name./v1/modelslists the base model and the adapters.Offline: give
lora_request=LoRARequest(name, lora_int_id, path)tollm.generate(), or a list with oneLoRARequestfor each prompt. A request withoutlora_requestuses the base model.At runtime: set
VLLM_ALLOW_RUNTIME_LORA_UPDATING=True, then call/v1/load_lora_adapterand/v1/unload_lora_adapter.
Warning
VLLM_ALLOW_RUNTIME_LORA_UPDATING=True lets each client of the server load
adapters from paths and Hugging Face Hub repo IDs that the client gives. Do
not set it on a server that untrusted clients can reach.
Give each adapter its own lora_int_id. A request that uses the
lora_int_id of another adapter fails. The API server gives each adapter in
--lora-modules and /v1/load_lora_adapter its own ID.
To load changed weights for a resident adapter, use /v1/load_lora_adapter
with "load_inplace": true. Offline, use llm.llm_engine.add_lora with
LoRARequest(..., load_inplace=True). A generate request does not load a
resident adapter again. The prefix cache keeps the blocks of the old weights
under the same adapter name and path. Thus, load changed weights from a new
path.
Adapter format#
vLLM Neuron loads PEFT adapters: a directory with adapter_config.json and
adapter_model.safetensors (or adapter_model.bin). It supports LoRA scaling
(lora_alpha / r) and rsLoRA scaling (lora_alpha / sqrt(r)).
vLLM Neuron rejects an adapter that uses one of these PEFT settings:
DoRA (
use_dora)rank_patternoralpha_patternmodules_to_saveA
biasvalue other than"none"
An adapter that has full embed_tokens or lm_head weights loads with a
warning. vLLM Neuron uses the embeddings of the base model, so tokens that the
adapter added to the vocabulary are not supported.
How multi-LoRA works#
At startup, vLLM Neuron adds LoRA weights for
--max-loras+ 1 slots to each target module. Slot 0 holds zeros and serves the base model.The slot weights are inputs of the compiled graphs. A new adapter does not cause a recompile.
The server loads each
--lora-modulesadapter into a slot at startup, and each/v1/load_lora_adapteradapter when it gets the call. Other adapters load when a request uses them for the first time: an offlineLoRARequest, an adapter that a resolver plugin finds, or an adapter that an eviction removed. This load is synchronous, before the forward pass of the step.When no slot is free, vLLM Neuron evicts the least recently used adapter that the step does not use.
The scheduler admits requests for a maximum of
--max-lorasdifferent adapters at the same time. A request for another adapter waits until a running adapter finishes. The requests behind it continue.A decode step selects the adapter of each sequence, so one decode batch can mix base requests and requests for different adapters. A prefill step holds one request, and all of its tokens use one adapter.
Adapter slots#
--max-loras sets the number of adapter slots in HBM. The HBM that the slots
use grows linearly with (--max-loras + 1) x --max-lora-rank.
vLLM Neuron has no CPU LoRA cache. It ignores --max-cpu-loras. When a
request needs an evicted adapter, vLLM Neuron reads the adapter again from the
path of its last load and resolves the path again. A Hugging Face Hub repo ID
then costs a Hub request on each load. With more adapters than --max-loras,
give local paths. Adapter pinning is not supported.
The HBM of each slot grows linearly with --max-lora-rank. On Llama 3.1 8B at
TP 32, with LoRA on all projections, one slot uses about 1.95 MB of HBM on each
NeuronCore for each unit of rank. The measurement used rank 256, and the table
scales this value linearly. Slot 0 also uses this HBM, so the total is
(--max-loras + 1) slots.
Model |
LoRA rank |
HBM for each slot on each NeuronCore |
Slots in 2 GB on each NeuronCore (slot 0 included) |
|---|---|---|---|
Llama 3.1 8B, TP 32 |
16 |
31 MB |
65 |
Llama 3.1 8B, TP 32 |
32 |
62 MB |
32 |
Llama 3.1 8B, TP 32 |
64 |
125 MB |
16 |
Adapter file staging and environment variables#
All tensor-parallel workers on a host load the same adapter at the same time.
To read each adapter file one time for each host, vLLM Neuron copies
adapter_model.safetensors into a host-memory (tmpfs) directory. The other
workers use this copy.
Variable |
Default |
Description |
|---|---|---|
|
|
The staging directory. Set |
|
|
The maximum number of staged files. The least recently used files are removed first. |
|
|
The maximum total size of the staged files, in GB. A larger file is read in place. |
The staged files are in host memory. They count against the memory limit of the container. vLLM Neuron reads the files in place if the staging directory is not owned by the current user, or if other users can access it.
Limits#
Models: Llama in BF16, and custom models that declare
SupportsLoRA. The Llama factory rejects a quantized model, a model dtype other than bfloat16, and a LoRA dtype other than bfloat16.Not supported, on in-tree and custom models: LoRA on MoE expert weights, and LoRA on quantized or packed base weights, for example MXFP4 and MXFP8.
Rejected at startup: speculative decoding, jump-forward decoding (
max_jump_forward_tokenslarger than 0), decode-context parallelism,attention_dp_sizelarger than 1,mlp_dp_sizelarger than 1, and pooling models.
Differences from vLLM on GPU#
The server rejects each of these configurations with an error that names the cause. vLLM on GPU accepts them.
A name in
--lora-target-modulesthat is not a LoRA module of the model, or a full module name, for examplemodel.layers.0.self_attn.q_proj.An empty
--lora-target-moduleslist (LLM(lora_target_modules=[])).embed_tokensorlm_headin--lora-target-modules. vLLM Neuron has no LoRA kernel for them.An adapter that has weights only for projections outside
--lora-target-modules.On a Llama model, a
--lora-dtypeother thanautoorbfloat16.
vLLM Neuron ignores these LoRA flags and request fields:
--max-cpu-loras,--specialize-active-lora, and--max-lora-cls-labels.--fully-sharded-loras. The output is the same as without it.--enable-tower-connector-lora. vLLM Neuron applies LoRA only to the weights thatget_lora_layout()lists.--enable-mixed-moe-lora-format,--enable-moe-shared-loras, and theis_3d_lora_weightfield of a LoRA request. Multi-LoRA on Neuron does not support MoE expert weights.
Compatibility matrix#
✅ Supported: enabled and tested on hardware. ❌ Not supported: rejected at startup, or not implemented.
Feature or configuration |
Status |
Notes |
|---|---|---|
Model Runner V2 and Model Runner V1 |
✅ |
|
Base requests and several adapters in one decode batch |
✅ |
|
Asynchronous scheduling |
✅ |
On by default. |
LRU eviction and reload of adapters |
✅ |
|
CPU LoRA cache ( |
❌ |
vLLM Neuron ignores |
Tensor parallelism |
✅ |
TP 8, 16, and 32 (8B, Trn2), TP 8 (8B, Trn3), and TP 64 (70B). |
Quantized base weights (FP8, MXFP4, MXFP8) |
❌ |
Rejected at startup, on in-tree and custom models. |
MoE expert weights |
❌ |
Not supported on in-tree or custom models. |
Speculative decoding (EAGLE3, DFlash, MTP) |
❌ |
Rejected at startup. |
Jump-forward decoding |
❌ |
Rejected at startup. |
Decode-context parallelism, attention DP, MLP DP |
❌ |
Rejected at startup. |
Pooling (embedding) models |
❌ |
Rejected at startup. |
Adapter pinning |
❌ |
|
DoRA, |
❌ |
|
Prefix caching |
✅ |
Needs segmented prefill. See the next row. |
Segmented prefill |
✅ |
See Segmented prefill for the conditions. |
FP8 KV cache |
✅ |
|
Replica data parallelism ( |
✅ |
|
Disaggregated inference (1P1D) |
✅ |
|
Structured outputs |
✅ |
|
Runtime adapter load and unload ( |
✅ |
Including |
LoRA resolver plugins ( |
✅ |
Set |
Trn3 |
✅ |
Metrics#
vLLM Neuron publishes custom Prometheus metrics alongside vLLM’s
built-in metrics at the /metrics endpoint.
Multiprocess mode#
vLLM Neuron enables prometheus_client multiprocess mode so that
metrics observed in the EngineCore and Worker processes are written to
shared mmap files and aggregated by the API server’s /metrics
endpoint.
PROMETHEUS_MULTIPROC_DIR is set automatically at module load time. You
can override it by setting the environment variable before starting the
server. The directory should be wiped between server restarts to avoid
stale metrics.
Neuron-specific metrics#
All Neuron-specific metrics use the vllm_neuron: prefix.
General metrics:
Metric Name |
Type |
Description |
|---|---|---|
|
Histogram |
Padded batch lines, by |
|
Histogram |
Padded sequence length, by |
|
Counter |
NEFF executions, by |
Server startup metrics:
Metric Name |
Type |
Description |
|---|---|---|
|
Gauge |
Total server startup time |
|
Gauge |
Worker wall time for graph extraction, compilation, and warmup |
|
Gauge |
Weight load time (host to HBM) |
|
Gauge |
Weight size transferred to device |
Common labels:
Label |
Description |
|---|---|
|
Model name for that server process |
|
Bucket identifier (e.g., |
|
Process local rank ID (relative to start rank) |
Querying metrics#
curl http://localhost:8000/metrics | grep vllm_neuron
Profiling#
For capturing Neuron Runtime profiles to analyze per-layer latency and device utilization, see How to profile workloads.
Memory management#
vLLM Neuron uses memory utilization and a fractional KV cap by default. An explicit headroom value enables reserve sizing.
How memory management works#
On Neuron, KV cache size is baked into the compiled program (NEFF) shape. The KV sizing decision directly affects whether the model can compile at all – if KV allocation is too large, the compiler rejects the program.
The default Neuron budget is:
total_budget = int(logical_core_hbm * gpu_memory_utilization)
available = max(min(
max(total_budget - model_weight_bytes - encoder_cache_bytes, 0),
int(total_budget * cap_fraction),
), 0)
The default fractional cap is 0.30. An explicit headroom value selects:
available = max(
logical_core_hbm - model_weight_bytes - encoder_cache_bytes
- headroom_bytes, 0)
logical_core_hbm is the HBM share of one logical NeuronCore. It is not the
HBM of the instance, and it is not the HBM of one stack. On Trn2 and Trn3, one
HBM stack serves 2 physical cores. At LNC 2, one logical core owns the whole
stack. At LNC 1, two logical cores share the stack, so the share is half of a
stack. Read the share from the startup log line that reports the logical-core
HBM. Do not calculate it from the HBM of the instance.
encoder_cache_bytes is the on-device encoder cache of a multimodal model.
It is zero for a text-only model.
CPU inference already accounts for weights in host available memory. Default sizing applies memory utilization and the cap to each worker’s share. Explicit headroom uses:
available = max(host_available / local_workers - headroom_bytes, 0)
Zero free HBM on a device#
The Neuron runtime can report zero free HBM together with used HBM above zero. The allocations of this core then reach or pass its HBM share. The worker sizes the KV cache budget at zero. The default minimum-budget check then stops the server. The error carries this cause line:
Cause: the Neuron runtime reports zero free HBM, and the used HBM is above zero. The allocations of this core reach or pass its HBM share, so no HBM is left for the KV cache. A larger memory utilization value cannot add HBM. Raise the tensor-parallel degree to make the device footprint smaller.
No gpu_memory_utilization value and no headroom value can add HBM to the
core. The error therefore recommends no change to either value. Raise the
tensor-parallel degree to make the device footprint smaller.
A report of zero used HBM with zero free HBM is a different state. Those figures describe no logical core, so the worker rejects them. For the full message, and for the message of each budget policy, see Memory management and Troubleshooting.
Key environment variables#
Variable |
Default |
Description |
|---|---|---|
|
0.30 |
Fractional cap for default sizing. Headroom mode bypasses this value. |
|
unset |
Explicit reserve per worker. Enables headroom sizing. |
|
1.0 |
Minimum KV budget in GiB. The server stops if the budget is smaller. |
A validated GPT-OSS 120B configuration can explicitly select 4 GiB. Other configurations must validate the reserve.
Only explicit headroom mode sets gpu_memory_utilization to 1.0.
This mode bypasses the fractional cap. Zero is an explicit headroom value.
When to tune memory settings#
In default mode, reduce the fractional cap after an HBM allocation failure
In headroom mode, if logs contain
NCC_EOOM002,Maximum peak HBM usage,NRT_RESOURCEinnrt_load_util, orAllocation Failure, increase the active headroom variable in 1 GiB incrementsEach additional 1 GiB of headroom reduces the KV cache budget by 1 GiB; keep the smallest value that passes the same model, sharding, backend, and hardware
If you need more concurrent requests, decrease the headroom after validation
In headroom mode, if startup fails with “KV cache budget below minimum threshold”, decrease headroom; do not increase it for that error
In the zero-free HBM state, no headroom value helps; raise the tensor-parallel degree instead
Neuron-specific configuration#
All Neuron-specific options are passed through the additional_config
parameter nested under neuron_config. For the complete parameter
reference, see Configuration options.
Features not yet supported#
vLLM Neuron does not support the following vLLM features. Where a Neuron alternative exists, the table links to it.
Feature |
On vLLM Neuron |
Use instead |
|---|---|---|
Pipeline parallelism (PP) |
Not supported. |
Tensor parallelism, with data parallelism for more replicas. See Tensor, data, and expert parallelism. |
Chunked prefill with mixed batching |
Prefill and decode never run in the same batch. If you enable chunked prefill, the server logs a warning and chunks prefills one request at a time. |
Segmented prefill. To keep long prefill requests from stalling decode, use disaggregated inference. |
Upstream vLLM model definitions |
vLLM Neuron serves its own Neuron implementations of the models listed in the model recipes. A model architecture outside that list does not run until it is implemented against the plugin. |
|
Sleep mode ( |
Not supported. |
None. |
Weight reload API |
Not supported. |
Restart the server with the new weights. |
Dynamic shapes |
Neuron compiles static-shape programs. Inputs are padded to the nearest compiled bucket. |
Common issues#
Prefix caching has no effect (no cache reuse, no TTFT improvement)#
Prefix caching is on by default; the most common cause of low reuse is too few KV cache blocks to retain prefixes. Increase
num_gpu_blocks_override(see the prefix caching section above).Cache hits require a byte-for-byte identical shared prefix across requests. Even a trailing whitespace difference in the system prompt prevents reuse.
Confirm it was not disabled — check for
--no-enable-prefix-cachingorenable_prefix_caching=Falsein your launch configuration.
Server fails with “ep_degree requires –enable-expert-parallel”#
Set both
--enable-expert-parallelandep_degreetogether, or removeep_degreefromneuron_configentirely.
Server fails with “quantization=’mxfp4’ is not supported on TRN2”#
Use BF16 on Trn2, or use Trn3 for MXFP4. See the quantization section.
Compilation takes too long at startup#
Reduce the number of
num_batched_tokens_bucketsandnum_seqs_bucketsUse
NEURON_COMPILED_ARTIFACTSto cache compiled models between restartsSet
NEURON_LIBTORCH_PARALLEL_COMPILE_WORKERSto increase parallel compilation
Structured outputs produce unexpected results#
Verify your JSON schema is valid and complete
Ensure
requiredfields are specified in the schemaConfirm on-device sampling is enabled (required for
tool_choice="required")
KV cache budget too low#
In default mode, increase memory utilization or the fractional cap after validation. The error gives that advice only when it carries no cause line
In headroom mode, decrease
VLLM_NEURON_RESERVED_HEADROOM_GIBLower
VLLM_NEURON_MIN_KV_BUDGET_GIBonly if a smaller KV cache is validIn the zero-free HBM state, neither value helps. Raise the tensor-parallel degree instead
Async scheduling sync fallbacks#
Check logs for frequent “batch composition changed” messages
This is normal for workloads with many short responses; async benefits scale with response length
Server runs MRv1 when you expect Model Runner V2#
Search the worker log for
Using the standalone V2 Neuron model runner.If the line is absent, the server runs MRv1.Search the log for
Neuron Model Runner V2 does not yet support. The message lists the features that selected MRv1. Remove them, or keep MRv1.A custom Mixture-of-Experts, sliding-window, multimodal, encoder-decoder, attention-free, or diffusion architecture registered outside vLLM Neuron uses MRv1 without a log message. A hybrid model uses MRv2. See Configurations that use MRv1.
Check that
VLLM_USE_V2_MODEL_RUNNERis not set to0in the server environment.
Multi-LoRA fails to compile at LNC 1 on 70B models#
The default logical NeuronCore configuration (LNC) is 1. At LNC 1, the LoRA prefill MLP kernel does not fit in on-chip memory for a model with a hidden size of 8192, for example Llama 3.1 70B. The compile stops with an
NCC_EGCA111error.Set
--additional-config '{"logical_nc_config": 2}'. See logical_nc_config.