TL;DR
Sending private prompts to cloud LLMs usually means scrambling your text with mathematical noise—a trick that quickly ruins response quality if you ask hundreds of questions under a strict privacy limit. LDPCache solves this by introducing a smart, local cache that reuses past answers for semantically similar questions, saving your "privacy budget" for the queries that truly need the cloud. Even better, it hides when you use the cache so eavesdroppers can't deduce your habits from network traffic alone.
What Problem Does This Paper Address?
When you use a cloud-based LLM, your data leaves your device, creating a risk for sensitive info like medical records or trade secrets. To prevent leaks, researchers use Local Differential Privacy (LDP)—essentially injecting calibrated randomness (swapping sensitive words with noisy alternatives) right on your device before hitting "send."
In differential privacy, you operate on a strict privacy budget ($\varepsilon$). Every time you send a noisy query to the cloud, you spend some of that budget. If you have a fixed total budget for a stream of 1,000 queries, dividing it equally means each query gets a tiny fraction of $\varepsilon$, which requires injecting massive amounts of noise. Your prompts turn into gibberish, and the LLM's accuracy tanks.
However, real-world queries—especially in Retrieval-Augmented Generation (RAG) or templated workflows—are super repetitive. Standard semantic caches exist to reuse past LLM answers, saving time and money. Yet, no one had figured out how to build a cache for private, noisy queries, where cached answers vary wildly in quality and even the timing of your API calls can leak secrets.
Methods
LDPCache sits on the user's edge device, managing interactions between a local cache, an edge-side Small Language Model (SLM, Qwen2.5-1.5B), and a cloud LLM (Qwen2.5-7B). While it uses an existing state-of-the-art method (Cape) for standard token-level noise injection, its surrounding architecture is entirely novel:
- LDP-Compliant Query Scheduler: Normally, a cache "hit" just checks if a new query is semantically similar to an old one. Here, old answers came from noisy prompts, so LDPCache also checks accuracy: it only triggers a hit if the cached entry was generated using a higher privacy budget (less noise) than what is currently available for a fresh cloud call. Because skipping an API call reveals to network snoopers that you asked a repeat question, the scheduler reserves 10% of the total privacy budget to flip a weighted coin (Randomized Response) on the Hit/Miss decision. If a "Miss" gets randomly flipped to a "Hit"—meaning you must not call the cloud, yet your cache is empty—the query is quietly routed to the local SLM using the true, unperturbed text.
- Adaptive Budget Reallocation: Every time a cache hit avoids the cloud, the unspent privacy budget is rolled over, allowing future novel queries to hit the cloud with less noise and higher accuracy.
- Accuracy Equivalence Mechanism: Because local SLM answers are also cached, LDPCache needs to know how they stack up against noisy cloud answers. Periodically in the background, a reward model compares local SLM outputs against noisy cloud outputs on cached prompts, calculating an "equivalent privacy budget" score for the SLM.
- Multi-Factor Cache Eviction: Edge devices have limited memory, and standard "Least Recently Used" (LRU) eviction is blind to noise levels. LDPCache scores cache states on three axes: Diversity (penalizing redundant prompts), Accuracy (summing the privacy budgets of stored items), and Recency, dynamically shifting weights based on recent hit streaks.
Datasets
The authors evaluated LDPCache on four standard NLP datasets:
- Discriminative tasks: QNLI and SST-2.
- Generative tasks: CNN/Daily Mail and WikiText-103.
To mimic realistic multi-query streams, they constructed 1,000-query workloads using both Uniform (30% repeat rate) and Zipf distributions (simulating concentrated, repetitive topic clusters). Rather than using lazy exact-match duplicates, they used the Kimi K2-Instruct API to semantically rewrite repeated queries.
Key Insights and Ideas
- Cache timing is a side-channel: Simply slapping a semantic cache in front of a private LLM breaks differential privacy. Perturbing the binary Hit/Miss decision—and catching "false hits" with a local SLM—is a clever way to plug this timing leak without exposing raw data.
- Bigger caches aren't always better: Counterintuitively, expanding cache capacity occasionally caused slight accuracy drops. A larger cache holds onto more historical baggage, increasing the odds of matching with an older, lower-accuracy (high-noise) response.
- LRU fails in noisy environments: Treating all cached items equally is a mistake when some answers were derived from heavily garbled prompts. Factoring in the privacy budget $\varepsilon$ as a proxy for response quality makes eviction much smarter under tight memory limits.
Key Results
Across nearly all workloads and budgets, LDPCache substantially outperforms the NoCache baseline (which splits the budget evenly across cloud calls) and beats LDPCache-LRU.
- Discriminative Gains: LDPCache improves accuracy by 10% to 20% in multiple cases. On QNLI (Zipf workload, cache size 50, per-token budget $\varepsilon_{\text{tok}} = 15$), LDPCache hits 75.9% accuracy compared to just 54.4% for
NoCacheand 67.6% forLDPCache-LRU. - Generative Gains: Under low-to-moderate privacy budgets, LDPCache boosts semantic Coherence over
NoCacheby 3 to 10 percentage points on CNN/DailyMail and WikiText-103. - Workload Concentration: As queries become more repetitive (increasing the Zipf parameter $\alpha$ from 0.8 to 1.4 on SST-2), LDPCache's accuracy lead over
NoCachenearly doubles from ~8 to ~15 percentage points.
Limitations and Future Work
Not explicitly discussed in a dedicated section, though the authors note two operational boundaries in their experiments:
- Under high privacy budgets, LDPCache's advantage over
NoCachebecomes marginal because base noise is already so low that all methods approach non-private ceiling performance. - Increasing cache capacity can occasionally retain low-accuracy (high-noise) historical entries, causing minor utility dips in specific configurations.
Summary updated