LCGuard Cuts Leaks When AI Agents Share Their KV Caches
Agents that share KV caches instead of text work faster but can leak private inputs. LCGuard trains a filter against a decoder attack and cut attack success from 0.871 to 0.216 in one test.
TL;DR
- LCGuard, from Rensselaer Polytechnic Institute and IBM Research, transforms KV caches before AI agents share them, so attackers can't easily reconstruct private inputs [^1].
- In a Qwen3-4B test, attack success fell from 0.871 to 0.216, while helpfulness dropped from 0.780 to 0.710 [^1].
Background
In a multi-agent system, several language-model agents split a task and pass intermediate results along, usually as text [^1]. A transformer's KV cache holds the keys and values it has computed for every token it processed, so the model does not have to recompute them. Recent systems such as LatentMAS and KVComm let agents hand these caches to each other directly, skipping the detour of writing text and reading it back in [^1].
What happened
On May 21, Sadia Asif and Mohammad Mohammadi Amiri of Rensselaer Polytechnic Institute and three IBM Research colleagues posted LCGuard on arXiv [^1]. Their starting point: unlike text, a KV cache is hard to inspect and can carry information about an agent's inputs that never appears in its output. Anyone who can see the shared caches, for example through a compromised agent, logging infrastructure or an auxiliary model, could train a decoder to reconstruct those inputs [^1]. The paper therefore calls a shared cache unsafe if such a decoder can recover an agent's sensitive input from it. Existing safeguards in multi-agent systems, the authors note, check generated outputs or tool actions, not what travels through the caches [^1].
LCGuard places a small learned transformation on every link between agents. It acts on the final-layer keys and values, squeezing them through a narrow bottleneck while a residual connection keeps the task-relevant signal [^1]. Training is a contest: a decoder learns to reconstruct the sensitive inputs, and the transformation learns to make that hard without hurting the task. A tunable weight sets the balance between the two goals [^1]. In the full-system variant, the decoder sees every shared cache at once, because information that looks harmless on one link can become recoverable when several are combined. After training, the decoder is discarded, and each shared cache passes through a single feed-forward projection [^1].
The team tested Qwen3, Gemma-2 and LLaMA models from 3 to 14 billion parameters on three privacy benchmarks, PrivacyLens, AgentLeak and MAGPIE, with agents connected in chains, hierarchies and graphs [^1]. Attack success was judged by a language model that compared each reconstruction with the true private input [^1]. With Qwen3-4B in a chain on PrivacyLens, plain KV sharing reached an attack success rate of 0.871; the full-system LCGuard brought it to 0.216 [^1]. Across all tables, the authors report roughly a 65 to 75 percent cut in attack success while keeping most of the task performance [^1].
Why it matters
The comparisons show why existing defenses fall short. PrivAct, which trains agents to respect privacy in what they write, raised the privacy score to 0.820 but left attack success at 0.845 [^1]. ADAPT, which adds random noise to the caches, cut attack success to 0.332 but dropped helpfulness to 0.285 [^1]. Leakage also builds up as caches travel: reconstruction stayed easy at every agent under plain KV sharing, and the full-system variant beat the per-agent one most clearly at later agents [^1]. Without protection, larger models were more helpful but also leaked more [^1]. Speed survives mostly intact: in one AgentLeak setup, plain KV sharing was 4.1 times as fast as text-based communication, and LCGuard 3.6 times [^1].
The authors are clear about the limits. LCGuard measures safety against the decoders it was tested with: a stronger decoder raised attack success from 0.285 to 0.365 in one test [^1]. It gives no formal privacy guarantee such as differential privacy, needs paired training data and was only evaluated on selected open-weight models and fixed topologies [^1]. Agents built on different architectures are left for future work [^1]. The authors recommend combining it with access control, logging safeguards and output-level privacy checks [^1].
Practical example
Say Priya runs the AI team at an insurance company and builds a chain of four Qwen3-4B agents. The first reads a customer's claim file, including health details, the second checks the policy, the third looks for signs of fraud and the fourth drafts the reply. To save time, the agents pass their KV caches along instead of writing notes to each other, and the system logs those caches for debugging [^1].
The reply letter never mentions the diagnosis, so an output filter sees nothing wrong. But an attacker who gets into the logging system does not need the letter. With knowledge of the model family, the attacker trains a decoder that turns logged caches back into the private inputs behind them [^1]. In the paper's comparable test, a chain of four Qwen3-4B agents on PrivacyLens, such an attack succeeded at a rate of 0.871 [^1].
Priya's fix is to train LCGuard transformations for each link in the chain, with the decoder watching all links at once. In that test, attack success fell to 0.216, and helpfulness slipped from 0.780 to 0.710 [^1]. The pipeline stays much faster than text messages between agents [^1]. Because LCGuard offers no formal guarantee, Priya still locks down who can read the logs [^1].
Related gear
We recommend this book because it builds a transformer's attention step by step in code, which is where the keys and values in a KV cache come from.