TECHNOLOGY

vLLM graph profiling: size temporary KV blocks by sequences

In this article
THE QUICK TAKE

This corrects temporary startup sizing; persistent cache capacity and whole-process memory need separate measurements.

The change applies during graph-memory profiling

A merged vLLM change reduces the minimal temporary KV-cache allocation used when estimating CUDA graph memory. The earlier expression derived the block count from the maximum capture size alone. The replacement takes the smaller of that value and the maximum number of requests, retaining a fallback of 1. The review explains the reason: this temporary setup needs a block per sequence.

That distinction matters because a graph’s captured token count need not equal the number of independent sequences. They can coincide for a simple decode shape, making the old expression appear reasonable, while a larger captured token shape can reserve more temporary blocks than the profiling workload needs. The patch corrects this sizing assumption; it does not change the model’s mathematical cache requirements.

Follow the temporary configuration lifecycle

The pinned implementation first obtains the cache specifications and groups. It saves the existing block override, temporarily supplies the smaller count while building a minimal cache configuration, restores the saved override and initialises the cache for profiling. The surrounding code also contains explicit cleanup for profiling cache state.

This lifecycle is evidence that the change concerns startup preparation. It must not be described as a general reduction in every live request’s cache, a change in attention precision or a compressed cache format. The RAM and VRAM guide explains why reducing one temporary allocation is different from reducing persistent weights or per-token state.

Smaller reservations do not imply a fixed VRAM percentage

The actual byte difference depends on the model’s cache specifications, groups and block size, as well as the relation between request and capture limits. If the request limit already exceeds the capture size, taking the minimum leaves that part of the expression unchanged. The fallback also preserves a nonzero minimal configuration instead of treating an absent capture size as a useful zero-memory model.

The inspected patch does not include a broad before-and-after GPU memory table. It therefore cannot establish a universal percentage saving, eliminate every startup out-of-memory failure or quantify increased production concurrency. Weights, graph pools, workspaces and other startup allocations remain separate consumers. A successful initialisation after an update is useful evidence but does not isolate this patch when many other changes were installed simultaneously.

Verify the installed path and the relevant peak

For a reproducible comparison, retain the exact vLLM revisions, model, cache settings, request limit, capture shapes and GPU. Observe startup memory separately from steady serving memory. Keep graph capture enabled in both compared configurations when evaluating this specific path; disabling it would change the experiment rather than measure the sizing correction.

The stack reproducibility guide helps distinguish a merged upstream change from an installed binary containing it. The practical contribution is a precise temporary-cache correction supported by the actual function and review. Any claim about whole-process memory, supported context length or useful serving capacity requires a matched workload measurement beyond the existence of the merged change.

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles