In this article
  1. Before you start
  2. Why interviewers ask this
  3. vLLM from first principles
  4. The Staff-level answer
  5. The rubric
  6. Three variants of this question
  7. Common mistakes
  8. Follow-up questions
  9. Sources

Before you start

vLLM is one engine within the wider field of LLM inference optimization, and understanding it builds on the transformer architecture.

Why interviewers ask this

An answer that stops at "vLLM uses PagedAttention" costs the point, because the follow-up is always what the rest of the engine does. Interviewers ask how vLLM works to see whether a candidate understands that serving throughput is limited by memory and scheduling, not only by arithmetic speed.

A weak answer names the library and one buzzword. A strong answer explains why the KV cache fragments memory, how fixed-size blocks fix that, and why more free memory means a bigger batch. A Staff-level answer adds the scheduler: each step is shared out under a token budget, repeated prompt prefixes can be reused, and for small models the central processing unit (CPU) work between GPU steps can become the bottleneck. The sources for all of this are the vLLM paper and the vLLM team's V1 architecture post; this page is built from both.

vLLM from first principles

Block table
A block table is a per-request list that maps a request's token positions to the fixed-size memory blocks holding its KV cache, so the blocks need not sit next to each other in GPU memory, in the way a page table maps virtual memory to physical memory.
Prefix cache
A prefix cache is a store of KV-cache blocks keyed by a hash of the tokens they hold, so a new request that starts with text already processed can reuse those blocks instead of recomputing them.

In plain words

Picture a car park. The old way reserves one long row of bays for each car. The row is sized for the longest car that could ever arrive. Most bays sit empty, so few cars fit. The vLLM way gives each car single bays, wherever they are free. It writes the bay numbers on a ticket. The analogy breaks in one place. A parked car never needs more space, but a language model's cache grows by one token at a time.

In one precise sentence, vLLM keeps each request's KV cache in small fixed-size blocks tracked by a block table, and a scheduler packs as many requests as fit into every step of the model.

Step 1: The KV cache lives in small blocks, not one long reservation

A language model's KV cache grows with every token a request generates, and its final length is not known in advance. Kwon et al. (2023) argue that managing this memory badly wastes it through fragmentation and duplication, which limits the batch size. Their fix is PagedAttention, an attention algorithm inspired by virtual memory and paging in operating systems, covered in depth on its own page.

Input: a request whose cache grows token by token. What changes: the engine takes one new block from a shared pool whenever the last one fills, and records it in the block table. Output: a cache whose waste is at most part of one block. The paper reports near-zero KV-cache waste and sharing of cache within and across requests. You now know where the memory saving comes from; the next step is who uses it.

Step 2: The scheduler splits a token budget across requests

The scheduler decides, at every step, which requests run and how many tokens each one processes. In V1 it does not separate a prefill phase (reading the whole prompt) from a decode phase (writing one token at a time). Per the V1 post (January 2025), it treats prompt tokens and generated tokens alike, and a decision is a simple map from request id to a number of tokens.

Input: the running and waiting requests plus a fixed token budget. What changes: each running request gets its next token, and the leftover budget goes to waiting prompts. Output: one batch for the GPU. The same post says chunked prefill falls out of this naturally: with a fixed budget the scheduler dynamically chooses how many tokens each request receives. A long prompt is therefore split over several steps instead of stalling everyone else's output.

A budget example uses a budget of 2,048 tokens per step, 48 running requests and a 3,000-token prompt (all illustrative). The first step gives the 48 decoders one token each and the prompt 2,000 tokens. The second finishes the last 1,000 prompt tokens beside the same 48 decoders, 1,048 tokens in all.1

Step 3: A prefix cache reuses blocks that were already computed

Many requests begin with the same text, such as a system prompt or a shared document. The prefix cache stores finished blocks under a hash of their tokens, and a new request whose first tokens match can point its block table at those blocks. The V1 post says V1, like V0, uses hash-based prefix caching and eviction based on least recently used (LRU) order, meaning the block unused for longest is dropped first.

Input: a new request's token blocks. What changes: matching blocks are shared and not recomputed. Output: less GPU work before the first new token. The idea is the engine-level cousin of caching LLM calls at the application level. This is a saving only when prompts repeat; with no repetition the lookup finds nothing and the benefit is zero.

Step 4: A lean engine loop keeps the GPU fed

