GO TO A SECTION

↑ ↓ to navigate · Enter to openExplore all sections →
FDEInterviews logo
EuroSys 2025

CacheBlend: Fast Large Language Model Serving for RAG with Cached Knowledge Fusion

Prefix caching only helps the first retrieved chunk. CacheBlend reuses every chunk's cached KV and recomputes about 15% of tokens to restore cross-chunk attention: 2.2-3.3x faster first tokens in RAG.

Breakdown by FDE Interviews · 13 min read · Updated

About the original · 2025
AUTHORS
Yao, Li, Liu, Ray, et al.
FROM
University of Chicago, CUHK Shenzhen, Stanford University, Microsoft Research
PUBLISHED
May 2024 · EuroSys 2025
CITED BY
322Semantic Scholar · Oct 2026
IN THIS BREAKDOWN · 10 SECTIONS

You can read 19% of this breakdown.

01

The paper in one minute

A RAG prompt stacks several retrieved chunks in front of the question. The same chunks keep coming back across queries, so it is tempting to compute each chunk's KV cache once and reuse it. Two existing ways do that, and both fall short. Prefix caching (vLLM, SGLang) reuses a cache only when it is the prompt's prefix, so with six chunks it saves the first one at best. Full KV reuse (PromptCache) concatenates each chunk's separately computed cache with its positions corrected. It is fast, but each chunk's cache was computed without seeing the chunks before it, so the cross-attention between chunks is missing. The paper's example: one chunk gives Messi's World Cup goals, another Ronaldo's, and full reuse can't compare them.

CacheBlend reuses every chunk's cache and repairs it. On each layer it recomputes the KV of a small share of tokens, the ones whose cached KV deviates most from what a full prefill would produce. Finding them exactly would need the full prefill, so it uses a shortcut: tokens that deviate on one layer tend to deviate on the next. It recomputes all tokens on the first layer, ranks them by deviation, and on later layers recomputes only the top-ranked tokens, narrowing the set slightly each time. About 10% to 15% of tokens carry most of the deviation, and 15% is the default.

The second idea is pipelining. Recomputing a layer's selected tokens can overlap with loading the next layer's cache from CPU memory or SSD; when loading is the slower step, the recompute is free. That makes cheap, large storage (SSD) usable for KV caches.

Across Mistral-7B, Yi-34B and Llama-70B on 2WikiMQA, Musique, SAMSum and MultiNews, time to first token (TTFT) fell 2.2-3.3x against full prefill with quality within about 0.02, and throughput rose 2.8-5x. The code lives in the LMCache repository.

THE IDEA, VISUALLY
FOUR WAYS TO BUILD A MULTI-CHUNK KV CACHE full recompute q slowest correct prefix caching q barely faster correct full KV reuse q fastest quality drops CacheBlend q near full reuse near full recompute computed now cached, reused recomputed tokens WHICH TOKENS TO RECOMPUTE (SECTION 4.3) Layer 1: recompute every token, then rank tokens by how far their new KV is from the cached KV (high-KV-deviation tokens). Next layers: recompute only those, narrowing the set a little each layer; the same tokens tend to deviate on adjacent layers. About 10-15% of tokens deviate much more than the rest, so recomputing 10-20% preserves quality (r* = 15% by default). RoPE positions are fixed by rotating the cached K, once per chunk code: in the LMCache repository LOADING HIDES RECOMPUTE, PER LAYER, 4K TOKENS Llama-7B load layer from NVMe 16 ms recompute 15% of tokens 3 ms Llama-70B load layer from NVMe 4 ms recompute 15% of tokens 7 ms 7B: free under the load time. 70B: GQA makes KV 4x smaller, so loading is faster than recompute and 15% adds ~3 ms per layer AGAINST FULL RECOMPUTE (SECTION 7.2) time to first token 2.2-3.3x lower throughput at the same TTFT 2.8-5x higher quality (F1 / Rouge-L) within ~0.02 vs full KV reuse +0.15 to +0.35 Mistral-7B, Yi-34B, Llama-70B; 2WikiMQA, Musique, SAMSum, MultiNews; 6 chunks of 512 tokens per input; A40 GPUs, 4.8 GB/s NVMe. Prefix caching was given zero load time. WHERE IT PAYS RAG and multi-document inputs whose chunks recur across queries in different orders and combinations
A RAG prompt is several retrieved chunks plus a question. Reusing each chunk's cached KV is fast but loses the attention between chunks; CacheBlend recomputes the few tokens that need it and hides that work behind loading the cache.
Research notes: the problem, approach and results
2.2-3.3x

