Pidoku
18vLLM: Model Execution and Features
On this page

vLLM: Model Execution and Features

Module 1810 lessons~7h 40m

Lessons, in order

18.a Executor, Worker, Model RunnerThe scheduler produces a plan: "these requests, this many tokens each, these blocks" (17.a). Three layers turn that plan into arithmetic: 45 min 18.b Building the BatchA textbook batch is a rectangle: batch × sequence_length, with short rows padded. vLLM's batch is not a rectangle. One step may hold a request computing a single token, another computing … 50 min 18.c Attention BackendsAttention is the one operation in the model that must understand vLLM's unusual memory layout: a flat batch of tokens from many requests (18.b), each request's context scattered across … 45 min 18.d CUDA Graphs and CompilationA decode step for a small model is thousands of tiny GPU operations, and Python needs a few microseconds to launch each one. For a large model that overhead is lost in the arithmetic; for a … 50 min 18.e Sampling and Structured OutputThe forward pass ends with one row of scores per request: a number for every vocabulary token. Choosing a token from that row is sampling, and it is where every request's own settings … 50 min 18.f Speculative DecodingDecoding is sequential: one forward pass, one token. But a forward pass can check several tokens about as cheaply as it produces one, because checking is parallel. Speculative decoding … 50 min 18.g LoRA Adapters: Many Models in OneA fine-tuned model is usually the base model plus a small correction. LoRA stores that correction as two thin matrices per layer, a few megabytes instead of many gigabytes. vLLM holds many … 40 min 18.h Multimodal InputsA vision-language model does not read pixels. An encoder turns an image into a few hundred or a few thousand vectors that look, to the language model, like token embeddings. vLLM fits this … 45 min 18.i Tool Calling and ReasoningThe OpenAI chat API returns three separate things: content, reasoning and tool_calls. A language model returns one thing: a stream of tokens. The model was trained to mark the parts itself … 40 min 18.j Quantization in vLLMA model's weights are normally stored as 16-bit numbers. Quantization stores them in 8 or 4 bits. vLLM, in the usual case, does not quantize a model itself: it loads a model that another … 45 min

About this module

What happens on the GPU side of vLLM: the executor, worker and model runner, building the batch, attention backends, CUDA graphs and torch.compile, sampling and structured output, then the features built on top: speculative decoding, LoRA adapters, multimodal inputs, tool calling and reasoning, and quantization.

Lessons#

#LessonTime
18.aExecutor, Worker, Model Runner45 min
18.bBuilding the Batch50 min
18.cAttention Backends45 min
18.dCUDA Graphs and Compilation50 min
18.eSampling and Structured Output50 min
18.fSpeculative Decoding50 min
18.gLoRA Adapters: Many Models in One40 min
18.hMultimodal Inputs45 min
18.iTool Calling and Reasoning40 min
18.jQuantization in vLLM45 min

Previous: vLLM: Scheduler and KV Cache · Next: vLLM: Scaling, Operating and Extending

↑↓ navigate↵ openesc close

100% drag to pan · scroll or pinch to zoom · double-click to zoom in