9.e owns the links and transfer libraries (GPUDirect, NIXL, LMCache, Mooncake); 19.b owns vLLM’s connector flags; 13.i places offloading among the other KV-saving techniques; 14.l covers caches shared between machines. This lesson is the tiering itself: what to move out of HBM, where to, and when fetching beats recomputing.
Before you start: words you need#
| Word | Plain meaning |
|---|---|
| Offloading | Copying KV cache blocks out of GPU memory (HBM) to a larger, cheaper tier, and copying them back when needed. |
| Tier | One level of storage: HBM, CPU memory (DRAM), local SSD (NVMe), or a remote store. Each step down is bigger, cheaper and slower. |
| Hit | A new request whose prefix is already cached somewhere, so its KV can be loaded instead of computed (12.m). |
| Recompute | Running the prefill again to rebuild KV that was thrown away. |
| Pinned memory | Host memory locked in place so the GPU’s copy engines can read and write it directly (5.d). Copies from ordinary memory are slower and may block. |
| DMA | Direct memory access: a copy done by the GPU’s copy engines, not by its compute cores, so it runs alongside kernels (9.b). |
| NVLink-C2C | The coherent chip-to-chip link between a Grace or Vera CPU and its GPUs, several times faster than PCIe. |
1. What is it?#
An engine’s KV pool lives in HBM, and HBM is small: after the weights, a GPU may have tens of GB left for cache. When the pool is full, the engine evicts blocks that no running request is using, and their contents are lost. The next request that needed them pays the full prefill again.
KV offloading keeps those blocks instead: it copies them to CPU memory, then perhaps to SSD, and copies them back on a hit. It turns the prefix cache from “what fits in HBM” into “what fits in the whole machine”.
flowchart TB
G[("GPU HBM<br/><small>running requests, hot prefixes</small>")] -->|"evict: async copy out"| C[("CPU DRAM<br/><small>warm prefixes, paused sessions</small>")]
C -->|"evict"| N[("Local or shared SSD<br/><small>cold prefixes, long sessions</small>")]
C -.->|"hit: copy back before the step"| G
N -.->|"hit: staged through CPU"| C
Q{"fetch faster than<br/>recompute?"} -->|"almost always"| F["load"]
Q -->|"tiny prefix,<br/>slow tier"| R["recompute"]
class G,C memory
class N io
class Q queue
class F memory
class R computeIn 2026 this is no longer an experiment. vLLM ships a native offloading connector (CPU since v0.11, CPU plus file, object-store and peer tiers since v0.22), LMCache and NVIDIA Dynamo’s KV Block Manager (KVBM) do the same for several engines, and DeepSeek reported that 56% of a day’s input tokens were served from its on-disk KV cache.
Facts checked on 13 November 2026.
2. Why does it exist?#
Three workloads made it necessary:
- Shared prefixes. System prompts, tool definitions, retrieved documents and few-shot examples repeat across requests. A bigger cache means more hits.
- Multi-turn and agent sessions. A conversation pauses between turns; an agent pauses while a tool runs. Without offloading, its KV is evicted during the pause and the whole history is prefilled again on the next turn. 24.h cites a study in which coding agents spent about 38% of their time regenerating KV that had been dropped during tool calls.
- Long context. A 128k-token session can take 20 GB of cache (14.i). Only a few fit in HBM at once; the rest must live somewhere.
In every case the alternative is recomputing, which costs GPU time that could have served other users, not only latency for this one.
3. Simple analogy#
A desk, a filing cabinet and an archive.
The papers you are working on are on the desk (HBM). When the desk is full you do not shred the folder you will need after lunch; you put it in the cabinet beside you (CPU memory). Files you need next month go to the archive downstairs (SSD). Fetching a folder from the cabinet takes seconds; rewriting it from memory takes hours. You only shred something when rewriting it would be quicker than walking to get it, which is almost never.
4. Tiny example: one returning conversation#
A 70B model at TP 8 with an FP8 cache. A user’s conversation has 32,000 tokens of history; they reply after five minutes, by which time HBM has been reused for other users.
without offloading prefill all 32,000 tokens again ≈ 1.8 s of the whole 8-GPU replica
with a CPU tier copy 5.2 GB back, 0.65 GB per GPU,
each over its own PCIe Gen5 link ≈ 13 msThe user’s first token arrives about 1.8 s sooner, and the replica keeps 1.8 s of compute for other requests. Section 6 does the same sum for other prefix lengths and tiers.
5. Technical explanation#
What offloading is for, and what it is not for#
- For: blocks that are not being used right now. Cached prefixes, paused sessions, and finished requests whose prefix may come back.
- Not for: the KV of sequences being decoded. Every decode step reads all of a sequence’s cache (or, with sparse attention, a selected part). Streaming 20 GB over PCIe per step would make each step hundreds of milliseconds. Active KV stays in HBM; 13.i explains why.
The one exception is research systems that keep distant tokens off the GPU and fetch only the blocks attention selects (24.c). These are emerging, not standard.
The tiers in 2026#
| Tier | Typical size per 8-GPU server | Achieved bandwidth per GPU | Notes |
|---|---|---|---|
| HBM | 0.6–2.3 TB total, much of it weights | 3–8 TB/s | Where running requests live |
| CPU DRAM over PCIe Gen5 x16 | 1–4 TB | ~50 GB/s one way (vLLM measured), ~83 GB/s both ways at once | Each GPU has its own link, so a TP group fetches in parallel |
| CPU over NVLink-C2C (Grace, Vera) | ~0.5 TB per Grace; up to 1.5 TB per Vera | Several times PCIe (900 GB/s total on Grace, 1.8 TB/s on Vera, 7.c, 7.e) | Makes the CPU tier nearly an extension of HBM |
| Local NVMe | 10–100 TB | ~3–14 GB/s per drive | Survives restarts; staged through CPU, or direct with GPUDirect Storage (3.g) |
| Shared or remote store | Unbounded | Network-limited, ~45 GB/s per 400G NIC | Shared between replicas: 14.l |
Fetch or recompute#
recompute time = prefill FLOPs / (achieved FLOP/s × GPUs)
≈ (2 × params × S + 2 × layers × S² × hidden) / ...
fetch time = KV bytes per GPU / tier bandwidth per GPUTwo things make fetching win by more than older rules of thumb suggest:
- Recompute grows faster than the KV does. The KV grows linearly with the prefix length S; the attention part of prefill grows with S². The longer the prefix, the bigger the win.
- Each GPU fetches only its own shard. With TP 8, each GPU holds one eighth of the KV and has its own PCIe link and NIC. The replica’s aggregate bandwidth is eight links, not one.
Where fetching can lose: very short prefixes on a slow tier, where the fixed cost of each lookup and I/O dominates; and transfers that land on the critical path instead of being overlapped.
How a good implementation works#
- Copy out asynchronously. When blocks are full (or evicted) they are copied to pinned host memory on a separate stream with DMA, so the forward pass never waits. vLLM found DMA beats a custom copy kernel once blocks are large (its v0.12 layout made blocks 0.5–2.5 MB) and does not steal compute cores.
- Load before the step. On a hit the scheduler allocates GPU blocks, starts the copy, and schedules the request when the data is there; other requests run meanwhile (19.b covers vLLM’s waiting state).
- Store each block once. Blocks are named by the hash of their tokens (12.m), so identical prefixes share one copy in every tier.
- Evict by value, not only by age. LRU (least recently used) is the default; ARC-style policies and time-to-live for paused agent sessions keep likely-to-return blocks longer (24.c, 24.h).
- Handle hybrid models. Sliding-window layers need only their window, and linear-attention layers have a fixed state rather than per-token KV; current offloaders handle both (14.i).
What ships#
- vLLM:
--kv-offloading-size <GiB>turns on the native CPU tier; theOffloadingConnectorwithTieringOffloadingSpecadds file-system, S3-compatible object-store and peer tiers behind the CPU tier. On preemption vLLM V1 always recomputes, but blocks already offloaded are loaded back instead (17.c). Flags and options: 19.b. - LMCache: a KV management layer for vLLM and SGLang across CPU, disk, Redis/Valkey, S3 and Mooncake (9.e).
- SGLang: HiCache, a hierarchical radix cache across GPU, host memory and storage back-ends.
- NVIDIA Dynamo KVBM: offloads across GPU, CPU, SSD and remote storage for its back-ends (21.j).
- Hardware: NVIDIA’s Inference Context Memory Storage platform (announced at CES 2026) is an Ethernet-attached flash tier managed by BlueField-4 DPUs, positioned between local and shared storage for agent context (vendor positioning; 14.l).
6. Under the hood: fetch or recompute, by tier#
The program compares recomputing a cached prefix on a TP 8 replica of a 70B dense model with loading it from each tier. Bandwidths are achieved per-GPU values (PCIe from vLLM’s measurements, the others assumed and labelled in the code).
// kvtiers.go — fetch a cached prefix from a tier, or recompute it?
package main
import "fmt"
func main() {
// 70B dense model, 80 layers, hidden size 8192, GQA-8, head dim 128, FP8 KV cache.
const params, layers, hidden = 70e9, 80.0, 8192.0
const kvPerToken = 2 * 80 * 8 * 128 * 1.0 // bytes: K and V, all layers
const gpus = 8.0 // TP=8: each GPU holds 1/8 of the KV
const achieved = 400e12 // FLOP/s per GPU actually sustained in prefill (assumed)
// Achieved one-direction bandwidth PER GPU. Each GPU fetches its own shard over its own path.
tiers := []struct {
name string
bw float64 // bytes/s per GPU
}{
{"CPU/PCIe5", 50e9}, // measured by vLLM's offloading benchmarks
{"CPU/C2C", 300e9}, // Grace-class NVLink-C2C (assumed achieved share)
{"NVMe", 12e9}, // 8 Gen5 drives (~100 GB/s) shared by 8 GPUs
{"RDMA-store", 45e9}, // one 400G NIC per GPU, remote store
}
fmt.Printf("%-8s %8s %10s", "prefix", "KV", "recompute")
for _, t := range tiers {
fmt.Printf(" %13s", t.name)
}
fmt.Println()
for _, s := range []float64{1e3, 8e3, 32e3, 128e3} {
// Prefill FLOPs: 2 x params per token, plus causal attention ~2 x layers x S^2 x hidden.
flops := 2*params*s + 2*layers*s*s*hidden
recompute := flops / (achieved * gpus)
kv := s * kvPerToken
fmt.Printf("%-8s %6.1fGB %8.0fms", fmt.Sprintf("%.0fk", s/1e3), kv/1e9, recompute*1e3)
for _, t := range tiers {
fetch := kv / gpus / t.bw
fmt.Printf(" %6.1fms %4.0fx", fetch*1e3, recompute/fetch)
}
fmt.Println()
}
}Output:
prefix KV recompute CPU/PCIe5 CPU/C2C NVMe RDMA-store
1k 0.2GB 44ms 0.4ms 108x 0.1ms 647x 1.7ms 26x 0.5ms 97x
8k 1.3GB 376ms 3.3ms 115x 0.5ms 689x 13.7ms 28x 3.6ms 103x
32k 5.2GB 1819ms 13.1ms 139x 2.2ms 833x 54.6ms 33x 14.6ms 125x
128k 21.0GB 12311ms 52.4ms 235x 8.7ms 1409x 218.5ms 56x 58.3ms 211xHow to read it:
- Every tier beats recomputing, by 26x to over 1,000x, once each GPU fetches its own shard in parallel. Even SSD wins comfortably at these sizes.
- The win grows with length because recompute has an S² term and the KV does not.
- These are best cases. They ignore per-I/O latency, lookup time, contention with other traffic on the same links, and the cost of staging SSD reads through CPU memory. With one shared link instead of eight, divide the speed-ups by eight; small blocks on SSD can be dominated by per-request overhead. Measure your engine’s real load bandwidth.
- The real limit is usually capacity and hit rate, not speed. A tier only helps if the block is still there when it is needed.
7. Performance implications#
- TTFT on hits drops from a full prefill to a copy: vLLM reported 2x to 22x lower TTFT for Llama-3.1-8B on H100 depending on prompt size (project’s own benchmark).
- Throughput is often the bigger gain: the GPU no longer spends compute rebuilding KV. vLLM reported up to 9x higher throughput at high CPU hit rates, and its September 2026 tiered benchmark (Qwen3.6-35B-A3B on 2 H100s, multi-turn) showed throughput falling sharply without offload once conversations no longer fit in HBM, with the SSD tier more than doubling it beyond that point (project’s own benchmarks).
- Misses cost almost nothing when copy-out is asynchronous.
- Host resources are not free. Pinned memory is taken from the OS, copies use PCIe bandwidth that the NIC may also need, and SSD tiers wear drives with writes.
8. Production implications#
- Measure first: prefix-cache hit rate and eviction rate (17.f). If the pool is never full, offloading adds nothing.
- Start with a CPU tier. One flag in vLLM; size it from host memory left after the OS and other processes, remembering it is pinned.
- Add an SSD or shared tier for multi-turn chat and agents, where sessions return after minutes or hours.
- Route sessions back to their cache (21.h). A CPU tier on replica A does not help a turn routed to replica B; that needs a shared store (14.l).
- Check NUMA and PCIe placement: pinned buffers on the wrong socket halve copy bandwidth (3.c).
- Treat offloaded KV as user data. It contains the content of prompts. Encrypt SSD and shared tiers, and keep tenants’ caches apart (23.i).
9. Common mistakes#
- Offloading the KV of running sequences and expecting decode to keep its speed.
- Assuming SSD is “slower than recomputing”. With per-GPU parallel paths and long prefixes it is usually much faster. Measure rather than assume.
- Using pageable instead of pinned host memory. Copies become slower and synchronous.
- Turning it on without measuring hit rate. A tier that is never hit just costs memory.
- Forgetting the router. A cache that requests are not routed back to is wasted.
- Ignoring hybrid layers. An offloader that does not understand sliding-window or linear- attention layers may disable the engine’s hybrid cache manager or store far more than needed.
- Leaving cached KV unencrypted on shared storage.
10. Hands-on exercise#
- Run
kvtiers.go. Changegpusto 1 and the bandwidths to one shared link. At what prefix length does NVMe stop winning? - Add a DeepSeek-style MLA model whose KV is about 70 KB per token in BF16 and is replicated, not split, across TP ranks (14.l). How does replication change the fetch times?
- Serve a model with vLLM, once without and once with
--kv-offloading-size. Replay a multi-turn benchmark with more conversations than fit in HBM. Plot TTFT and throughput against the number of conversations. - Measure host-to-device copy bandwidth with pinned and pageable buffers of 32 KB and 2 MB
(
cudaMemcpyAsyncortorch.Tensor.to(non_blocking=True)). What does block size do? - An agent’s 60k-token session pauses for 40 s while a tool runs. HBM is needed by other users in the meantime. Compare keeping it in HBM, offloading to CPU, and recomputing, in GPU-seconds.
11. Interview questions#
- What is KV offloading for, and why not for active sequences?
- Derive when fetching a prefix beats recomputing it. Why does the answer improve with length?
- Why does tensor parallelism make fetching faster?
- What does NVLink-C2C change about the CPU tier?
- How would you size a CPU tier and decide whether to add an SSD tier?
- Why is offloading often a throughput optimisation more than a latency one?
- What breaks if offloading is on but routing ignores where caches live?
12. Further reading#
Checked on 13 November 2026.
- [ESTABLISHED] vLLM — Inside the KV offloading connector (January 2026) — DMA vs kernel copies, block sizes, benchmarks
- [ESTABLISHED] vLLM — Tiered KV cache offloading (September 2026) — file, object and peer tiers, hybrid models
- [REFERENCE] vLLM KV offloading usage guide
- [ESTABLISHED] LMCache documentation
- [ESTABLISHED] Qin et al., “Mooncake: A KVCache-centric Disaggregated Architecture for LLM Serving” (FAST 2025)
- [EMERGING] NVIDIA — BlueField-4 and Inference Context Memory Storage (January 2026) — vendor announcement
- [ESTABLISHED] Sheng et al., “FlexGen” (ICML 2023) — offloading for throughput on one GPU