Please ensure Javascript is enabled for purposes of website accessibility

KV Cache: Why It Matters for LLM Inference Speed

  1. What is KV cache?
  2. Shrink It. Move It. Reuse It. Three Drivers for improving LLM inference performance
  3. KV cache is becoming an infrastructure problem
  4. 1. Shrink it: Reduce the KV cache memory footprint
  5. 2. Move it: Transfer the KV cache efficiently between prefill and decode nodes
  6. 3. Reuse it: Avoid unnecessary prefill recomputation
  7. Three drivers, three different bottlenecks
  8. Frequently Asked Questions

What is KV cache?

A KV cache stores information a large language model (LLM) has already worked out from earlier text, so it can reuse that work when generating a reply. “KV” refers to the keys and values the model calculates for each token. Without a cache, the model would need to process the whole conversation again before responding. With one, it can reuse the stored information and process only the new text.

Key takeaways

  • Shrink it: A smaller KV cache leaves GPU memory free for more concurrent requests and longer contexts. DriveNets DoseRank, which converts GQA models to MLA without retraining, reduced KV cache size by up to 62.5% in DriveNets testing.
  • Move it: In disaggregated inference, the KV cache must travel from the prefill node to the decode node before the first token is generated. DriveNets KVeXpress cut time to first token by an average of 13.4% and raised throughput by 8% compared with Mooncake.
  • Reuse it: Reusing a stored KV cache avoids repeating prefill for content the model has already processed. A shared KV cache tier built by DriveNets, AMD and VAST Data delivered about 5× higher throughput and 12.6× lower time to first token than a local-only cache at high concurrency.

Shrink It. Move It. Reuse It. Three Drivers for improving LLM inference performance

Large language model inference is increasingly becoming a systems problem. As models grow, context windows expand, and inference architectures become more distributed, delivering better performance is no longer simply a matter of deploying faster GPUs. The infrastructure surrounding those GPUs increasingly determines how efficiently they can serve tokens.

One of the most important parts of that infrastructure optimization is Key-Value (KV) cache management. Examine how KV cache size, movement, and reuse affect inference performance.

During inference, the KV cache stores the attention state associated with previously processed tokens. This allows the model to continue generating tokens without recomputing the entire preceding context for every new token.

But KV cache is not unlimited. Longer contexts and more concurrent requests increase KV cache memory requirements. When available memory becomes insufficient, the serving system may need to move or discard cached state, recompute it later, or limit the number of simultaneous requests. These trade-offs can increase latency and reduce throughput.

KV cache behavior therefore directly influences three of the most important measures of inference performance:

Time to First Token (TTFT): how long the user waits before generation begins.

Time per Output Token (TPOT): how quickly subsequent tokens are generated.

Throughput: how many tokens or requests the infrastructure can process over time.

Every cluster builder therefore needs to optimize the KV cache. Many techniques exist, but three performance drivers matter most.

Shrink it. Move it. Reuse it.

These are not the only KV cache optimizations available. They are three critical drivers that can materially influence inference performance depending on the workload, model architecture, context length, concurrency level, and serving architecture.

Diagram of KV cache pressure. On the left, four sources of growing demand push on the KV cache: longer contexts, multi-turn projects, concurrent requests and agentic open sessions. On the right, three optimization strategies push back: Shrink it (efficient attention), Move it (efficient KV cache movement) and Reuse it (offload KV cache).
Growing demand and optimization strategies acting on KV cache pressure.

KV cache is becoming an infrastructure problem

KV cache starts in GPU memory. It does not stay there.

Several trends push it out. When context windows grow, a single request holds more state. When concurrency grows, the aggregate working set outgrows what the GPU can hold. When inference is disaggregated, prefill and decode run on separate nodes and the cache has to travel between them no matter how large it is.

The result is a memory hierarchy for KV cache, GPU HBM at the top, host memory below it, shared cache tiers below that and a network connecting all of them.

Managing this distributed hierarchy effectively dictates your system’s performance. Ultimately, solving the KV cache problem requires answering three critical infrastructure questions: how much data you are creating, how fast you can transfer it, and how effectively you can leverage what you already have.

How do KV cache size, movement, and reuse affect inference performance?

Download: The KV Cache Playbook

1. Shrink it: Reduce the KV cache memory footprint

Let’s start with the first performance driver, KV cache size.

