LDPCache: Locally Differentially Private Multi-Query Processing with Cache Optimization for Large Language Models

Haoqiang Shi, Ning Wang, Chuan He, Qian Ma, Zhigang Wang, Shen Su, Yu Gu, Zhihong TianNeurIPS 2026

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:

Figure 1: Overview of the LDPCache framework.
  • 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.

Table 1: Performance on discriminative tasks under two query workloads.
  • 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 NoCache and 67.6% for LDPCache-LRU.
  • Generative Gains: Under low-to-moderate privacy budgets, LDPCache boosts semantic Coherence over NoCache by 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 NoCache nearly 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 NoCache becomes 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

Abstract

The Model-as-a-Service (MaaS) paradigm enables resource-constrained edge users to access cloud-based large language model (LLM) services but raises significant privacy concerns. Existing approaches perturb user queries under local differential privacy (LDP) before sending them to LLMs. However, naively applying these methods to multi-query scenarios leads to linear growth in privacy budget consumption. To address this, we propose LDPCache, the first cache-enhanced LDP framework for multi-query LLM processing. By leveraging semantic correlations across queries submitted over time by a user or an organization, LDPCache maintains a cache of historical responses and intelligently decides whether to reuse a cached result or query the cloud-based LLM, thereby reducing privacy budget consumption. The core of LDPCache is an LDP-compliant scheduler that evaluates cache reusability based on both semantic similarity and the expected accuracy gains from LLM access. This scheduler enables hit decisions without actual LLM access while ensuring that the scheduling process itself satisfies LDP guarantees. To accommodate the limited memory of edge devices, we further design a multi-factor cache eviction strategy that balances query diversity, response accuracy, and recency to improve the hit ratio. Extensive experiments on real-world datasets demonstrate that LDPCache significantly improves response accuracy over baseline methods.
BibTeX
@inproceedings{shi2026ldpcache,
  author = {Haoqiang Shi and Ning Wang and Chuan He and Qian Ma and Zhigang Wang and Shen Su and Yu Gu and Zhihong Tian},
  title = {{LDPCache: Locally Differentially Private Multi-Query Processing with Cache Optimization for Large Language Models}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=7A3Ee5d8kP},
}
Figure