KV cache offloading copies the key and value blocks of finished prompts from GPU memory to CPU RAM, disk or a shared store, and loads them back when a later request reuses the prefix, so the GPU skips that prefill. It pays off when prompts repeat long prefixes, as in multi-turn chat, agents and RAG over a fixed document set, and it buys nothing when every prompt is unique. On Nodus you can serve vLLM with offloading turned on from a Job on an NVIDIA H100 SXM, listed at $2.600/hr on the Nodus pricing page, and size the CPU tier from the host memory that nodus get gpus reports for each machine.
For what the KV cache is, its per-token formula and the other ways to shrink it, start with our KV cache explainer.
How does KV cache offloading work in vLLM?
vLLM offloads through its OffloadingConnector, which extends the prefix cache into slower but larger memory. The vLLM KV offloading guide describes the flow: completed KV blocks are copied to pinned host memory as they are produced, and a hit in that tier is promoted back to the GPU on demand. The copies use DMA (cudaMemcpyAsync) and run alongside model computation.
By default only prompt blocks are offloaded (offload_prompt_only is true), and decode blocks are skipped. That tells you what the feature is for. It saves prefill work on prompts you will see again. It does not add room for more tokens to decode at the same time, because a request still needs its KV on the GPU while it generates.
Beyond the single CPU tier, a tiering spec adds secondary tiers behind it. The vLLM v0.34.0 docs list three types: a filesystem directory (fs), an S3-compatible object store (obj) and peer-to-peer transfer between vLLM instances over RDMA (p2p). Every secondary tier is staged through the CPU tier, since only CPU memory has direct GPU access in that design.
How is offloading different from swapping on preemption?
Offloading keeps a copy of reusable work; preemption throws work away under memory pressure. When the GPU KV pool cannot hold every running request, vLLM preempts some of them. The vLLM optimization guide says that in vLLM V1 the default preemption mode is recompute rather than swap, "as recomputation has lower overhead in the V1 architecture."
So a preempted request today reruns its prefill when space returns. Offloading has a different trigger: it stores blocks from finished prompts so the next request with that prefix can load them.
If your problem is frequent preemption, the fixes are more GPU memory for the cache, fewer concurrent sequences or more tensor parallelism. If your problem is paying for the same prefill over and over, offloading is the tool.
How do you turn on KV cache offloading in vLLM?
The short form is two engine arguments. Per the vLLM engine arguments reference, --kv-offloading-size sets the CPU buffer in GiB, summed across tensor-parallel ranks, and offloading stays off until you set it. --kv-offloading-backend picks native (the default, vLLM's own CPU offloading) or lmcache.
vllm serve meta-llama/Llama-3.1-8B-Instruct --kv-offloading-size 200
The long form passes the connector config directly, which exposes the tuning keys. This is the single-tier example from the vLLM guide, with a 1 GB CPU tier:
vllm serve <model> \
--kv-transfer-config '{
"kv_connector": "OffloadingConnector",
"kv_role": "kv_both",
"kv_connector_extra_config": {
"block_size": 64,
"cpu_bytes_to_use": 1000000000
}
}'
Three keys from the same guide matter in practice. store_threshold sets how many lookups a block needs before it is offloaded, which stops one-off prompts from filling the tier. eviction_policy chooses lru or arc. Per request, max_load_tokens in kv_transfer_params caps how much is loaded from offloaded storage, and 0 turns loading off for that request.
To see whether it is working, watch the Prometheus metrics that the current guide lists. vllm:kv_offload_cpu_cache_resident_perc shows how full the CPU tier is. vllm:kv_offload_cpu_chunk_evictions_total, split by whether a chunk was ever used, shows whether you are storing blocks nobody reads.
Is loading KV from CPU memory faster than recomputing it?
Yes, by roughly 8 to 28 times on an H100 in the two cases below, and the arithmetic shows why. We worked it from public numbers: model configs and weight sizes from Hugging Face, and the NVIDIA H100 SXM spec sheet.
Recomputing a token's KV means running the forward pass for that token, which costs about 2 FLOPs per parameter, the standard estimate from the scaling laws paper. Loading it means moving its KV bytes over PCIe. NVIDIA's H100 page lists PCIe Gen5 at 128 GB/s, which is 64 GB/s in each direction. It lists BF16 Tensor Core throughput as 1,979 teraFLOPS with sparsity, so 989.5 teraFLOPS dense.
Take Llama 3.1 8B: 32 layers, 8 KV heads, head dimension 128. In BF16 that is 2 x 32 x 8 x 128 x 2 = 131,072 bytes of KV per token. Its weights index lists 16,060,522,496 bytes, or 8.03 billion parameters, so recompute costs 16.06 GFLOP per token. Unsloth's mirrors are linked because Meta's repositories are gated; the fields are the same.
For one reused 8,192-token prefix:
- Load: 8,192 x 131,072 = 1,073,741,824 bytes. At 64 GB/s that takes 16.78 ms.
- Recompute: 8,192 x 16.06 GFLOP = 131.6 TFLOP. At the full 989.5 teraFLOPS that takes 132.96 ms.
Llama 3.1 70B has 80 layers with the same 8 KV heads, so 327,680 bytes per token, and its weights put recompute at 141.1 GFLOP per token. Served across 4 H100s with tensor parallelism, each GPU holds 2 of the 8 KV heads and loads a quarter of the bytes over its own PCIe link. The same 8,192-token prefix is 671,088,640 bytes per GPU, a 10.49 ms load, against 292.05 ms to recompute on 4 GPUs at peak.
| Llama 3.1, 8,192-token prefix | KV bytes per GPU | Load at 64 GB/s | Recompute at peak |
|---|---|---|---|
| 8B on 1 x H100 | 1,073,741,824 | 16.78 ms | 132.96 ms |
| 70B on 4 x H100 | 671,088,640 | 10.49 ms | 292.05 ms |