A larger KV footprint consumes more GPU memory per active sequence, which limits how many requests a GPU can serve at once. Shrinking that footprint from its core can free up room for more concurrency, longer contexts and better use of costly VRAM.

Several techniques can reduce the KV cache footprint, including different attention architectures, quantization, compression and lower-precision representations. Each comes with a downside, most often some impact on accuracy. This article focuses on the attention architectures that compress KV cache while keeping that accuracy impact to a minimum.

One important architectural development is Multi-head Latent Attention (MLA). Most well-known open models today, including LLaMA, Mistral, Qwen, Gemma and GPT-oss, run on Grouped Query Attention (GQA), which already reduces KV cache requirements compared with traditional Multi-Head Attention (MHA) by letting multiple query heads share key and value heads.

Line chart of KV cache size in GB (0 to 600) against context length in tokens (0K to 128K) for gpt-oss. MHA rises steepest and passes 600 GB before 16K tokens, GQA reaches about 600 GB near 128K tokens, and MLA stays lowest at about 350 GB at 128K tokens. A shaded band marks the MI355X HBM limit of 288GB, and a callout reads MLA: 1.7X more tokens per GB vs GQA.
KV cache size vs. context length (gpt-oss)

MLA takes this further. It compresses the KV cache using low-rank matrices, shrinking its KV cache footprint by approximately 72% compared with GQA in LLaMA-3-8B, as demonstrated in public research.

The potential infrastructure effect is straightforward:

Smaller KV cache > lower memory pressure > greater concurrency and longer contexts > better infrastructure efficiency

So why isn’t everyone shifting to MLA? The issue is adoption. Because a model’s attention mechanism is fixed at training time, moving from GQA to MLA has required retraining from scratch, an investment few teams want to make on models already in production. But there is a solution.

1.1. DriveNets example: DoseRank converts GQA models to MLA without retraining

DriveNets built DoseRank based on proprietary research showing that GQA models can be converted to MLA without retraining. DriveNets turned that foundation into an automated, enterprise-ready pipeline with improved performance, so it can modernize existing GQA-based models and reduce their KV cache footprint without retraining the model or sacrificing accuracy.

In DriveNets testing, this approach can reduce KV cache size by up to 62.5%, depending on the model and configuration.

Line chart of warm total token throughput in tok/s against max concurrent requests (0 to 1,200) for GPT-OSS-120B on MI355X with identical GPU memory. Vanilla GQA peaks at about 1.1 million tok/s and collapses at 300 concurrent requests, while MLA holds about 1.0 to 1.2 million tok/s and collapses at 900 concurrent requests, about 3× later. A callout reads 62.5% smaller KV cache per request vs. vanilla GQA.
MLA KV cache saving: warm/radix serving capacity, GPT-OSS-120B (MI355X). 62.5% smaller KV cache per request vs. vanilla GQA.

DoseRank is one option among several for shrinking KV cache. Don’t treat KV cache size as fixed. The model architecture itself can become a place to optimize your infrastructure.

Performance impact: Shrinking the KV cache can reduce HBM pressure and improve the ability to support higher concurrency or longer context windows, which can positively affect throughput and overall serving efficiency.

2. Move it: Transfer the KV cache efficiently between prefill and decode nodes

The second performance driver is how efficiently the KV cache moves between GPUs and nodes.

In many modern inference architectures, the KV cache cannot stay where it was created. Disaggregated inference is the best example. Prefill and decode run on separate compute resources so each task gets the compute it needs. The model builds the KV cache during prefill, and that cache then has to move to the decode node before it can generate the first token.

Conceptually: Prefill GPU >> KV cache transfer >> Decode GPU

For short contexts, this transfer barely impacts total latency. But the KV cache grows with the context. A 100K-token or 1M-token context can produce gigabytes of KV cache that must cross the network before any token reply is generated. At that scale, transfer performance can directly affect response latency and user experience.

For cluster builders, the question is how quickly KV state can move from where it is created to where it is needed. The answer affects TTFT and overall inference throughput.

2.1. The cost of reserving decode memory too early

The KV cache transfer method can impact GPU idle time. Part of the reason is how the cache is stored. Serving engines like vLLM, SGLang and TensorRT-LLM do not keep a request’s KV cache in one place. They split it into small fixed-size pages spread across the decode GPUs, so a single 32K-token request on a 671B model can scatter roughly 50GB of KV cache across the node in many separate pieces.

