What Actually Happens When vLLM Serves a Request?

A request to vllm serve goes to the API server process, which tokenizes it and passes it to the engine core process. The engine core's scheduler batches it with other requests and sends the batch to a GPU worker, whose model runner calls the model: an ordinary PyTorch module. By default vLLM compiles that model with torch.compile before serving: Dynamo captures it, the graph is split at attention, and TorchInductor generates Triton kernels that are replayed through CUDA Graphs. With --enforce-eager, vLLM skips compilation and runs its own CUDA kernels and PyTorch's ATen ops directly. Attention always goes through an attention backend, FlashAttention by default on Ampere and Hopper GPUs, or Triton.
Mode
Attention backend

Showing the default torch.compile + CUDA Graphs mode with the FlashAttention backend: 14 stages, 14 steps.

Your app or client sends a request to API server API server passes tokens over ZMQ to Engine core Engine core schedules each step on GPU worker GPU worker runs the batch through Model runner Model runner calls forward() on PyTorch model PyTorch model runs layers as Eager CUDA kernels PyTorch model calls attention through Attention op PyTorch model captured once at startup by TorchDynamo Attention op runs on FlashAttention Attention op runs on Triton attention TorchDynamo split at attention into Piecewise graph Piecewise graph compiled by TorchInductor TorchInductor generates Triton kernels Triton kernels recorded into CUDA Graphs CUDA Graphs replayed on NVIDIA GPU Eager CUDA kernels launch on NVIDIA GPU FlashAttention runs on NVIDIA GPU Triton attention runs on NVIDIA GPU Your app or client application API server framework component Engine core framework component GPU worker runtime Model runner framework component PyTorch model framework component Eager CUDA kernels kernel Attention op framework component TorchDynamo compiler FlashAttention kernel Triton attention kernel Piecewise graph intermediate representation TorchInductor compiler Triton kernels kernel CUDA Graphs runtime NVIDIA GPU hardware

The selected path, step by step

  1. Your app or client sends a request to API server: Your client sends an HTTP request, for example to the OpenAI-compatible chat completions endpoint.
  2. API server passes tokens over ZMQ to Engine core: The API server tokenizes the prompt and hands the request to the engine core process over ZMQ sockets.
  3. Engine core schedules each step on GPU worker: Every step the scheduler fills a token budget from running and waiting requests, allocates KV-cache blocks for them, and sends the batch to the GPU workers.
  4. GPU worker runs the batch through Model runner: The worker's model runner prepares the input tensors for the batch.
  5. Model runner calls forward() on PyTorch model: The model runner calls the model's forward pass on the batch.
  6. PyTorch model calls attention through Attention op: Each attention layer calls one vLLM custom op, in both modes.
  7. PyTorch model captured once at startup by TorchDynamo: Dynamo traces the model's forward function before vLLM serves anything; no request triggers a new compilation.
  8. Attention op runs on FlashAttention: On Ampere and Hopper GPUs, FlashAttention is the first backend vLLM tries when none is selected.
  9. TorchDynamo split at attention into Piecewise graph: The captured graph is cut at each attention call; attention stays a single opaque op between the pieces.
  10. Piecewise graph compiled by TorchInductor: Each piece is compiled by TorchInductor, and the result is cached on disk for the next start.
  11. TorchInductor generates Triton kernels: Under compilation vLLM turns its custom ops off by default and Inductor generates fused Triton kernels in their place.
  12. Triton kernels recorded into CUDA Graphs: The model runner records the compiled kernels' launches as CUDA Graphs and replays them each step.
  13. CUDA Graphs replayed on NVIDIA GPU: Replaying a graph launches its whole recorded sequence of kernels at once.
  14. FlashAttention runs on NVIDIA GPU: Attention kernels run on the GPU; in the default compiled mode, single-token decode batches can include them in a full CUDA Graph.

Why vLLM is several processes

HTTP handling and tokenization run in the API server process; scheduling and KV-cache management run in the engine core process; each GPU has its own worker process. vLLM splits the work this way to separate concerns and maximize throughput; the processes talk over ZMQ sockets. Each step, the scheduler fills a token budget from both running and waiting requests, so there are no separate prefill and decode phases.

