When CPU memory is worth adding to the vLLM KV cache
GPU memory sets a hard ceiling on how many sessions and how much context vLLM can keep in its KV cache at once. When concurrent conversations or long prompts push past that ceiling, requests wait or get preempted, and CPU offloading is one way to extend the cache using host memory. The vLLM engine arguments expose this through --kv-offloading-size, which sets the amount of CPU memory to use for offloaded KV blocks, and --kv-offloading-backend, which selects native or lmcache. The backend defaults to native, and offloading only activates when a size is set, so a server started without --kv-offloading-size runs with no offloading at all. With tensor parallelism above 1, the size you set is the total across ranks, so check the per-rank share before you size host memory.
Treat offloading as a trade-off to measure, not a setting to switch on. Moving KV blocks between GPU and CPU costs transfer time, and that cost lands on the requests that need an offloaded prefix. The benefit appears mainly in long multi-turn workloads where the same conversation prefixes return after a pause and would otherwise be recomputed. Before enabling it, confirm your workload actually reuses prefixes, record baseline time to first token, inter-token latency and preemption behavior with vllm bench serve, and then repeat the run with a chosen size. Confirm on the vLLM engine arguments page that the backend and size options match your installed release, since flags change between releases.
Plan for the host side as well as the GPU side. The CPU memory you reserve for offloading is capacity the operating system and other processes cannot use, so confirm the node has headroom and that memory limits in your container or Kubernetes spec leave room for it. Cost also follows the sizing decision: offloading adds no vLLM license fee, but a node with more host RAM or a larger GPU tier is paid for through your infrastructure. If the benchmark shows little gain, the cheaper path is usually to tune memory use and batching first. Record the chosen size, backend and benchmark results in your change record so the decision can be reviewed at upgrade time.
Native offloading versus LMCache: choosing the backend
The native backend is selected with --kv-offloading-backend native, which is the default. It only activates when --kv-offloading-size is set, and with tensor parallelism above 1 that size is the total across ranks. Because it is part of the vLLM server itself, there is no second service to deploy, monitor or upgrade alongside the engine. The offloaded cache lives in the same process tree that serves requests, so capacity planning starts from the host memory available to that server.
- Single component: the offload path ships with the vLLM server, so the engine version sets the behavior you test.
- Size is a total: confirm how
--kv-offloading-sizemaps to per-rank memory in your tensor parallel layout. - Host memory budget: confirm the node keeps enough RAM for the OS, other processes and the engine after the offload size is applied.
- Feature coverage: confirm which models, precisions and parallel layouts the native path supports in your chosen release.
- Ownership: your platform team owns upgrades and tuning, because the offload behavior changes with the engine.
Check the engine arguments reference for your target release before you fix the flag values.
The lmcache option selects LMCache as the offloading backend. The vLLM production-stack uses LMCache for KV cache offloading, which is the multi-process arrangement most teams will see in Kubernetes deployments. In this setup the cache layer runs as its own component next to the engine, so it has its own resource requests, configuration, logs and upgrade cycle. That separation can help with sharing and lifecycle management, but it adds moving parts to the serving path.
- Separate process: LMCache runs outside the engine process, so it needs its own sizing, probes and monitoring.
- Production-stack context: confirm the LMCache version the production-stack release pins, rather than assuming the latest.
- Compatibility matrix: confirm which vLLM versions, models and parallel layouts your LMCache version supports.
- Network path: confirm the latency and bandwidth between the engine and the cache layer on your nodes.
- Ownership: a separate owner for the cache layer is needed, because its upgrades can be decoupled from vLLM's two-week release cadence.
Ask the production-stack maintainers or your deployment vendor to document the tested version pairs for your environment.
The decision depends on how much operational surface you want to own and how your workload reuses cache. A single node serving one model with a clear host memory budget often has fewer moving parts with the native path. A Kubernetes platform already running the production-stack may already operate LMCache, so the marginal cost of adopting it is smaller. Neither choice is universally better, and the facts supplied for this page do not establish throughput or latency differences between them, so measure both on your own workload.
- Deployment model: single-server installs and production-stack clusters point to different defaults.
- Existing platform: an LMCache deployment you already run changes the operational cost of choosing it.
- Upgrade coupling: the native path moves with vLLM releases, while LMCache upgrades follow their own schedule.
- Measurement: run the same benchmark against both backends with identical models, precision and concurrency.
- Support path: confirm who you call when cache behavior fails, the vLLM project, the LMCache project or your partner.
Write the chosen backend, its version pair and its owner into your runbook before go-live.
Before you commit to either backend, confirm a short list of facts in writing with the vendor, the project documentation or your own test environment. Engine flags, supported features and version pairs change between releases, and the vLLM project ships new minor releases about every two weeks. A confirmed configuration should name the exact vLLM release, the backend, the offload size, the parallel layout and the hardware used. Record which owner signs off on each item.
- Release pin: the exact vLLM version and, for LMCache, the exact cache version.
- Feature support: the models, quantization modes and parallel layouts each backend supports in that pin.
- Memory layout: host memory per node and how the offload size is split across ranks.
- Failure behavior: what happens to requests when the cache layer is unavailable, and how the server recovers.
- Observability: which metrics expose KV cache use and offload activity, using the vLLM metrics endpoint.
If any item is unclear, treat it as an open question for the test plan rather than an assumed capability.
Offloading options and when each fits
This table compares the two KV cache offloading paths on vLLM and the production-stack, with the conditions under which each fits. Read each row as a decision point: the default native backend is the starting place, while LMCache fits when you need its shared or multi-process behavior. Confirm the backend and size settings against your own vLLM version before you commit.
| Option | When it fits | What to confirm before choosing |
|---|---|---|
| Native backend (default) | One vLLM server where spilling cold KV blocks to CPU memory is enough to keep multi-turn sessions from being recomputed | Backend is native by default; check the engine arguments page for your release |
| --kv-offloading-size | Sets the CPU memory pool for offloaded KV, and nothing activates without it | Size is required to enable offloading; plan host RAM headroom for the OS and other processes |
| Tensor parallel size above 1 | Model spans several GPUs and you want one pool shared across ranks | The size you set is the total across ranks, so divide it per GPU when estimating |
| --kv-offloading-backend lmcache | You want LMCache as the offloading engine inside vLLM rather than the native path | Confirm LMCache version compatibility with your vLLM release and the features your workload needs |
| Production-stack with LMCache | Multiple vLLM replicas need cache reuse across instances or a Kubernetes-managed cache layer | Check the production-stack docs for the LMCache setup, storage tiers and cache sharing behavior |
| Long multi-turn chat or repeated long prompts | Conversations reuse large prefixes that would otherwise be recomputed after GPU eviction | Measure TTFT with and without offloading on your own traffic before relying on the gain |
| Short single-turn or low-concurrency traffic | Requests rarely reuse prefixes, so CPU transfer overhead may outweigh the benefit | Benchmark first; offloading adds host memory and transfer cost without guaranteed gain |
Which workloads offloading helps and which it does not
KV cache offloading pays off only when cached attention state is reused after it would otherwise be evicted from GPU memory. The patterns below differ in how often prefixes repeat, how long they stay idle between requests, and how much latency the user will tolerate, so each one needs a benchmark on your own traffic before you commit.
Long multi-turn chat
Each new turn resends the earlier conversation, so the cached prefix grows and can be reused across turns. If sessions go idle between messages, GPU cache entries get evicted, and offloading to CPU memory can keep them available for the next turn. Check how long sessions stay idle, how often a returning user's prefix is still cached, and whether time to first token drops on returning turns in your benchmark.
Repeated long documents
Retrieval workloads that send the same long documents or policies to many requests can reuse their KV cache if the entries survive between queries. Offloading helps when the working set of documents is larger than GPU cache but small enough to fit in host memory. Confirm the hit rate on your document set and measure time to first token for cold and warm queries separately.
Short single-turn requests
When prompts are short and do not share prefixes, there is little cached state to reuse, so offloading adds bookkeeping without a matching gain. The GPU cache often holds these requests without help. Treat offloading as unlikely to help here unless your benchmark shows a measurable change in cache reuse or time to first token.
High-concurrency batch jobs
Batch jobs that run many independent prompts favor throughput and tend to share little across requests, so the cache churns quickly. Host-memory transfers can compete with compute for bandwidth and reduce the gain. Confirm that output tokens per second improves with offloading enabled before adopting it for batch capacity.
Latency-sensitive interactive traffic
Interactive products are sensitive to time to first token, and a reload from CPU memory adds transfer time that a GPU cache hit would not. Offloading can still help if it avoids a full prefill of a long prefix, so the outcome depends on prefix length and transfer cost. Measure tail latency at your expected concurrency and compare against the same server with offloading disabled.
How GPU and CPU KV cache tiers interact on a request
The request starts at the vLLM server, which first checks the GPU KV cache for reusable blocks. Blocks that are not on the GPU can be found in the CPU offload tier, which is active only when the offloading size is set, and the backend choice decides whether the native tier or LMCache handles the transfer. When neither tier holds the prefix, the engine recomputes the prefill. Check which path each request takes and whether transfers keep up with decoding.
Request path through GPU cache, CPU offload tiers and recomputation on a miss.
Setting up offloading on a vLLM server
This sequence takes a vLLM server from its current GPU-only setup to a tested CPU offloading configuration, with each step confirming the release, memory budget and traffic behavior before the next one starts. The result is a server whose KV cache offload size, backend and host memory headroom are known and documented.
Confirm the vLLM release and engine arguments
The platform engineer records the exact vLLM version, the model, the tensor parallel size and every engine argument the server currently runs with, including any existing
--kv-offloading-backendor--kv-offloading-sizevalues. Check the release against the vLLM engine arguments reference for the version in use, because offloading options can change between releases. The step is done when a written configuration record exists that another engineer could use to reproduce the current server.Establish a GPU-only baseline
Before enabling any offloading, the team runs the server with offloading left unset and records baseline behavior under a representative load: time to first token, inter-token latency, throughput, and how often requests wait for KV cache space. The benchmark should use a multi-turn conversation set that resembles production, not a single-prompt test. The step is done when these numbers are saved with the configuration record, so any later change can be compared against them.
Set the backend and offload size
The engineer chooses
--kv-offloading-backendasnativeorlmcache, noting that the default isnativeand that the backend only activates when--kv-offloading-sizeis set. The size is entered from a host memory budget agreed with the operations team, and with tensor parallelism above 1 it is the total across all ranks, so the per-rank share must be calculated before entry. The step is done when the restart log confirms the offload backend and size the server loaded, with no startup errors.Size the CPU memory budget on the host
The infrastructure owner checks the host's total RAM, the memory already used by the operating system, other containers and the model loader, and the headroom that must remain free for spikes. The offload size must fit inside what is left after this reservation, and the team should confirm the limit with the host or Kubernetes memory limits in place. The step is done when the agreed budget, the reserved headroom and the chosen size are written down and match what the host actually reports.
Run representative multi-turn traffic
The team replays multi-turn sessions in which earlier turns are reused, because offloading mainly matters when a conversation's cached prefix would otherwise be evicted from GPU memory between turns. The same benchmark used for the baseline runs against the offloading server, with concurrency matched to the expected peak. The step is done when the results are set side by side with the baseline, showing whether latency, throughput and preemption changed, and whether the gains justify the added host memory use.
Check host memory headroom under load
While the replay runs, the operations team watches host memory use, swap activity and any out-of-memory events on the node, not only the vLLM process. Headroom should remain above the reservation set in the sizing step for the full peak period. If it does not, the offload size is reduced and the test is repeated. The step is done when a peak memory reading and the minimum free headroom are recorded from the test window.
Verify metrics at the metrics endpoint
The engineer scrapes the Prometheus-format metrics at
/metricson the API server and confirms that the KV cache usage, request counts and latency histograms show the expected pattern during the test. The team also confirms that the/metricspath is not exposed to end users, because the vLLM security guidance says it is not covered by--api-key. The step is done when dashboards or saved queries show the test window and the access restriction has been verified from outside the internal network.
Security and operational risks of CPU-side KV cache
Moving KV cache into host memory changes what the serving host holds, who else competes for its memory, and which network paths carry sensitive data. The cards below cover the risks that connect those changes, and the checks to run before enabling offloading in a shared or multi-node environment.
Host memory pressure
Offloaded KV cache is allocated from the CPU RAM of the serving host, so the offload size must leave room for everything else on that machine. Check the memory used by the operating system, container sidecars, log shippers, monitoring agents and any co-located services, and confirm that swapping or the OOM killer cannot reach the vLLM process under peak load. Measure resident memory over a full day of traffic, not a single benchmark run.
vLLM engine argumentsCache data residency on the host
Cached KV tensors are derived from user prompts and model outputs, so offloaded cache holds sensitive conversation content in host memory even though it is not written to a database. Confirm who can read the host, whether memory dumps or crash reports are collected, and whether the host is sized and hardened to the same classification as the prompts it serves. Ask your security team to treat the host as a data store in its data flow records.
LMCache as an extra component
When LMCache is the backend, it runs as a component you must deploy, configure, patch and monitor alongside vLLM, which adds its own configuration surface and failure modes. Review its network listeners, its configuration files and any remote storage it uses, and include it in your vulnerability scanning and change control. Confirm the version pairing with your vLLM release before rollout.
Multi-node traffic must be isolated
The vLLM security documentation states that communication between nodes in a multi-node deployment is insecure by default, with no authorization or encryption. Place all inter-node traffic on a dedicated, isolated network and keep it off user-facing segments. Offloaded cache that moves between nodes or to shared storage inherits this exposure, so treat that path as sensitive.
vLLM security docsMetrics endpoint is unprotected
The --api-key option does not protect /metrics, /health or the control endpoints, so a client that can reach the server can read request counts, latency and KV cache usage. Place a reverse proxy in front of the server that allowlists only the endpoints meant for users, and scrape /metrics from a monitoring network path that the proxy does not expose. Test the allowlist from outside the cluster after every configuration change.
Questions buyers ask about CPU KV cache offloading
How much does it cost to run vLLM with CPU KV cache offloading?
vLLM has no paid edition and is licensed under Apache-2.0, so the license itself costs nothing. The spend comes from three places: the host memory you add to each GPU node, the engineering time to configure and benchmark the offloading setup, and the people who operate it afterward. Host memory is usually a one-time hardware or instance decision, while operations time recurs. Figures depend on your own node specifications and workload, so ask for a quote built from a written scope and confirm host memory prices with your hardware vendor or cloud provider. DeployOpen does not publish prices.
How long does it take to set up KV cache offloading on vLLM?
The engine setting itself is small: --kv-offloading-size and --kv-offloading-backend are configured on the server, and the offloading path only activates when the size is set. The time goes into measurement. Your team needs a baseline on your real prompts, a run with offloading enabled, and a comparison of time to first token and throughput under your concurrency. No duration figure is supplied for this work, so ask any partner to give a timeline in the written scope after reviewing your workload and hardware.
What does the client need to provide before the work starts?
Expect to provide the following before any tuning begins:
- Node specifications, including GPU model, count and installed host memory per node
- The vLLM version you run or plan to run, since releases ship about every two weeks
- Representative traffic: prompt lengths, number of turns per conversation and concurrency at peak
- Access to a staging environment with the same accelerators as production
- Metrics collection, so the KV cache and latency results can be read from
/metrics
Without these, any result is a guess about your workload.
Can our own team do KV cache offloading tuning alone?
Yes, if you have engineers who can run vLLM, read its metrics and design a benchmark. vLLM is open source, so the documentation and configuration options are available without a license. The work is mostly disciplined measurement: changing one setting at a time, using traffic that resembles production and recording the results. Teams without GPU and serving experience usually take longer and may pick settings that look good in a synthetic test. A partner can take the work as a fixed-scope engagement, or your team can own it with a review at the end.
Does KV cache offloading help every workload?
No. Offloading helps when requests reuse earlier context that would otherwise be evicted from GPU memory, such as long multi-turn chat or repeated long documents. For short, single-turn requests, the GPU cache usually holds what is needed and offloading adds moving cost without a gain. Whether it helps your traffic is a measurement question, so compare runs with and without --kv-offloading-size set on the same request mix before deciding.
What risks should we plan for when offloading KV cache to CPU memory?
The main risks are host memory pressure, which can affect other processes on the node, and performance that is worse than expected when offloaded blocks move slowly under heavy load. Also check that the size is set as intended: with tensor parallelism above 1, the value is the total across ranks, not per GPU. Plan capacity for the node as a whole, monitor memory use and KV cache metrics over time, and keep a configuration that can be reverted quickly.
Should we choose the native backend or LMCache for offloading?
Start with the native backend, which is the default for --kv-offloading-backend, and move to LMCache only if your benchmark shows a need it addresses. The vLLM production-stack uses LMCache for KV cache offloading, so teams already on that stack have a reference point. Confirm current backend options and compatibility with your vLLM release in the engine arguments reference before choosing, because the set of options changes with releases.
What compliance evidence does a KV cache offloading change need?
Offloading does not change who can call the API, but it does place cached request context in host memory on the node. Record the configuration, the node memory limits, the vLLM version and the test results as change evidence, and confirm with your security team how cached data is handled under your data classification rules. DeployOpen prepares systems, controls and evidence for compliance assessments, but auditors and certification bodies issue any audit report or certification.
How to measure whether offloading pays off
Measure offloading against your own traffic before you keep it. Run the same request mix twice, once with --kv-offloading-size unset and once with it set, and compare time to first token (TTFT), output throughput and preemption on each run. Offloading adds CPU memory to the cache budget, so the useful question is whether your sessions are being evicted and recomputed often enough that the reuse outweighs the cost of moving KV blocks between GPU and CPU. Keep the model, precision, --max-model-len, --gpu-memory-utilization, parallelism and scheduler settings identical across both runs, or the comparison will measure the wrong thing.
Synthetic benchmarks can mislead in both directions. A benchmark with random, non-repeating prompts never reuses a cached prefix, so it will show little benefit from offloading even when your multi-turn chat or agent traffic would. The reverse also happens: a dataset that replays the same long conversation many times can make offloading look better than it will be once real users spread across thousands of sessions. Build the test from anonymized logs or a sample that matches your real turn counts, prompt lengths, concurrency and gaps between turns, and confirm the gap between turns with the teams who own those workloads. Confirm which offloading backend and LMCache version your build supports before you read any result as applying to production.
Use vllm bench serve for the load and the server's Prometheus endpoint at /metrics for the internals. Watch TTFT at the percentiles your users feel, output token throughput, and the preemption and KV cache usage series over the same window, so you can tell whether offloading removed recomputation or only moved the wait somewhere else. Record the exact vLLM release and configuration with each run, and repeat any run whose results change between passes. Treat the outcome as a decision input: if the gain holds on your traffic at your peak concurrency, plan the CPU memory and the operating procedure for it, and if it does not, keep the simpler configuration.
How DeployOpen scopes and delivers KV cache offloading
DeployOpen scopes vLLM KV cache offloading as a written, fixed-scope piece of work inside your infrastructure, starting from your real context lengths, concurrency and memory budget. We then build the offloading backend you choose, measure its effect on your workload, and hand over settings, evidence and runbooks your team can operate.
How we scope
- We record the workload first: prompt lengths, turn counts, concurrency and which sessions repeat their history.
- The written scope names the vLLM version, the offloading backend (native or LMCache) and the GPU and host memory involved.
- We confirm whether LMCache runs in-process or as a separate multi-process service in your environment before any build starts.
How we build
- We set --kv-offloading-size and --kv-offloading-backend on a staging cluster that matches your GPU layout and tensor parallel size.
- With tensor parallelism above 1, we size the offloading total across ranks and document the per-rank arithmetic.
- We benchmark before and after offloading on a workload that mirrors yours, and record time to first token and throughput changes.
How we hand over
- You receive the final configuration, the benchmark method, the results and the rollback steps for each setting.
- Runbooks cover how to read KV cache and offloading metrics on the /metrics endpoint and when to change the offloading size.
- Network placement, host memory limits and LMCache service dependencies are documented for your operations team to own.
How we support
- Ongoing support, upgrades and continuous testing are available as a retainer, so offloading settings can follow vLLM release changes.
- Each vLLM upgrade is retested against your workload before the offloading configuration is promoted to production.
- Support scope, response expectations and review cadence are agreed in writing alongside the original engagement.

