TECHNOLOGY

LMCache CPU offload: size a reusable KV working set

In this article
THE QUICK TAKE

Plan CPU memory for reusable KV blocks, distinguish cache offload from weight offload, and test transfer pressure alongside the inference workload.

CPU offloading of a KV cache stores previously computed attention state outside GPU memory. It does not mean running model layers on the CPU, and it does not automatically reduce the GPU memory occupied by weights. The practical question is whether retaining reusable context in host memory saves enough computation to justify its movement and its working set.

Separate three memory budgets

List model weights, active-request state and reusable cached blocks separately. A server can have spare system RAM while its active decoding workload still exhausts GPU capacity. Conversely, a large offload allocation can crowd out the operating system or the inference process without helping unique prompts.

The LMCache MP overview describes a cache process with its own memory tiers. Treat that allocation as a real resident workload. Include tokenizer processes, request buffers and storage clients when assessing the host, rather than assigning every apparently free byte to the cache.

Estimate the useful working set

Collect how many distinct document or instruction prefixes return during the intended reuse window. Estimate stored KV bytes using the actual model, precision, number of cached tokens and rank layout. Total model parameter count alone cannot determine this footprint.

For an internal document assistant, separate frequently reopened reference material from one-off uploads. A bounded hot set may deserve RAM; a scan through many never-revisited documents may only displace useful blocks. Report this distinction before choosing an allocation or advertising a cache hit ratio.

Check the transfer path explicitly

The current LMCache MP quickstart distinguishes integration modes, including a CPU shared-memory path. Configuration names, ownership and compatible releases matter. An older in-process example is not a reliable configuration template for every newer multiprocess setup.

Trace the actual route from host blocks to the worker. Measure transfer latency while the model is also decoding. A cache-only copy test misses contention from other GPU transfers, CPU scheduling and concurrent workers. Record locality and sharing boundaries when several GPUs use the same host.

Compare against a cache-free baseline

The official vLLM production-stack tutorial provides one concrete offloading integration. Use it as a documented example, then verify the selected versions instead of assuming every tutorial option survives unchanged in another release.

Replay identical request schedules with offload disabled and enabled. Include cold starts, repeated prompts, cache churn and a restart. Count completed answers, first-token latency and host memory growth. A shorter repeated prefill can be offset by longer queues or by waiting for a cache block to load.

Bound retention and failure behavior

Decide how the cache behaves when the host budget fills, a worker exits or a load cannot complete. The service needs a defined miss path that recomputes context. Exposing cache failure as a permanently broken request is an avoidable coupling.

Finally, align retention and sharing with the inference service’s data policy. RAM storage is not the same thing as a promise of no data handling. Record who can reuse blocks, what ends their lifetime and which optional disk tiers are disabled when persistent storage is prohibited.

Pinned GPU host memory: setting a page-locked buffer budget, KV cache and GPU economics: accounting for active-request memory.

← All articles