Between two GPU steps the engine runs CPU work: updating request states, building inputs and returning tokens. The V1 post (January 2025) says this CPU work is part of vLLM's core loop and is especially visible with smaller models such as Llama-8B on NVIDIA H100 GPUs, where a GPU step can take as little as about 5 milliseconds. It reports up to 1.7 times higher throughput than V0 (without multi-step scheduling) from the re-architecture, per the same post. That figure is from the January 2025 alpha announcement and this page was last checked in October 2026, so check the current vLLM documentation for the present state of V1 before relying on it.

The engine loop drives each step. Input: the scheduler's decision. What changes: tokenization, detokenization and streaming run in a separate process, so they overlap with the engine core's loop instead of stalling the GPU, as the V1 post describes. Output: tokens streamed to the client. The engine also exposes an application programming interface (API) server compatible with the OpenAI interface.

vLLM combines a block pool, a scheduler, a prefix cache and an engine loopFour boxes added step by step: a block pool holds the KV cache, a scheduler shares a token budget and fills it, a prefix cache reuses blocks by hash, and an engine loop drives every step.Block poolKV cacheblocksSchedulertoken budgetPrefix cachehash of tokensEngine loopdrives eachstepGPUruns each stepDiagram: Interview Clozo, CC BY 4.0 ·interview.clozo.ai/blog/how-vllm-works.html

vLLM is four parts working together: a block pool, a token-budget scheduler, a prefix cache and a lean engine loop.CC BY 4.0 — source: How does vLLM work, and why is it fast?
Step-by-step description
  1. The KV cache lives in small blocks.
  2. A token budget is shared per step.
  3. Blocks are reused by hash.
  4. A lean loop keeps the GPU fed.
  • The KV cache lives in small blocks in a shared pool.
  • The scheduler shares a token budget across requests at every step.
  • A prefix cache reuses blocks by hash.
  • The engine loop drives each step.

Worked numbers: what paging buys on one GPU

All figures here are illustrative inputs and exact arithmetic.1 Take a model with 32 layers, 8 KV heads, a head size of 128 and 16-bit numbers (illustrative). Each token then needs 2 × 32 × 8 × 128 × 2 = 131,072 bytes, or 128 KiB of cache.1 On an 80 GiB GPU (illustrative) with 90% usable and 16 GiB of weights (illustrative), the cache pool is 56 GiB.1

If the engine reserves room for 8,192 tokens per request, each request takes 1 GiB and 56 requests fit. If real requests hold 1,000 tokens, paging with a block size of 16 (illustrative) uses 63 blocks, 1,008 token slots, so 8 slots are wasted, and 455 requests fit, about 8.12 times as many.1 The worst waste per request is 15 slots, under 2 MiB.1

Paging turns 87.8% waste per request into at most 15 token slots, which raises the illustrative capacity from 56 to 455 requests.
QuantityValue (illustrative setup)
Cache per token131,072 bytes
Cache pool56 GiB
Reserve 8,192 tokens, requests that fit56
Paged blocks, requests that fit (1,000 tokens each)455
Token slots wasted per request, reservation7,192 (87.8%)
Token slots wasted per request, paged8 (at most 15)
Paged blocks fit several times more requests than reserving full lengthBar chart for an illustrative 56 GiB cache pool and requests of 1,000 tokens: reserving room for 8,192 tokens fits 56 requests, while paged blocks of 16 tokens fit 455.Requests that fit0250500Reserve maxPaged blocksAllocation method56455Diagram: Interview Clozo, CC BY 4.0 ·interview.clozo.ai/blog/how-vllm-works.html
Allocating cache in small blocks instead of reserving the maximum length fits several times more requests in the same memory.CC BY 4.0 — source: How does vLLM work, and why is it fast?
Text description of the diagram
  • Reserving 8,192 tokens fits 56 requests in the illustrative pool.
  • Paged blocks fit 455 requests in the illustrative pool.

A bigger batch matters because the paper reports a 2 to 4 times throughput gain over FasterTransformer and Orca at the same level of latency (Kwon et al., 2023).

Knowing it is half the job. Saying it is the other half.

Interview Clozo is an AI interview copilot for real interview rounds: it hears the question and puts a strong answer on your screen, and you say it in your own words. See the features or how it works.

Start Free Trial →

The Staff-level answer

Interviewer asks

How does vLLM work, and why is it fast?

A strong answer

vLLM is a serving engine whose speed comes from memory management and scheduling. It stores each request's KV cache in small fixed-size blocks tracked by a block table, like paging, so almost no memory is wasted and more requests fit in a batch. A scheduler gives every request tokens each step from a fixed token budget, which also allows chunked prefill. A prefix cache reuses blocks for shared prompts. The trade-off is that gains shrink if prompts are short or the CPU loop is slow.

