Skip to content

vllm

Inference interview questions tagged vllm, across every topic.

26 questions · 9 unlocked for you

Concepts behind "vllm"

Concept pages for the mechanisms these questions lean on.

Foundational
⚙️ Serving Engines
The vLLM V1 Engine ArchitecturevLLM's V1 engine splits serving into an API-server process, an EngineCore process that owns the scheduler and the KV cache manager, and one worker per GPU. This page maps each component to its data structures in v0.31.0, works out the KV block pool for an 8B model on an H100, and explains why the split exists: Python overhead has to hide under a 4.8 ms decode step.
Advanced
🧮 KV Cache & Memory🔒 Premium
Paged KV Memory and Block TablesPaged KV memory splits the cache into fixed-size blocks and gives each sequence a block table that maps logical positions to physical blocks, as virtual memory does with pages. It bounds waste to one partial block per sequence, which decides how many sequences fit and makes prefix sharing and copy-on-write possible.
Advanced
🧮 KV Cache & Memory🔒 Premium
Prefix Caching and Chained Block HashesAutomatic prefix caching keeps the KV blocks of finished requests and reuses them when a new prompt starts with the same tokens. Each full block is keyed by a hash chained from its parent block, which makes a hit mean the whole prefix matched; that decides TTFT for shared system prompts and how much cache multi-turn traffic needs.
Advanced
⏱️ Batching & Scheduling🔒 Premium
Preemption: Swap Versus RecomputeWhen the KV pool runs out mid-decode, the scheduler must evict a running sequence: either swap its cache to host memory over PCIe and copy it back later, or free it and recompute it with a fresh prefill. The cost of each depends on model size, KV bytes per token and whether prefix caching still holds the freed blocks.
Advanced
🟩 GPU Performance🔒 Premium
CUDA Graphs and Launch Overhead in DecodeA decode step is hundreds of small kernels, and once tensor parallelism or a small model shrinks the GPU time per step, the CPU cost of launching them becomes the step time. CUDA graphs record the whole step once and replay it with one launch, which is why every serving engine captures decode graphs per batch-size bucket.
Advanced
⚙️ Serving Engines🔒 Premium
Serving Engine Knobs and Their DefaultsA handful of engine settings decide how much KV fits, how long a step can get and how many requests run at once. This page lists the defaults in vLLM v0.31.0 and SGLang v0.5.21 as read from source, shows which knob binds first for Llama 3.3 70B on four H100s, and gives the order in which to tune them.