Even against recompute at 100% of peak, loading from CPU is about 8 times faster for 8B and 28 times faster for 70B.
The recompute column is a lower bound in two ways. Real prefill runs well below peak; our MFU explainer shows typical utilization. The 2-FLOPs-per-parameter estimate also leaves out attention over the context, which grows with prompt length. Real PCIe throughput is also below the spec, which is why the next section asks how much slack there is.
How fast does a slower storage tier need to be?
Divide KV bytes per token by recompute time per token, and you get the bandwidth a tier must sustain per GPU to beat recompute. For Llama 3.1 8B in BF16 that is 131,072 bytes / 16.23 microseconds = 8.08 GB/s. For Llama 3.1 70B it is 327,680 bytes / 142.6 microseconds = 2.30 GB/s, and tensor parallelism leaves the ratio unchanged because both sides split by the same factor.
An FP8 KV cache halves the bytes and so halves the threshold: 4.04 GB/s for 8B and 1.15 GB/s for 70B. These are break-evens against recompute at full peak, so a tier above them wins even before you account for real prefill efficiency.

Host RAM clears the bar with room to spare; a disk or network tier has to be measured against it.
That is a test for any secondary tier: measure its sustained read throughput per GPU under your concurrency and compare. Bigger models have more compute per byte of KV, so they tolerate slower tiers; small models need fast ones.
How many tokens fit in host RAM?
Divide the buffer by KV bytes per token. With --kv-offloading-size 200, which is 200 GiB or 214,748,364,800 bytes, the CPU tier holds 1,638,400 tokens of Llama 3.1 8B. That is 200 cached 8,192-token prefixes. For Llama 3.1 70B the same 200 GiB holds 655,360 tokens, or 80 prefixes.
Compare that with the GPU. On one 80 GB H100, Llama 3.1 8B leaves at most 80 - 16.06 = 63.94 GB for everything else, which is at most 487,823 tokens of KV before activations and vLLM's own headroom. A 200 GiB CPU tier therefore holds at least 3.36 times as many reusable tokens as the GPU pool could. In round numbers, that is 488K tokens on the GPU against 1,638K tokens in host RAM for 8B, or 655K tokens for 70B.

