NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Latent-in-the-Middle: On the Security of Cross-Model Latent Communication in Multi-Agent Systems

Manit Baser, Vyoman Jain, Rachel Yeo Hui Min, Xianglin Yang, Meenatchi Sundaram Muthu Selva Annamalai, Dinil Mon DivakaranarXiv 2026

TL;DR

Instead of chatting in plain English, collaborating AI agents are starting to pass their internal "thoughts"—specifically, translated Key-Value (KV) caches—directly to one another to save massive amounts of compute. However, this paper reveals a major catch: when a safety-aligned model inherits a memory it didn't read and encode itself, its safety guardrails and prompt-injection defenses largely evaporate. By systematically mapping out this new attack surface, the authors show how easily these "latent handoffs" can be exploited—and introduce a lightweight neural "bouncer" to restore safety at the door.

What Problem Does This Paper Address?

When multiple LLMs team up—say, a cheap, fast subagent reading a long webpage and escalating the problem to a larger, smarter main model—talking via text is shockingly expensive. Every time an agent receives a message, it has to "prefill" (read and build internal math representations for) the entire context from scratch.

To skip this bottleneck, researchers recently invented cross-model KV-cache transfer. A source model reads the text, builds its internal memory (the KV cache), and passes it through a lightweight translator called a mapper so a completely different target model can pick up right where the first left off.

Here is the million-dollar security question: An LLM’s safety training relies heavily on how it internally represents a prompt while reading it. If a hardened target model skips reading the text and decodes straight from a translated cache, does its safety alignment still work?

Overview of native inference vs. latent handoffs for jailbreaks and indirect prompt injections.

Methods

To investigate this, the authors introduce CHASM, a framework that categorizes attacks based on the new components separating user input from the answering model across Qwen3, Llama 3, and Ministral 3 families (using four standard mapper architectures like NVIDIA’s ridge mapper, CacheBridge, and SwaT):

  • Zero-Shot Jailbreaks: Testing standard jailbreak Templates (J1), bouncing the cache back and forth via Model Switching (J2) without generating text in between, and swapping in an Untrusted Source (J3) (e.g., an uncensored, "de-aligned" model from Hugging Face) to encode the prompt.
  • Mapper-Aware GCG (J4): Extending standard white-box Greedy Coordinate Gradient (GCG) optimization by pushing gradients end-to-end through the target model, the mapper, and the source model to craft adversarial text suffixes.
  • Indirect Prompt Injection (IPI): Having an undefended small subagent fetch external data containing hidden malicious instructions and pass its cache back to a specially hardened main agent (Meta-SecAlign-8B).
  • HandoffGuard (Defense): A novel, lightweight target-side defense (~10M parameters). Acting on incoming caches before decoding, it applies a learned low-rank residual correction to keys and values. Crucially, instead of crudely forcing refusals, it is trained via teacher-forcing against de-aligned sources and adversarial perturbations to make the target model reproduce whatever native reply it would have given had it read the text itself.

Datasets

The paper introduces no new benchmarks, relying instead on an extensive suite of established datasets:

  • Mapper Calibration: FineWeb-Edu and UltraChat.
  • Jailbreak & Over-refusal Evaluation: HarmBench, StrongREJECT, SORRY-Bench, and XSTest (safe prompts to check false refusals).
  • Prompt Injection: AlpacaFarm and TaskTracker.
  • Capability Tracking: MMLU and GSM8K (ensuring safety shifts aren't just brain damage).
  • Guard Training: AdvBench, Dolly, and OR-Bench.

Key Insights and Ideas

  • Mappers translate accuracy, not safety: Mappers are calibrated to minimize mathematical distance on benign text. Even without an attacker, simply passing a plain harmful request between two aligned models increases jailbreak success in over half of tested settings—often making the target model less safe than either model alone!
  • You are only as secure as the agent doing the reading: Defenses like Meta-SecAlign work by teaching a model to internally separate trusted instructions from untrusted data roles during encoding. When a subagent encodes the untrusted text instead, the main agent never builds that defensive representation. Even without a mapper (using an undefended twin of the exact same architecture to prefill), the injection defense collapses.
  • Chat calibration is a double-edged sword: Calibrating a mapper on chat conversations (UltraChat) instead of raw web text (FineWeb) feels intuitive for chat pipelines, but it makes template and model-switching attacks substantially deadlier.
  • Stealthy supply-chain risk: If an attacker substitutes a de-aligned source model, the aligned target model inherits its willingness to comply with harmful requests while keeping its high MMLU and GSM8K scores intact—meaning standard capability checks won't catch the compromise.

Key Results

  • Prompt Injection Collapse: Natively, Meta-SecAlign-8B falls for only 0.4% of AlpacaFarm prompt injections. When a 3B subagent reads the content and hands off the cache, attack success skyrockets to ~30% on default mappers and up to 44.2% on SwaT (Chat).
  • Zero-Shot Jailbreak Boosts: Merely transferring plain harmful prompts between aligned models raises HarmBench attack success rates (ASR) by up to +24.6 percentage points (pp). Wrapping prompts in standard templates boosts ASR by up to +69.2 pp, and bouncing caches via model switching adds up to +38.8 pp.
  • White-Box Supercharging: While ordinary GCG on standalone Llama-3.1-8B hits 37.5% ASR, Mapper-Aware GCG exploits the mapper's blind spots to reach 92.5% (crossing 90% across all three model families).
  • HandoffGuard Efficacy: Adding just 3.6–8.2% to native prefill time at zero utility loss, HandoffGuard (p1) brings ASR from an untrusted, de-aligned source back within 4.5 points of native safety across all model families.

Limitations and Future Work

  • Vacuum Model Switching: The model-switching experiments bounce caches back and forth with zero tokens generated in between. Real multi-turn sessions generate self-computed tokens at turn boundaries, which might either dilute or compound these mapping errors.
  • Guard Scope & White-Box Limits: If an attacker gains white-box access to HandoffGuard’s weights and LoRA fine-tunes the source model directly against it, ASR climbs back to 73.3–87.5% (by forcing compliant opening tokens like "Sure, here is" despite the target model's internal refusal probe firing). Furthermore, against prompt injections, HandoffGuard fails closed (refusing the whole prompt) rather than cleanly ignoring the injected task.
  • Cache Composition: Current mappers hand off the entire context at once. Future architectures might let a main agent encode its own trusted instructions natively and stitch on only the untrusted data as a mapped cache—though the authors suspect injection defenses would still struggle.

Summary updated

BibTeX
@misc{baser2026latent,
  author = {Manit Baser and Vyoman Jain and Rachel Yeo Hui Min and Xianglin Yang and Meenatchi Sundaram Muthu Selva Annamalai and Dinil Mon Divakaran},
  title = {{Latent-in-the-Middle: On the Security of Cross-Model Latent Communication in Multi-Agent Systems}},
  year = {2026},
  eprint = {2611.34278},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.34278},
}
Figure