vLLM Architecture Deep Dive Reveals How High-Throughput LLM Inference Works at Scale
#LLMs

vLLM Architecture Deep Dive Reveals How High-Throughput LLM Inference Works at Scale

Elena Varga
Elena Varga
3 min read

A new technical breakdown of vLLM's V1 engine shows how paged attention, continuous batching, and disaggregated prefill-decode enable serving large language models across multiple GPUs with minimal latency.

A detailed technical analysis of vLLM's inference engine published this week exposes the internal machinery that lets developers serve large language models at production scale. The breakdown, written by Aleksa Gordić, walks through the V1 engine architecture from single-GPU execution to distributed serving across multiple nodes.

Featured image

The analysis centers on five core components: the engine core with its scheduler and KV-cache manager, advanced features like chunked prefill and speculative decoding, multi-GPU scaling through tensor and pipeline parallelism, a distributed serving layer built on ZeroMQ and NCCL, and benchmarking methodology for latency-throughput tradeoffs.

At the heart of vLLM sits paged attention, a memory management technique that divides key-value caches into fixed-size blocks. Rather than allocating contiguous memory for each request, the engine pulls blocks from a shared pool as needed. This eliminates fragmentation and enables continuous batching — mixing prefill and decode requests in the same forward pass.

KV cache blocks

The scheduler prioritizes decode requests already in the running queue, then admits prefill requests from the waiting queue up to a token budget. Each request maps to a list of KV-cache blocks stored in a doubly linked list. When a request finishes, its blocks return to the free pool.

Prefix caching adds another layer of efficiency. When multiple prompts share a common prefix longer than one block, the engine computes a hash for each block and checks a global cache. On a hit, it reuses the cached KV blocks instead of recomputing. The reference count tracks how many active requests depend on each block.

Engine loop

Speculative decoding introduces a smaller draft model that proposes multiple tokens per step. The large model verifies them in a single forward pass using an accept-reject criterion that preserves the original distribution. vLLM supports n-gram, EAGLE, and Medusa draft methods.

For models exceeding single-GPU memory, vLLM shifts from UniProcExecutor to MultiProcExecutor. The latter spawns one worker process per GPU rank, connected via shared-memory message queues. Tensor parallelism shards weight matrices across GPUs; pipeline parallelism splits layers across nodes. The driver rank coordinates and returns results.

fwd pass - continuous batching & paged attn

The distributed serving stack adds a data-parallel coordinator and load-balanced API servers. Requests hit a FastAPI endpoint, route to the least-loaded engine replica via ZeroMQ, and stream tokens back through async output handlers. The system supports elastic scaling through Ray.

Disaggregated prefill-decode separates the compute-heavy prefill phase from the memory-bound decode phase. Prefill workers write KV caches to a shared storage connector; decode workers read them. This isolates bursty prefill traffic from latency-sensitive decoding.

Chunked prefilling - pt 1

Benchmarking reveals the classic latency-throughput tension. Small batches minimize inter-token latency but underutilize GPU memory bandwidth. Large batches amortize weight I/O but increase per-token latency. The roofline model shows a saturation batch size where kernels shift from memory-bound to compute-bound. vLLM's benchmark CLI measures time-to-first-token, inter-token latency, and goodput under SLO constraints.

The analysis covers commit 42172ad from August 2025. Gordić plans follow-up posts diving into individual subsystems including multi-modal support, mixture-of-experts routing, and async scheduling experiments.

Comments

Loading comments...