This document is relevant for: Trn2, Trn3

vLLM Neuron Plugin Documentation#

The vLLM Neuron plugin brings the full vLLM serving stack to AWS Trainium accelerators. It supports continuous batching, speculative decoding (EAGLE3 and DFlash), disaggregated inference, structured outputs, multimodal models, and more — all accessible through the standard vllm serve command and OpenAI-compatible API.

For a high-level overview of inference on Neuron and help choosing the right inference solution, see Inference on Neuron. The source code for the vLLM Neuron plugin is hosted in the vLLM Neuron GitHub repository.


Get started#

Setup guide

Install and configure vLLM Neuron on a Trainium instance.

Online serving quickstart

Launch an OpenAI-compatible API server and send your first chat request.

Offline serving quickstart

High-throughput batch inference with the vllm.LLM Python API.

Migration from NxD Inference

Migrate existing NxDI deployments to the vLLM Neuron plugin.

Deploy & serve#

Features guide

Configure and tune all serving features — bucketing, quantization, DI, speculation, and more.

Configuration reference

All Neuron-specific options in additional_config and environment variables.

Profiling workloads

Capture Neuron Runtime profiles via built-in profiler endpoints.

Precompile cache

Understand the Precompile Cache, confirm a warm hit, and know what invalidates it.

CPU KV offloading

Add a host-memory tier to the prefix cache, size it, and choose a copy mode.

Model recipes

Supported models and their feature tables.

Model Recipes#

Deploy Llama 3

Model recipe for the Llama 3 family (1B, 8B, 70B) on Trn2/Trn3.

Deploy GPT-OSS

Model recipe for GPT-OSS 20B and 120B (MoE) on Trn2/Trn3.

Deploy Qwen3-32B

Model recipe for Qwen3-32B (dense) on Trn2/Trn3.

Deploy Qwen3-VL 32B

Model recipe for Qwen3-VL 32B (multimodal) on Trn2/Trn3.

Deploy Qwen3-Embedding 8B

Model recipe for Qwen3-Embedding 8B (pooling / embeddings) on Trn2/Trn3.

Deploy Qwen3-ASR 1.7B

Model recipe for Qwen3-ASR 1.7B speech recognition on Trn2.

Tutorials#

Deploy Llama 3.3 70B (FP8)

Deploy Llama 3.3 70B in static FP8 on a single Trn2/Trn3 instance.

EAGLE3 speculative decoding (Llama 3.1)

Run Llama 3.1 8B with an EAGLE3 draft model for higher throughput.

EAGLE3 speculative decoding (GPT-OSS)

Run GPT-OSS-120B with an EAGLE3 draft model for higher throughput.

DFlash speculative decoding

Run Llama 3.1 8B with a block-parallel DFlash draft model.

Deploy gpt-oss

End-to-end deployment of GPT-OSS on Trn2/Trn3.

High-performance GPT-OSS 120B 8K/1K deployment

Serve GPT-OSS 120B at 8K/1K on two Trn3 instances, with the decode megakernel.

Deploy Qwen3-VL-32B

Deploy Qwen3-VL 32B for multimodal inference.

Multi-LoRA serving (Llama 3.1 8B)

Serve several LoRA adapters on one Llama 3.1 8B base model.

Disaggregated inference: 1P1D and xPyD

Configure disaggregated inference topologies.

Production serving with llm-d

Serve vLLM Neuron on Amazon EKS behind llm-d, with disaggregated prefill and decode and KV-cache-aware routing.

Disaggregated encoder: 1E1PD and xEyPD

Configure encoder-disaggregated (EPD) multimodal topologies.

Prefix caching benchmark

Measure TTFT improvement from prefix caching with GPT-OSS.

Deploy Qwen3-Embedding-8B

Serve embeddings via /v1/embeddings with a pooling model.

Deploy Qwen3-ASR-1.7B

Deploy Qwen3-ASR-1.7B for online and offline transcription.

Model development#

Onboard a new model

Implement and register a new architecture with vLLM.

Onboard a vision-language model

Add a vision encoder tower on top of the text-decoder flow.