Moving that fragmented data takes coordination. Mooncake, a widely adopted KV-transfer framework, uses a push-based design. The prefill node writes the KV cache directly into the decode node’s memory using one-sided RDMA. That write needs a destination that is already reserved, so the decode node must set aside its VRAM in advance and hold it idle until prefill finishes and the data arrives. That idle window lowers concurrency and raises Time to First Token, especially in prefill-heavy setups. It is a good example of the kind of KV cache inefficiency operators should watch for when choosing a transfer framework.

2.2. DriveNets use case: KVeXpress vs. Mooncake for KV cache transfer

DriveNets AI Labs developed KVeXpress, an alternative to Mooncake, to make this node handoff more efficient for prefill-heavy inference workloads. It combines three changes to memory allocation and data movement:

  • Allocate decode memory when it is needed (Just-in-time decode allocation): delays reserving decode GPU memory until prefill has finished, leaving that memory available to other requests during prefill.
    Timeline comparing decode GPU memory state across four phases: request arrival, prefill, transfer and decode. With Mooncake the memory is reserved at request arrival and waiting or idle during prefill, then receiving and decoding. With KVeXpress the memory is free at request arrival and free during prefill, then receiving and decoding.
    KVeXpress – JIT Decode Allocation
  • Transfer fewer, larger blocks (Vectorized KV transfer): groups pages that sit next to each other in memory into larger blocks before sending, so the network card moves fewer, bigger transfers instead of many tiny ones.
  • Move data on demand (Decode-driven movement): switches the transfer from push to pull, so the decode node pulls the KV cache when it is ready and the prefill node moves straight on to the next prompt.

DriveNets tested KVeXpress on a three-node AMD MI355X cluster with two prefill nodes and one decode node (2P1D). The workload used 64K input tokens and 1K output tokens. The baseline was the best-performing Mooncake configuration measured on the same cluster.

Across the sweep, KVeXpress cut TTFT by an average of 13.4% and end-to-end latency by 5.6% while raising overall cluster throughput by 8%. Individual tokens arrive a little slower (TPOT and inter-token latency rise about 8.5%) because the freed decode VRAM lets the cluster serve more requests at once. But over a full 1K-token response, the faster start more than makes up for it.

Concurrency TTFT (ms) ↓ Inter-Token Latency (ms) ↓ TPOT (ms) ↓ E2E Latency (ms) ↓ Output Throughput (tok/s) ↑ Total Throughput (tok/s) ↑ Actual mean concurrency
Conc.8 -15.0% +1.3% +1.2% -4.1% +5.0% +5.0% +0.7%
Conc.16 -24.9% +5.6% +5.6% -12.6% +15.6% +15.6% +1.0%
Conc.32 -5.6% +11.1% +11.1% -1.4% +5.2% +5.2% +3.7%
Conc.48 -8.0% +16.4% +16.3% -4.2% +6.3% +6.3% +1.9%
Average -13.4% +8.6% +8.5% -5.6% +8.0% +8.0% +1.8%

↓ lower is better ↑ higher is better

The key takeaway is that as context windows grow, KV cache movement becomes part of the inference performance equation.

The KVeXpress results illustrate the value of matching the transfer approach to the workload. Other workloads may benefit from different transfer methods or a different balance of prefill and decode capacity. Cluster builders should evaluate these choices rather than assume the default configuration delivers the best performance.

Performance impact: Faster KV cache movement can reduce transfer-related latency during disaggregated inference and improve TTFT and throughput.

Three result cards comparing KVeXpress with Mooncake: 13.4% faster TTFT, 5.6% improved E2E latency and 8% higher throughput.
KVeXpress vs Mooncake

3. Reuse it: Avoid unnecessary prefill recomputation

The third performance driver is KV cache reuse: keeping the KV state the GPU has already computed and using it again instead of recomputing it.

Most inference workloads see the same content over and over. A long system prompt is sent with every request. A RAG service re-reads the same documents. A multi-turn chat or an agentic workflow replays the whole conversation so far on every step. In each case the model has already processed those tokens once.

Without reuse, the GPU repeatedly executes prefill over the same tokens. Building that state is the expensive part of a request. For a 60K-token prompt it can take tens of seconds of pure prefill before the model emits a single word, and the instant the request finishes most systems throw the state away. The next request that shares the same prompt, whether the same system prompt, the same document or the same conversation so far, rebuilds it from scratch.