The KV cache is managed in fixed-size blocks. The scheduler's KV-cache manager builds the block tables, and the attention backend reads keys and values through them: this is PagedAttention, which today lives inside the attention backends rather than in a separate kernel.

Compiled before the first request

vLLM uses the same compiler stack as PyTorch's torch.compile, with one difference that matters for a server: every compilation finishes before vLLM serves any request, and the result is cached on disk, so no request triggers a recompilation.

The captured graph is split at each attention call. The pieces between attention calls are compiled by TorchInductor and captured as CUDA Graphs; by default, batches of single-token decode steps can run as one full CUDA Graph that includes attention. For a local, single-file engine built on hand-written kernels instead, compare how llama.cpp runs a model.

Every stage

Your app or client

application

Any program that sends requests to vLLM's OpenAI-compatible HTTP API and reads the streamed results.

  • The API server process handles HTTP requests (e.g., the OpenAI-compatible API), performs input processing (tokenization, multi-modal data loading), and streams results back to clients.
    Architecture Overview (vLLM documentation) Project docs

API server

framework component

The process started by vllm serve. It handles HTTP, tokenizes inputs, and streams outputs back.

In the atlas: vLLM

Engine core

framework component

The process that runs the scheduler and manages the KV cache. Each step it picks which requests run and how many of their tokens.

In the atlas: vLLM

GPU worker

runtime

One process per GPU. It loads the model weights, runs forward passes, and manages GPU memory.

In the atlas: vLLM

Model runner

framework component

Inside each worker: prepares the input tensors for the batch and captures the CUDA Graphs.

In the atlas: vLLM

PyTorch model

framework component