lower time to first token than full prefill, three models and four datasets, quality within about 0.02

~15%

share of tokens recomputed per layer by default; 5%-18% lost at most 0.002 F1 or Rouge-L on Yi-34B

3 ms vs 16 ms

per-layer time to recompute 15% of tokens versus load the layer's KV from NVMe, Llama-7B, 4K context

THE PROBLEM

RAG inputs are several retrieved chunks, and the same chunks recur across queries in different orders. Prefix caching reuses only the first chunk. Concatenating separately cached chunks (full KV reuse) is fast, but each chunk's cache was computed without the chunks before it, so answers that need facts from two chunks go wrong.

THE IDEA

Reuse every chunk's cached KV, then on each layer recompute the KV of the small set of tokens whose cached values deviate most from what a full prefill would give. Find them on the first layer and narrow the set layer by layer, and pipeline this recompute with loading the next layer's cache from RAM or SSD so it adds little or no delay.

THE RESULT

Across Mistral-7B, Yi-34B and Llama-70B on four datasets, time to first token fell 2.2-3.3x and throughput rose 2.8-5x against full prefill, with F1 and Rouge-L within about 0.02. Full KV reuse scored 0.15-0.35 lower.

02

Why it matters to an FDE

In a customer's RAG deployment, the retrieved context is most of the prompt and most of the prefill time; the question itself is a few dozen tokens. Popular documents, policies and product pages get retrieved again and again, in different combinations. That repeated work is what CacheBlend targets.

Prefix caching does less for RAG than people assume. It helps the shared system prompt and the first chunk. Unless the customer always retrieves the same chunks in the same order, the rest is recomputed every time.

Naive chunk caching is a correctness bug, not just a quality dip. Gluing separately cached chunks together drops the attention between them. Questions that compare or join facts across documents are exactly the ones that break, and they are often the ones the customer cares about.

Where the cache lives is a latency decision. CacheBlend's pipelining lets a slower, cheaper tier serve the cache without adding delay, up to the point where loading becomes the bottleneck. That turns "can we afford to cache this corpus" into arithmetic you can do in an afternoon.

THE FULL BREAKDOWN

Understand the mechanism. Try it on a real problem.

Unlock this breakdown and 149 more papers.

Premium opens every paper in full, plus every answer, concept, course and guide on the site. One payment for six months of access.

6 months · One payment · No auto-renewal

Get Premium · ₹2,000 / $25
  • ◇1 architecture diagram
  • </>1 runnable code experiment
  • ▦2 results tables
  • ?5 interview questions with answers
  1. 03Key takeaways

    Four reuse strategies compared, why sparse recompute works, the pipeline, and three misreadings

    Free account
  2. 04How it works

    The selective recompute, the narrowing token selection, the loading controller and the store

    Premium
  3. 05The numbers that matter

    Setup, TTFT and quality, throughput, recompute ratios and storage tiers

    Premium
  4. 06Try it yourself

    Check the per-layer timing, run selective recompute on a toy model, and size the storage tier

    Premium
  5. 07Where it breaks

    Approximation limits, workload assumptions, a single storage tier and slips

    Premium
  6. 08Using it on a deployment

    Measuring chunk reuse, choosing the storage tier, and checking quality on cross-document questions

    Premium
  7. 09Interview angles

    Five questions this paper prepares you for, with answer hints

    Premium
Back to the paper library →