In DriveNets testing, we have watched an eight-GPU node burn 20 seconds of prefill to answer a question it had already prefilled for a different user thirty seconds earlier. That is compute that could otherwise be used for new work. KV cache offload solves it by keeping the state somewhere cheaper than HBM and handing it back instead of recomputing it. Restoring a cached prefix rather than rebuilding it returns roughly 90% of the GPU time that request would have spent on prefill.

The trade-off is simple:

Without reuse Existing context >> GPU precomputation >> KV cache >> Generation
With reuse Existing context >> retrieve reusable KV cache >> Generation

3.1. Local KV cache has a capacity limit

GPU HBM provides fast access but limited capacity. Host memory expands the local cache capacity, but it is also finite. As context length and concurrency increase, the reusable KV state may exceed both local tiers.

At that point, the system has two options:

Discard cache and recompute or store it in an additional cache tier and retrieve it when needed.

This introduces shared storage and the network into the KV cache hierarchy. In practice that hierarchy has three tiers:

  • Tier 1 – GPU HBM: fastest access, smallest cache capacity.
  • Tier 2 – Host DRAM / LMCache: larger, node-local cache.
  • Tier 3 – Storage: local NVMe or shared storage accessible to multiple serving nodes over the network.

Moving cached state beyond HBM trades access speed for additional capacity. That trade is worth making because reading cached KV state from any other tier is faster than recomputing it on the GPU.

Shared storage adds one more benefit: every node in the cluster can reach the same cache. In benchmark testing of AMD Instinct MI355X clusters using multi-turn coding-agent workloads, at 64 concurrent requests, HBM alone had run out of room and median time to first token reached 61 seconds. Adding a host DRAM tier to the same split prefill/decode configuration cut it to 21.9 seconds. Adding local NVMe read GPU-direct cut it to 11.3 seconds. These tiers delivered roughly 2.8× and 5.4× lower median time to first token, respectively.

Two line charts comparing four cache configurations at 8 to 112 concurrent requests: Tier 1 HBM only, Tier 2 plus host DRAM, Tier 3 plus local NVMe and Tier 3 plus shared NFS/RDMA. Throughput chart: at 64 requests the Tier 3 options reach about 58,000 tok/s against 37,500 for host DRAM and 22,500 for HBM only, and at 112 requests they hold 58,000 to 59,600 tok/s while host DRAM and HBM only fall to about 23,800 and 22,300. Latency chart: median TTFT at 64 requests is 61 seconds for HBM only, 21.9 for host DRAM, 14.85 for shared NFS/RDMA and 11.3 for local NVMe, and at 112 requests it is 135, 111.7, 39 and 35 seconds. A shaded area on both charts marks low KV pressure, where little offload benefit was observed.
KV cache tiers under rising concurrency. AMD Instinct MI355X · same split prefill/decode setup · TP=1

3.2. KV cache storage depends on the network

Shared storage sits on the other side of the network. Every KV cache read has to cross the Ethernet fabric between the GPUs and the storage, so the storage is only as fast as the path to it. Under the heaviest load, a well-built networking fabric cuts the wait for the first token significantly.

For cluster builders the rule is simple. The storage and the Ethernet fabric that connects it to the GPUs have to be designed together, so that neither one holds the other back.

3.3. DriveNets + VAST example: shared KV cache offload

This is exactly the principle DriveNets, AMD, and VAST Data set out to prove. Together we built an architecture where reusable KV cache state can span between compute memory, host memory or an external shared cache tier, and we designed the storage and the DriveNets AI fabric together so neither one holds the other back.

Test Setup:

  • VAST served as the external shared KV cache tier alongside GPU and host memory and was tested as a CNode/DNode 3×2 configuration that provided the shared persistent data path.
  • VAST was mounted over NFSv3 with the Enhanced NFS client and multipathing, spreading reads across multiple CNodes and both interfaces to fill the bandwidth.
  • The DriveNets lossless fabric was tuned protocol by protocol so RDMA and TCP each got what they needed. Across the complete DriveNets and VAST data path, a single eight-GPU server sustained 89.8 GB/s of read throughput, about 90% of the dual 400 Gb/s line rate.
  • The benchmark ran GPT-OSS-120B with a 120K-token input sequence, TP=8 across eight AMD MI355X GPUs, and concurrency from 100 to 600 simultaneous requests.

