← Latest papers
💻 computer science

CachePrune: Privacy-Aware and Fine-Grained KV Cache Sharing for Efficient LLM Inference

CachePrune is a privacy-aware mechanism for Large Language Model inference that enables fine-grained, token-level sharing of Key-Value cache entries to eliminate side-channel leakage while significantly improving cache hit rates and reducing time-to-first-token compared to existing coarse-grained or sharing-disabled approaches.

Original authors: Guanlong Wu, Zhaohan li, Yao Zhang, Zheng Zhang, Jianyu Niu, Ye Wu, Yinqian Zhang

Published 2026-05-25
📖 4 min read☕ Coffee break read

Original authors: Guanlong Wu, Zhaohan li, Yao Zhang, Zheng Zhang, Jianyu Niu, Ye Wu, Yinqian Zhang

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine a massive, super-smart library (the Large Language Model or LLM) that helps people write stories, answer questions, and solve problems. To work fast, this library keeps a "scratchpad" (called the KV Cache) of everything it has already read and thought about. If two people ask similar questions, the library can skip re-reading the common parts and just look at its scratchpad, saving a huge amount of time and energy.

However, there's a problem: Privacy.

The Problem: The "Echo" in the Library

If the library lets everyone share the same scratchpad, a sneaky thief (an adversary) could try to guess what you wrote.

  • How? The thief asks the library a question. If the library answers super fast, it means the library recognized part of the question from your previous request and reused its scratchpad.
  • The Risk: By timing how fast the library answers different questions, the thief can figure out exactly which words you used, even if they weren't supposed to see them.

The Old Fix: To stop this, the library's managers decided to stop sharing the scratchpad entirely between different people. It's safe, but it's slow and wasteful because the library has to re-read everything from scratch every time.

The New Solution: CachePrune

The authors of this paper built a new system called CachePrune. Think of it as a smart librarian with a red marker.

Instead of throwing away the whole shared scratchpad just because one person wrote a secret, the librarian does something much smarter:

  1. The Red Marker (Privacy Detection): The librarian scans your request and puts a red "DO NOT SHARE" sticker on any sensitive words (like your name, credit card number, or private secrets).
  2. The Scissors (Fine-Grained Cutting): The librarian cuts the request into tiny pieces.
    • The pieces with red stickers are thrown into a private bin (they are never shared).
    • The pieces without stickers (like "Hello," "Please write a story about," or "The weather is") are kept in the shared scratchpad.
  3. The Puzzle Solver (Smart Retrieval): When a new person comes in, the librarian doesn't just look for big, pre-cut blocks of text. They look for exact matches of the safe, sticker-free pieces, no matter where they appear in the sentence.

Why This is a Big Deal (The Analogy)

Imagine you are baking a cake with a friend.

  • The Old Way (All-or-Nothing): If you whisper a secret to your friend while baking, the whole kitchen is considered "contaminated." You can't share the recipe or the tools with anyone else ever again. You have to buy new tools and start over.
  • The CachePrune Way: You wear a special apron. You whisper your secret, and the apron catches it. The rest of the kitchen (the flour, the eggs, the mixing bowl) is perfectly clean. You can share the clean tools with the next baker immediately. You save time, but your secret stays safe.

How It Works Under the Hood

The paper explains two tricky technical challenges they solved to make this possible:

  1. Finding the Safe Pieces: It's hard to know exactly which parts of a sentence can be reused without messing up the meaning. The system uses a mathematical trick (called a "summed-area table") to quickly scan the sentence and find the longest, safest chunks that don't rely on the secret words.
  2. Finding the Pieces Fast: Since the safe chunks can be any length (not just fixed blocks), finding them is like searching for a needle in a haystack. The system uses a "rolling hash" (like a sliding window) to scan through requests incredibly fast, checking for matches in milliseconds.

The Results

The authors tested this system on a real library (using the vLLM software) with three different types of tasks (answering questions, reading stories, and summarizing meetings). Here is what they found:

  • Privacy: The "thief" could not guess any of the secret words. The "Direct Recovery" rate was 0%. Even guessing the meaning from the context was very difficult (less than 7% success).
  • Speed: Because they could share the safe parts, the system was 4.5 times faster at starting to answer a question compared to the old "no-sharing" method.
  • Quality: The answers were just as good as if the system had read everything from scratch.
  • Efficiency: Even without any privacy rules, this new "cutting" method was 44% better at reusing work than previous methods that only used fixed-size blocks.

Summary

CachePrune is a system that lets AI servers share their "memory" to work faster, but it acts like a smart filter. It automatically hides sensitive information before sharing, allowing the safe parts to be reused instantly. This breaks the old rule that you had to choose between speed and privacy; now, you can have both.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →