Skip to content
Inference Academy

vLLM's worker and Model Runner V2: from block IDs to a forward pass

What happens on the GPU side of vLLM at v0.34.0: the executor and workers, the startup sequence that profiles memory, sizes and allocates the KV cache and warms up the model, and Model Runner V2's step: a persistent batch, staged block-table writes, inputs prepared on the GPU, attention metadata, the forward pass and a Triton sampler. With the startup log lines that tell you what happened.

By

Key takeaways

  • The executor hides the number of GPUs: UniProcExecutor for one, MultiprocExecutor with one worker process per GPU for more.
  • Startup is: load weights, profile a worst-case step, size the KV cache from what is left, allocate it, then compile and capture CUDA graphs. With the extensible cache, the size is fixed after warm-up from memory actually free.
  • Model Runner V2 keeps each request in a fixed row of GPU state and gathers each step's inputs from those rows, instead of rebuilding tensors in Python.
  • Block tables change by small diffs each step, so they are staged on the CPU and applied on the GPU with one kernel.
  • The startup log tells you the KV cache size in tokens and the maximum concurrency at max_model_len. Read it before you tune anything.
30 min · verified 2026-112 animated diagramsPro
Share

Goal: know what the GPU side of vLLM does at startup and on every step, so you can read its startup log, reason about memory, and find where a forward pass is built and launched.

You need: a checkout of vLLM at v0.34.0. No GPU to read the code; a GPU if you want to run vllm serve and read your own startup log. Background: the KV cache manager, the host side of serving and GPU architecture.

Honest limits. The model runner at v0.34.0 is Model Runner V2 (MRV2), a rewrite of V1's runner. Its own design note (docs/design/model_runner_v2.md) says it is not yet feature-complete and still has open design decisions, so expect it to change faster than the scheduler. This lesson follows a single-GPU, decoder-only model with no pipeline parallelism.

#Executors and workers

The engine core does not talk to GPUs directly; it calls an executor (vllm/v1/executor/):

Executor When What it does
UniProcExecutor One GPU (the default when the world size is 1) Runs the worker in the engine core process
MultiprocExecutor Several GPUs on one node Starts one worker process per GPU and broadcasts each SchedulerOutput to all of them
RayExecutorV2 Several nodes, or when Ray is in use The same, with Ray actors

Each worker (vllm/v1/worker/gpu_worker.py) owns one GPU: it initialises the device and the distributed groups, loads its shard of the weights, and holds a GPUModelRunner (vllm/v1/worker/gpu/model_runner.py) that does the real work.

The rest is Pro

Keep reading the rest of this lesson

Pro unlocks the rest of this lesson, including 2 animated diagrams, every advanced lesson, the hands-on labs and completion certificates.

One year

$25

365 days, no auto-renewal

Lifetime Best value

$75

pay once, keep it forever

7-day refund, no questions asked. One payment, no auto-renewal.Compare plansHave a licence key?

Sandip MaityBuilt by Sandip Maity, who runs self-hosted LLM inference in production.

Not ready? Keep learning free

Free lessons from vLLM Internals, no sign-up. Or follow the free roadmap →

Not ready? Take the free 5-day email course

One short email a day for five days, each built on a free lesson, then the occasional new lesson or offer. Unsubscribe in one click.

Still to come in this lesson

  1. Startup: where the KV cache size comes from
  2. One step in Model Runner V2
  3. Three ideas from Model Runner V2
  4. Exercises
  5. Where to go next

You will be able to answer

  • Why does vLLM run a profiling step before it allocates the KV cache?
  • In Model Runner V2, what happens to a request's state when it is preempted?
  • Why are block-table updates staged and applied with one kernel instead of copying the whole table each step?