vLLM is a high-throughput LLM inference engine designed to optimize memory management and execution efficiency. At its core, the engine utilizes paged attention, which manages KV-cache memory through a block-based indexing system (defaulting to 16 tokens per block) to prevent fragmentation. This allows for continuous batching, where the scheduler can mix compute-bound prefill requests and memory-bandwidth-bound decode requests within the same engine step. To improve performance, vLLM implements chunked prefill to prevent long prompts from monopolizing resources, and prefix caching, which uses SHA-256 or standard hashing to reuse KV-cache blocks for shared prompt prefixes. For advanced inference, the system supports guided decoding via grammar-constrained finite-state machines (FSMs) and speculative decoding to accelerate autoregressive generation. While traditional speculative decoding uses a separate draft model, vLLM V1 implements efficient proposal schemes like n-gram, EAGLE, and Medusa. Furthermore, the architecture facilitates disaggregated prefill/decoding (P/D), separating these distinct workloads into independent worker instances to optimize Time-to-First-Token (TTFT) and Inter-Token Latency (ITL) by isolating compute-heavy tasks from memory-intensive ones.

Read original