The model itself, an ordinary PyTorch nn.Module (for example vLLM's Llama implementation).

In the atlas: PyTorch

Eager CUDA kernels

kernel

Without compilation, layers that are vLLM custom ops run vLLM's own CUDA kernels, and the rest run as PyTorch ATen operations, one kernel launch at a time.

In the atlas: CUDA

Attention op

framework component

vLLM wraps each attention call in one PyTorch custom op, so the compiler treats it as a single opaque operation.

In the atlas: vLLM

  • we wrap the whole attention operation into a PyTorch custom op torch.ops.vllm.unified_attention_with_output, so that Dynamo will not try to inspect any of the internal operations.
    torch.compile integration (vLLM documentation) Project docs

FlashAttention

kernel

The FlashAttention-based backend, vLLM's first choice for standard attention on Ampere and Hopper GPUs. It reads keys and values from the paged KV cache.

Triton attention

kernel

An attention backend written in Triton (TritonAttentionImpl). Selected with --attention-backend TRITON_ATTN, or automatically when the backends ahead of it do not fit the model.

In the atlas: Triton

  • Paged attention is now implemented directly inside vLLM's attention backends (for example TritonAttentionImpl in vllm/v1/attention/backends/triton_attn.py, or the FlashAttention-based backend) using block tables built by the scheduler's KV-cache manager
    Paged Attention (vLLM documentation) Project docs
  • Ampere/Hopper (SM 8.x-9.x): Priority Backend 1 FLASH_ATTN 2 FLASHINFER 3 TRITON_ATTN
    Attention Backend Feature Support (vLLM documentation) Project docs

Piecewise graph

intermediate representation

The captured computation graph, split at each attention call into pieces that are compiled one by one.

TorchInductor

compiler

PyTorch's compiler backend. It compiles each graph piece; vLLM caches the results on disk.

Triton kernels

kernel

Fused GPU kernels that Inductor generates in Triton, including for the vLLM custom ops that compilation turns off.

In the atlas: Triton

CUDA Graphs

runtime

Recorded sequences of kernel launches that are replayed as one unit. By default: full graphs for decode batches, piecewise graphs (attention left outside) for the rest.

In the atlas: CUDA

NVIDIA GPU

hardware

The GPU that runs the kernels. This page covers Ampere and Hopper GPUs, where vLLM's attention priority list starts with FlashAttention.

Every step

FromStepToWhenWhat happensSource
Your app or clientsends a request toAPI serverany mode · any attention backendYour client sends an HTTP request, for example to the OpenAI-compatible chat completions endpoint.Project docs
API serverpasses tokens over ZMQ toEngine coreany mode · any attention backendThe API server tokenizes the prompt and hands the request to the engine core process over ZMQ sockets.Project docs
Engine coreschedules each step onGPU workerany mode · any attention backendEvery step the scheduler fills a token budget from running and waiting requests, allocates KV-cache blocks for them, and sends the batch to the GPU workers.Project docs
GPU workerruns the batch throughModel runnerany mode · any attention backendThe worker's model runner prepares the input tensors for the batch.Project docs
Model runnercalls forward() onPyTorch modelany mode · any attention backendThe model runner calls the model's forward pass on the batch.Project docs
PyTorch modelruns layers asEager CUDA kernels--enforce-eager · any attention backendWith --enforce-eager there is no compilation or graph capture: each layer launches its kernels as Python reaches it. Startup is fastest; steady-state decoding is slower.Project docs
Project docs
PyTorch modelcalls attention throughAttention opany mode · any attention backendEach attention layer calls one vLLM custom op, in both modes.Project docs
PyTorch modelcaptured once at startup byTorchDynamoDefault (compiled) · any attention backendDynamo traces the model's forward function before vLLM serves anything; no request triggers a new compilation.Project docs
Project docs
Attention opruns onFlashAttentionany mode · FlashAttentionOn Ampere and Hopper GPUs, FlashAttention is the first backend vLLM tries when none is selected.Project docs
Project docs
Attention opruns onTriton attentionany mode · TritonThe Triton backend implements paged attention in Triton kernels, reading keys and values through the scheduler's block tables.Project docs
TorchDynamosplit at attention intoPiecewise graphDefault (compiled) · any attention backendThe captured graph is cut at each attention call; attention stays a single opaque op between the pieces.Project docs
Piecewise graphcompiled byTorchInductorDefault (compiled) · any attention backendEach piece is compiled by TorchInductor, and the result is cached on disk for the next start.Project docs
TorchInductorgeneratesTriton kernelsDefault (compiled) · any attention backendUnder compilation vLLM turns its custom ops off by default and Inductor generates fused Triton kernels in their place.Project docs
Triton kernelsrecorded intoCUDA GraphsDefault (compiled) · any attention backendThe model runner records the compiled kernels' launches as CUDA Graphs and replays them each step.Project docs
Project docs
CUDA Graphsreplayed onNVIDIA GPUDefault (compiled) · any attention backendReplaying a graph launches its whole recorded sequence of kernels at once.Project docs
Eager CUDA kernelslaunch onNVIDIA GPU--enforce-eager · any attention backendEach kernel is launched on the GPU individually.Project docs
FlashAttentionruns onNVIDIA GPUany mode · FlashAttentionAttention kernels run on the GPU; in the default compiled mode, single-token decode batches can include them in a full CUDA Graph.Project docs
Triton attentionruns onNVIDIA GPUany mode · TritonAttention kernels run on the GPU; in the default compiled mode, single-token decode batches can include them in a full CUDA Graph.Project docs

What this does not show

Documented paths for one model served with vllm serve on a single NVIDIA Ampere or Hopper GPU, in the default compiled mode or with --enforce-eager, using the FlashAttention or Triton attention backend. Tensor, pipeline and data parallelism, AMD, TPU, CPU and other platforms, FlashInfer and MLA backends, quantized GEMM kernels, speculative decoding, multimodal encoders and the experimental Rust frontend are out of scope.

How this page is checked

Every stage and step above quotes the source that supports it. The quotes were checked against the vLLM documentation (Architecture Overview, torch.compile integration, CUDA Graphs, CustomOp, Attention Backend Feature Support, Paged Attention, Optimization and Tuning), the vLLM README and the PyTorch ATen documentation on 2026-11-11. The data is a versioned JSON file under the same CC BY 4.0 license as the dataset. Found something wrong or out of date? Open an issue with the better source.

What these tools are written in is in the main atlas: vLLM, PyTorch, CUDA, Triton. More execution paths: What Actually Happens When You Run JAX Code, How Does llama.cpp Run a Model on Your Hardware, What Actually Happens When You Run MLX on a Mac, How Does ONNX Runtime Execute a Model Across Hardware, What Actually Happens When You Run a PyTorch Model, or compare them all.

Explore the full graph →