Optimizing a vision-language model

Roofline, sharding, and profiling to optimize a VLM.

CPU development workflow

Develop and test without Neuron hardware.

NKI CPU simulator

Validate NKI kernel correctness on CPU.

Debugging model code

Use pdb and print statements to inspect model execution.

Debugging accuracy issues

Methodology for isolating where accuracy drift is introduced.

Accuracy debugger tools

Run the automated debugger pipeline and interpret results.

Concepts & architecture#

Parallelism#

Topic

Description

Attention DP

Sharding Q/O weights across DP groups

Component DP sharding

Per-component independent sharding

Data parallelism

Data parallelism overview

Decode Context Parallelism

KV cache sequence sharding for long contexts

Encoder parallelism

Independent TP/DP for multimodal encoders

Expert parallelism

Expert parallelism for MoE

Tensor parallelism

Tensor parallelism overview

Speculation#

Topic

Description

Speculative decoding (EAGLE3)

EAGLE3 autoregressive drafter internals on Neuron

Speculative decoding (DFlash)

DFlash block-parallel drafter internals on Neuron

Multimodal#

Topic

Description

Block packing attention

FFD block packing for multi-image attention efficiency

Vision block bucket planner

Choosing an attention block ladder for a mixed-resolution workload

On-Device Encoder Cache

Block-based on-device cache for encoder outputs

Encoder Cache Metrics

mm / prefix / encoder cache layers and their Prometheus metrics

M-RoPE

Spatial position embeddings for VLMs

vLLM integration#

Topic

Description

vLLM integration design reference

Plugin registration, scheduler, KV cache

KV cache integration

KV cache integration points with vLLM

Additional config

Additional configuration options

Async scheduling and execution

Async scheduling and execution design

Context-length bucketing

Reducing decode HBM reads

Memory management

Available memory determination

KV cache quantization

FP8 KV cache mechanics

Metrics

Production metrics design

Neuron profiling

Profiling integration

Neuron scheduler

Holdback queue and admission control

Block KV batching and padding

Block KV cache architecture

Prefill processing and prefix caching

Prefill segmentation and KV reuse

Pooling models

Pooling model execution on Neuron

Prompt embeddings

Prompt embedding support

Multi-LoRA serving

Adapter slots, per-token routing, LoRA kernels

Structured outputs and tool calling

JSON, regex, grammar-constrained generation

Disaggregated inference

DI architecture, NIXL transport, hybrid TP, DCP

CPU KV offloading

Host tier of the prefix cache, copy modes, ordering against executions

GPT-OSS-120B decode megakernel

Single-NEFF decode for the whole GPT-OSS-120B decoder stack

Framework#

Topic

Description

Async execution

Async execution double buffering

Checkpoint loading

Multi-process weight loading from SafeTensors

Model factory

Model registry and factory pattern

Per-graph compiler arguments

Per-graph neuronx-cc arguments through a model method

Compilation#

Topic

Description

How vLLM is integrated with TorchNeuron

How vLLM Neuron uses the TorchNeuron torch.compile lowering

Compilation cache

Compilation cache (hit/miss, remote store)

CPU compilation

Ahead-of-time CPU compilation (NEFF extraction)

FX passes architecture

FX passes architecture

Aliasing output rewrite pass

Aliasing output rewrite pass

Device rewriting FX pass

Device rewriting FX pass

Inplace to out-of-place pass

Inplace to out-of-place rewrite

SPMD compilation

Collapse per-rank compiles into a single shared NEFF

Compile-artifact manifest

The per-engine manifest.json — compiled graphs, the config that produced them, and how it’s laid out on disk

Accuracy#

Topic

Description

Accuracy debugging design

Accuracy debugging framework

Dataset evaluation

How task-level lm_eval dataset runners work

Input snapshot

How NRT-boundary input tensors are captured for off-chip replay

KV cache analysis

KV cache analysis

Logit validation

Logit validation

Module test guidelines

Module test guidelines

Tensor capture

Tensor capture

Tensor compare

Tensor compare

Tensor replacement

Tensor replacement

This document is relevant for: Trn2, Trn3