Host RAM is where a long tail of reusable prefixes can live without evicting active work.
Pinned memory is real memory: the vLLM guide warns that a container memory limit below it can cause an out-of-memory kill after the server reports healthy.
When should you use KV cache offloading, and when not?
Turn it on when the same long prefixes come back after the GPU prefix cache has evicted them. Our rule, built from the arithmetic above:
- Use it for multi-turn chat and agent loops, where every turn resends the history, and for RAG over a document set that gets queried repeatedly. Long system prompts and few-shot templates shared by many users are the same pattern.
- Use it when prefill dominates your cost: long inputs, short outputs. Our inference cost guide shows how much of an agent session is resent history.
- Skip it when prompts are unique, as in one-pass batch jobs over distinct documents. Every block would be stored and never read, costing pinned RAM and PCIe traffic for nothing. If traffic is mixed, set
store_thresholdso only repeated blocks are kept. - Skip it if your bottleneck is decode concurrency or preemption. Offloading stores prompt blocks for reuse; it does not let more requests generate at once.
- Check the tier against the break-even. CPU RAM over PCIe passes easily. A disk or network tier passes only if it sustains more than the break-even bandwidth per GPU for your model.
Measure before keeping it: compare time to first token with offloading on and off on a replay of real traffic.
How do you run vLLM with KV cache offloading on Nodus?
Run the official vLLM image as a Job and request more host memory than the offload buffer. The flags below come from the nodus run reference, and the vLLM flag from the engine arguments reference. We have not benchmarked this configuration, so no output is shown.
pip install nodus-compute
nodus login
nodus secret create hf-token --from-literal HF_TOKEN=hf_xxx
nodus run --name llama8b-offload --gpu H100 --image vllm/vllm-openai:v0.34.0 \
--secret hf-token --no-source --interruptible never \
--memory 256Gi --timeout 8h --max-cost 25 -d \
-- vllm serve meta-llama/Llama-3.1-8B-Instruct --kv-offloading-size 200
nodus port-forward job/llama8b-offload 8000
--memory 256Gi leaves room above the 200 GiB buffer, per vLLM's out-of-memory warning. --timeout 8h on an H100 SXM listed at $2.600/hr caps the run at $20.80, and --max-cost 25 is a hard spend cap on top. Run nodus get gpus first: its MEMORY column shows each machine's host memory, which is the ceiling for your CPU tier, as described in the GPU selection docs. Our vLLM in Docker guide covers the rest of the serving setup.
Prices checked December 6, 2026, from the Nodus pricing page.
FAQ
Should I offload KV cache to GPU memory?
The KV cache already lives in GPU memory; offloading means moving it out to CPU RAM or storage. Keep active requests on the GPU, and offload only finished prompt blocks you expect to reuse.
Does vLLM need prefix caching on for offloading to help?
Yes. The OffloadingConnector extends the prefix cache, so a request benefits only when its prefix matches stored blocks exactly. Put the stable part of the prompt first and the variable part last.
Can several vLLM replicas share one offloaded cache?
They can through a shared fs or obj tier, or p2p transfers. The vLLM guide keys stored blocks by a digest of the run configuration, including model, block size, parallelism and dtype, so replicas must match on those to find each other's blocks.
Do I need my own vLLM server to benefit from cached prefixes on Nodus?
Not for shared models. The Nodus inference API (Beta) lists a separate cached-input rate next to input and output in GET /v1/models. Run your own vLLM with offloading when you serve your own weights or need control of the cache.
Is LMCache different from vLLM's native offloading?
LMCache is a separate project that vLLM supports as an offloading backend through --kv-offloading-backend lmcache. The native backend is the default and is configured through the OffloadingConnector keys described above.
Originally published on the Nodus blog.
Top comments (1)
The arithmetic is the strongest part — 16.78 ms to load versus 132.96 ms to recompute for the 8B prefix makes the case on its own. But there is one place where the default undercuts the use case you recommend it for most.
offload_prompt_onlyis true by default, so decode blocks are skipped. In a multi-turn agent loop, the resent history is not just the original prompt — every prior turn's assistant output is decode-generated KV. Those are exactly the blocks the default leaves behind, so each turn recomputes the part of the prefix the model itself wrote. For the agent-loop workload this post pitches, how much of a typical session's resent prefix is decode-generated? If it is a third or more, flippingoffload_prompt_onlyto false looks like the bigger lever than the tier size.One measurement I would want before keeping it on: the reuse ratio from the two metrics you list — loaded chunks versus chunks evicted never-used. If fewer than 1 in 10 stored blocks ever gets reloaded, the 200 GiB of pinned RAM is mostly a warehouse for work nobody re-reads. What reuse ratio would make you keep the tier, and what would make you shrink it?