What makes it Staff-level is that it names the scheduler and a limit, not only PagedAttention. Say it in this order: the memory problem, the block fix, the scheduler, the prefix cache, then one limit.

The rubric

A strong answer explains the memory problem and the block fix, and a Staff answer adds the scheduler and the limits.
DimensionWeak answerStrong answerStaff answer
Correctness"vLLM is a faster library"Paged KV cache cuts memory wasteAlso covers the scheduler and prefix cache
DepthNames PagedAttention onlyExplains blocks and a block tableDerives cache size per token and capacity
Trade-offsNoneGains depend on workloadNames CPU overhead and prefix hit rate
CommunicationJargon without definitionsDefines KV cache and batchGives one number and what it means

Three variants of this question

How does the vLLM scheduler work?

At every step the scheduler shares a token budget across running and waiting requests. In V1 it records the result as a map from request id to token count and does not distinguish prefill from decode, which is how chunked prefill is expressed.

Does vLLM make the attention math itself faster?

The paper's focus is memory: PagedAttention manages the KV cache in blocks, which cuts waste and allows bigger batches. The speed-up is mostly from batching more requests, not from cheaper arithmetic per token.

What if many requests share a long prompt prefix?

The prefix cache lets later requests reuse blocks already computed, so the shared text is processed once. It matches blocks by hash of their tokens and evicts the least recently used first.

Common mistakes

  • "vLLM is just PagedAttention." (wrong) The V1 post describes a scheduler, a prefix cache and an engine loop as well. (right) "PagedAttention is the memory layer; the scheduler and prefix cache sit on top."
  • "vLLM schedules prefill and decode separately." (wrong) V1 treats prompt and output tokens uniformly under a token budget. (right) "Each step splits a token budget across requests."
  • "PagedAttention makes the attention computation cheaper." (wrong) Its purpose is to reduce KV-cache waste so batches grow. (right) "It saves memory, and memory buys batch size."
  • "It is always limited by the GPU." (wrong) With small models, CPU work between steps can matter. (right) "I would check CPU overhead before blaming the GPU."

Follow-up questions

How does vLLM work with PagedAttention?

PagedAttention is the attention algorithm that reads a request's keys and values from non-adjacent blocks found through its block table. vLLM is the full serving system around it; see paged attention.

Why is vLLM's throughput gain larger for long sequences?

Long sequences have large, variable KV caches, so reserving or fragmenting memory wastes more. The paper reports that the improvement is more pronounced with longer sequences, larger models and more complex decoding algorithms. Complex decoding gains more because parallel sampling and beam search, which produce several outputs from one prompt, share the prompt's blocks through copy-on-write (paper §4.4), so one copy of the prompt cache serves all of them.

What happens when the KV cache runs out of blocks?

The scheduler preempts a request. Kwon et al. (2023), §4.5 describe evicting all of one sequence's blocks together and later restoring them either by swapping them to CPU memory or by recomputing them. Which of the two a given vLLM version uses is a configuration and version detail, so check the current vLLM documentation.

Why can a small model be limited by the CPU?

A small model finishes a GPU step quickly, so the CPU's bookkeeping between steps takes a larger share of each cycle. The V1 post (January 2025) reports GPU execution time as low as about 5 milliseconds for Llama-8B on NVIDIA H100 GPUs; see GPU fundamentals.

Is vLLM also an API server?

Yes. The V1 post describes it as a continuous batching engine and an OpenAI-compatible API server. For the wider picture see what an inference engine does.

How does this relate to speculative decoding?

Speculative decoding uses a cheap draft of several tokens that the big model verifies in one step; the V1 post says its scheduler can express it with the same token map. The speculative decoding page explains the method.

Key takeaways
  • vLLM stores the KV cache in small blocks tracked by a block table, so little memory is wasted.
  • More free cache memory means more requests per batch, which is the source of its throughput gain.
  • The scheduler shares a token budget across requests each step, with no separate prefill and decode phases.
  • A hash-based prefix cache reuses blocks for repeated prompt starts.
  • For small models the CPU loop between GPU steps can be the bottleneck.

Sources

  1. Efficient Memory Management for Large Language Model Serving with PagedAttention (arXiv 2309.06180) — arXiv (Kwon et al.), 12 Sep 2023
  2. vLLM V1: A Major Upgrade to vLLM's Core Architecture — vLLM Team, 27 Jan 2025