Results:

  • Throughput (Tokens/Second):
    The VAST-backed shared cache delivered about 5× higher throughput than local-only once the working set outgrew local cache, roughly 470K to 508K tokens/s versus below 100K tokens/s
    Line chart of warm total tok/s (in thousands) against concurrency from 100 to 600. LMCache with VAST stays between about 470K and 508K tok/s up to concurrency 500 and ends near 400K at 600. LMCache without the L2 tier starts at about 600K at concurrency 100 and 200, then drops to under 100K at 300 and stays below 50K through 600.
    Warm total tok/s vs concurrency: KV cache cliff
  • Time to First Token (TTFT)
    About 12.6× lower TTFT at concurrency 600 than the local-only configuration.
    Line chart of mean TTFT in seconds against concurrency from 100 to 600, cold and warm, for LMCache with VAST and LMCache without the L2 tier. Both cold lines rise together from about 180 seconds at concurrency 100 to about 1,080 seconds at 600. Warm TTFT without L2 climbs from near zero at 200 to about 340 seconds at 300 and about 1,080 seconds at 600, while warm TTFT with VAST stays under about 90 seconds across the whole range.
    Cold vs warm mean TTFT vs concurrency

Performance impact: KV cache offloading reduces repeated prefill computation and, in this benchmark, improved TTFT by about 12.6× and throughput by about 5×, particularly for long-context, multi-turn, and high-concurrency workloads. Offloading depends heavily on the network, so getting the network right is what turns a promising microbenchmark into more users served per GPU.

Three drivers, three different bottlenecks

Shrink, Move, and Reuse each target a different bottleneck. Shrink reduces the memory footprint, Move speeds data transfer, and Reuse avoids recomputation. They also reinforce one another, since a smaller KV footprint is cheaper to move and to store for reuse, and faster movement makes shared-cache reuse more attractive.

The goal is not to optimize one metric but to improve the inference metrics that matter to the cluster builder, and because the impact of each driver depends on the model, context length, concurrency, architecture, and cache hit rate, no single optimization fits every cluster. The way to find the right mix is to evaluate the cluster end to end against its workload, across the GPU, model, network, and storage, which is exactly where DriveNets focuses.

KV cache driver Main bottleneck addressed Primary performance impact
Shrink it Memory footprint Concurrency, Throughput
Move it Data transfer TTFT, throughput
Reuse it Recomputation TTFT, throughput

Frequently Asked Questions

What limits how many requests a GPU can serve during LLM inference?

The number of requests a GPU can serve during LLM inference is limited largely by KV cache memory. A larger KV cache footprint consumes more GPU memory per active sequence, and longer contexts and more concurrent requests increase that footprint. In DriveNets testing of GPT-OSS-120B on AMD MI355X GPUs, a Multi-head Latent Attention version with a 62.5% smaller KV cache per request kept its throughput from collapsing until 900 concurrent requests, versus 300 for vanilla Grouped Query Attention.

How much does reusing the KV cache speed up LLM inference?

Reusing the KV cache returns roughly 90% of the GPU time a request would otherwise spend on prefill, because a cached prefix is restored instead of rebuilt. In a DriveNets, AMD and VAST Data benchmark running GPT-OSS-120B with a 120K-token input, the shared KV cache delivered about 5× higher throughput than local-only caching once the working set outgrew the local cache, and about 12.6× lower time to first token at concurrency 600.

Why do long prompts slow the first token in disaggregated LLM inference?

Long prompts slow the first token in disaggregated LLM inference because the KV cache built during prefill must cross the network to the decode node before generation starts. A 100K-token or 1M-token context can produce gigabytes of KV cache. In a DriveNets test with 64K input tokens on a three-node AMD MI355X cluster, DriveNets KVeXpress cut time to first token by an average of 13.4% compared with the best-performing Mooncake configuration.

Contents

Continue reading

Optimal AI performance per watt for AMD Instinct clusters and DriveNets AI Fabric

Case Studies

NeoCloud Case Study: Optimal AI performance per watt for AMD Instinct clusters and DriveNets AI Fabric

How Bentaus built its AMD Instinct™ MI325X NeoCloud cluster on DriveNets AI Fabric and cut energy per token by 30%.

Read more

Case Studies

NeoCloud Case Study: Highest-Performance Unified Fabric for Compute, Storage and Edge

The rapid rise of artificial intelligence (AI) since late 2022 has pushed neocloud providers to the forefront of the com ...

Read more
The KV Cache Playbook

White Papers

The KV Cache Playbook

Large language model inference is increasingly becoming a systems problem. This white paper examines how KV-cache size, ...

Read more