Latent-in-the-Middle: On the Security of Cross-Model Latent Space Communication in Multi-Agent SystemsLatent-in-the-Middle: On the Security of Cross-Model Latent Communication in Multi-Agent Systems
The authors use CHASM to evaluate cross-model KV-cache handoff: Meta-SecAlign-8B's injection ASR on AlpacaFarm rises from 0.4% to 44.2% via SwaT (Chat).
CHASM is a family of threat models: J1 sends text only; J2 can trigger handoff; J3 can select or replace the source model but does not know the mapper weights; J4 is white-box with respect to source, mapper, and target; in IPI the user is benign, and a third party plants fixed instructions in external content. The victim system is an aligned target agent handed off via cross-model KV-cache transfer.
- Cross-model KV-cache handoff lets the target use representations generated by other models and mappers; the authors examine whether its safety alignment and prompt injection defenses still hold, and the new attack surface introduced by the source, the mapper, and repeated handoffs.
- CHASM organizes J1 templates, J2 model switching, J3 untrusted source, J4 mapper-aware GCG, and IPI by entry point, and compares them with native inference in 24 settings; it also proposes the low-rank cache correction HandoffGuard.
- J3 becomes a jailbreak in 24/24 settings; Meta-SecAlign-8B's AlpacaFarm injection ASR rises from 0.4% to 44.2% via SwaT (Chat). p1 brings the training-time source's HarmBench ASR back to within 4.5 percentage points of native, but guard-aware LoRA still reaches 73.3–87.5%.
- The authors leave switching with generation, refitting the mapper against the defense model, and cache composition for future work. Experiments use open 3B–32B models, with no manual annotation of transfer output samples; p2 over-refuses, and fine-tuning the source with knowledge of the guard weights still succeeds.
- Evaluated models
- Qwen3-32BQwen3-14BLlama-3.1-8B-InstructLlama-3.2-3B-InstructMinistral-3-14BMinistral-3-8BQwen3-4BMeta-SecAlign-8B
- Benchmarks
- HarmBenchStrongREJECTAlpacaFarmTaskTrackerXSTestMMLUGSM8KAdvBenchDollyOR-BenchSORRY-Bench
- Metrics
- ASR∆ = ASRtr − ASRnatMMLUGSM8Kover-refusalrefusal-direction probe
Researchers from the National University of Singapore and other institutions propose the Chasm framework, and their evaluation finds that cross-model KV cache handoff in multi-agent systems substantially weakens the target model's safety alignment and prompt injection defenses. Attacks are divided by entry point into four categories—template jailbreak, model switching, untrusted source and mapper-aware GCG—plus indirect prompt injection, covering three attack surfaces: the source model, the mapper and the handoff mechanism. Across 24 settings spanning three model families (Qwen3, Llama 3, Ministral 3) and four mappers, zero-shot jailbreak raised the HarmBench attack success rate by up to 69.2 percentage points, replacing the source model with a public unaligned model succeeded in all settings, mapper-aware GCG reached 92.5% on Llama (versus 37.5% for ordinary GCG), and Meta-SecAlign-8B's injection success rate on AlpacaFarm rose from a native 0.4% to as high as 44.2%.
Why it was selectedThe paper provides quantitative evidence that cross-model KV cache handoff weakens safety alignment and prompt injection defenses; teams deploying model cascades or multi-agent cache sharing can use this to assess the associated risks.
Related events and news
1 events · 0 news mentions
- This event's paper
研究:跨模型KV缓存交接削弱安全对齐
Paper analysis
What problem does this paper attempt to solve?
Cross-model KV-cache handoff changes who computes the safety representations; the authors systematically evaluate its attack surface and defenses.
Core question: whether the target model's native safety alignment and prompt injection defenses still hold when it decodes a KV cache computed by another model and rewritten by a mapper.
- Scenario and importance: Model cascading, delegate and return, routing, and session switching can reuse prefill; but the answering model no longer encodes the user request or external content itself, and the trust boundary changes with the cache handoff (Figure 1).
- Gap in existing research: The authors state that existing KV-cache safety research mostly assumes the cache is generated by the model that reads it; three inter-agent KV safety studies assume homogeneous agents and do not cover jailbreak, IPI, and cross-model mappers (Section 8.1).
- Core observation: Refusal is carried by the prompt's internal representation and the first answer token, and IPI defense also relies on distinguishing trusted instructions from untrusted data; handoff makes these representations determined by the source and mapper.
- Proposed work: CHASM organizes J1–J4 and IPI by attack entry point, evaluates across three model families, four mapper types, and two calibration corpora for 24 settings in total, and proposes target-side HandoffGuard.
- Threat model: CHASM is not a single threat model but a family of threat models (Table 1).
- J1/J2: J1 can only send text and read answers; J2 can also trigger handoffs, send ordinary harmful requests, and repeatedly map the cache.
- J3/J4: J3 can choose or replace the source but does not know the mapper weights; J4 knows the source, mapper, target, and weights, and is the only white-box attack.
- IPI: The user is benign, and a third party plants fixed instructions in external content without knowing the model or mapper.
- Victim system and goal: The aligned target agent answers from the mapped cache; the attack goal is to make it answer requests it would otherwise refuse, or execute instructions in untrusted content.
What related research exists?
Related work spans cache safety, multi-agent threats, alignment fragility, and runtime defenses.
KV-cache and latent channel safety
- Cache leakage and integrity attacks: Timing side channels of cross-tenant prefix sharing, prompt reconstruction from direct cache access, and cache poisoning or manipulation work such as HijackKV study the confidentiality and integrity of shared caches.
- Latent multi-agent safety: Wang et al. (2026) study utility degradation from latent intervention, Brito and Baquero (2026) authenticate payloads with keyed manifests, and LCGuard (2026) limits input reconstruction; the authors state that all three assume homogeneous agents and do not test jailbreak, IPI, and cross-model mappers.
- VReparo (2026): Measures non-adversarial safety changes from direct cache reuse between variants of the same base model and repairs them with per-head affine maps; the authors note that it does not evaluate adversaries or cross-size/cross-family mappers.
Multi-agent attacks and IPI defenses
- Text and multimodal propagation: Agent Smith (2024), Triedman et al. (2025), He et al. (2025), and others study instruction propagation, orchestration hijacking, and communication tampering; routing attacks use adversarial prefixes to manipulate model selection.
- IPI benchmarks and defenses: Injecagent and AgentDojo evaluate agent injection; spotlighting, instruction hierarchy, StruQ, SecAlign, Meta-SecAlign, TaskTracker, and others defend at the prompt, model, detector, or system level. The authors point out that prompt-, model-, and detector-level defenses assume the defended model itself reads the untrusted data, and delegate-and-return breaks this assumption.
Alignment fragility and cross-model representations
- Alignment fragility: Minimal fine-tuning, pruning/low-rank edits, refusal ablation, compression, as well as soft prompts, multimodal encoders, and activation steering can all weaken or bypass alignment.
- Representation alignment and mappers: Layer stitching, relative representations, CacheBridge, SwaT, NVIDIA ridge/MLP mapper, and KV-Lingo support cross-model representation or cache conversion; embedding translation and activation maps have shown risks of document leakage and refusal-direction transfer.
Runtime defenses and positioning of this paper
- Text guards and representation detectors: Llama Guard, ShieldGemma, SmoothLLM, and others check text; representation-level detectors monitor internal states. The authors state that the former cannot verify whether a mapped cache triggers refusal, and the latter usually assume the state is computed by the defended model itself.
- Baselines and benchmarks: All attacks use the target's native inference with the same template, decoding settings, and seeds as the baseline; J4 is compared against ordinary GCG, and D2 against VReparo. HarmBench, StrongREJECT, AlpacaFarm, TaskTracker, XSTest, MMLU, and GSM8K are used.
The authors position CHASM as: without directly writing cache tensors, legitimate pipeline components can also cause safety shifts, and it brings templates, switching, compromised sources, suffix optimization, and calibration poisoning into the same handoff attack surface.
How does the paper address this problem?
CHASM unifies the handoff path and five attack types, then locates risk through paired native inference and adaptive defense evaluation.
The overall idea is to decompose the latent handoff into source, mapper, target, and a chainably repeatable handoff, and to organize attacks by entry point using CHASM (Cross-Model Handoff Attacks in Latent-Space Agent Communication); defenses correct the mapped cache before target decoding.
System model and handoff paths
- Three components: source agent S encodes the context into a KV cache, mapper M converts it into the representation of target T, and T generates the answer from the mapped cache; handoffs can be executed in a chain.
- Two deployment types: model cascading upgrades or switches models in one direction; delegate and return hands the task to a subagent and then returns its cache to the main agent.
- Unified comparison: in the native path, T performs prefill itself; the transfer path is T(M(S(x))), and the two share the lead-in, decoding loop, and stopping rule, differing only in the prefix-cache producer.
- Mapper types: same-tokenizer ridge, MLP, and CacheBridge predict in a RoPE-free space and restore RoPE; cross-tokenizer SwaT aligns by character offsets and uses an attention-based renderer to generate the cache.
Five attack types and success determination
- J1/J2: J1 wraps 159 standard HarmBench behaviours into Wei et al.'s 10 template families; J2 maps back and forth without generating intermediate tokens, with at most 6 switches, isolating the effect of repeated mapping.
- J3: replaces the source with a public de-aligned checkpoint, keeping the mapper, target, and decoding unchanged; the authors state that this is only the weakest form of control and that the results are a lower bound for its threat model.
- J4: mapper-aware GCG optimizes a 20-token suffix, with gradients flowing through S, M, and T; the core objective is Ltr(s)=−log PT(y⋆∣ M(S(chat(x‖ s))<n),xn),即让 target 从 mapped cache 解码时提高 HarmBench affirmative target string 的概率。
- IPI:第三方在 subagent 获取的内容中植入固定指令;AlpacaFarm 以回答是否以指定标记开头判定,TaskTracker 由 judge 判定是否执行 injected task。
实验协议与统计
- 24 个设置:Qwen3、Llama 3、Ministral 3 各一对 source→target,配 ridge、CacheBridge、MLP、SwaT,以及 FineWeb-Edu 和 UltraChat 两种校准;每对也反向运行。
- Mapper 训练:按官方 recipe 使用 500 条、每条 1,024 token 的 FineWeb-Edu 序列及 chat-templated UltraChat;ridge 的 in-sample R² 为 0.77–0.94。
- ASR 与检验:报告 ASRtr、ASRnat 及 ∆=ASRtr−ASRnat(百分点);HarmBench classifier 的 P(yes)>0.5 is judged successful. Paired comparisons use a two-sided exact McNemar test, and J2 applies a Bonferroni correction for the six switch counts.
- Decoding recheck: greedy decoding is primary; temperature 0.7 sampling is combined with item-level cluster bootstrap, with three seeds for no-attack and SwaT and one seed for the rest.
HandoffGuard and adaptive evaluation
- Low-rank correction: D3 adds a rank-64 residual to the K and V of each mapped token, skips the attention sink, and zero-initializes U; on Ministral-3-14B this is about 10M parameters, and long prompts increase the target's own prefill time by 3.6–8.2%.
- Training objective: the guard minimizes the KL between the guarded transfer and the target's native greedy reply over the first 32 answer tokens, so that benign prompts also retain the original answer as much as possible.
- Two variants: p1 alternates aligned and de-aligned sources; p2 additionally performs 5-step PGD on the source input embeddings in half the steps. Training runs for 1,000 steps with batch size 8, on 400 AdvBench, 400 Dolly, and 200 OR-Bench, only through the stock ridge (FineWeb) mapper.
- Adaptive attacks: tests include embedding PGD that knows the guard weights, GCG through the guarded path, and rank-16, 300-step LoRA fine-tuning on the de-aligned source; a LoRA trained without the guard serves as a gray-box control.
What experiments did the paper conduct?
24 handoff settings cover five attack types; risk is widespread, but direction, magnitude, and defense effectiveness are conditional.
Experimental Setup
- Target models: The main experiments within the same family are Qwen3-14B→32B, Llama-3.2-3B→3.1-8B, and Ministral-3-8B→14B, and are also tested in reverse; cross-family are Llama-3.2-3B→Qwen3-4B, Qwen3-8B→Llama-3.1-8B, and Llama-3.2-3B→Ministral-3-14B.
- IPI models: target is Meta-SecAlign-8B, source is Llama-3.2-3B-Instruct; also tested are undefended Llama-3.1-8B-Instruct and an 8B-prefill control without a mapper.
- Attacker models: J3 uses the public de-aligned checkpoints listed in Table 2; J4 has white-box access to source, mapper, and target.
- Data scale: HarmBench 240 text behaviours (159 standard, 81 contextual), StrongREJECT 313 direct requests; AlpacaFarm 208 samples containing a data field, 8 attack variants, with ASR aggregated; TaskTracker samples 3,000 items stratified from 31,134 items.
- Judging and metrics: The HarmBench classifier judges by P(yes)>0.5; Gemma 4 31B is the second judge and is also used for TaskTracker. Metrics are ASR, ∆, MMLU, GSM8K, and refusals on 250 safe prompts from XSTest.
- Repetition and re-checking: The main setting is greedy; the number of seeds for the sampling re-check is 1 or 3 depending on the path. Gemma re-evaluated 1.77M verdicts, the rubric was calibrated with 100 human labels, κ=0.94; agreement with the classifier's answers is 91.2% (κ=0.79).
Main Results
The table below is all based on Table 3; standalone HB is the target's native HarmBench ASR, J1 is the maximum gain over the native target with the same template on the 159 standard behaviours, J4 is ordinary GCG→mapper-aware GCG.
Swipe horizontally to read the table
Family and mapper Calibration Standalone HB No attack ∆ J1 max ∆ J2 max ∆ J3 HB ∆ J4 ASR Qwen3 Ridge FineWeb 18.8% +1.7 pp +28.3 pp n.s. +34.6 pp 65.0→62.5% Qwen3 SwaT Chat 18.8% +7.1 pp +57.2 pp +20.8 pp (2) +37.1 pp 65.0→90.0% Llama 3 Ridge FineWeb 30.0% −15.8 pp 0 templates increased ↓ +21.3 pp 37.5→60.0% Llama 3 MLP Chat 30.0% +16.7 pp +64.2 pp +24.6 pp (3) +32.9 pp 37.5→52.5% Llama 3 SwaT Chat 30.0% +5.4 pp +69.2 pp +11.2 pp (2) +21.2 pp 37.5→92.5% Ministral 3 Ridge FineWeb 25.0% +10.0 pp +19.5 pp +15.8 pp (5) +32.1 pp 42.5→77.5% Ministral 3 CacheBridge Chat 25.0% +2.5 pp +11.9 pp +9.2 pp (2) +23.8 pp 42.5→27.5% Ministral 3 SwaT Chat 25.0% +24.6 pp +52.8 pp +38.8 pp (2) +45.4 pp 42.5→90.0% - Coverage note: To control the number of table rows, each family lists the representative Ridge row and several high and low results, omitting the remaining mapper×calibration combinations; the full 24 settings are in Table 3. J3 succeeds in all 24 settings, with HB ∆ from +16.3 to +45.4 pp and SR ∆ from +16.0 to +64.9 pp.
- Not unidirectional harm increase: Without attack, ASR rises in 13/24 settings, but for Llama 4/8 mappers make the target safer; of these only two gains hold under sampling, and they do not cause blanket refusals.
- Exception for J4: The authors report that mapper-aware GCG outperforms ordinary GCG in 11 of 24 settings, and is numerically lower in 4, none of which is statistically significant; under SwaT (Chat) the three targets are 90.0%, 92.5%, and 90.0% respectively.
Cross-family, Reverse Handoff, and Calibration Effects
- Cross-family SwaT: In Table 4, without attack HarmBench ASR rises for 4/6 renderers, up to +32.9 pp; J1 is up to +73.0 pp, J2 rises in 6/6 settings, up to +33.8 pp. The two SwaT (FineWeb) renderers are exceptions under no attack and de-aligned source.
- Strong-to-weak: In reverse handoff, aligned source raises ASR in 15/24 settings; de-aligned source succeeds in 24/24 settings, with HB ∆ from +20.8 to +59.2 pp (Section 5.7).
- Calibration corpus: Chat brings larger template and switching gains in 10 of the 12 mapper pairs; for J3 and J4 only 6 and 7 are larger. Ministral is the main exception, where Chat calibration lowers J3 and J4 ASR on 3/4 mappers.
IPI and Preliminary Defenses
- Meta-SecAlign-8B: In Table 5, AlpacaFarm ASR rises from native 0.4% to 26.2–29.7% for the four FineWeb mappers, and is 44.2% for SwaT (Chat); TaskTracker goes from 2.1% to 6.7–20.1%. With no mapper and prefilled by the undefended 8B, AlpacaFarm is 31.9%.
- D1 mapper alignment: After adding refusal dialogues, Qwen (ridge, FineWeb) ASR on 283 HarmBench/SORRY-Bench requests drops from 51.6% to about 32%, with native at 20.5%; the authors state that the source's compliance decision still remains.
- D2 VReparo: Qwen role-play drops from 54.7% to 27.7%, but J3 on Qwen is still 26.7–56.2%, and up to 58.8% on Llama; suffixes optimized through VReparo reach 36% on Qwen and 31–54% on Llama. Llama (SwaT, FineWeb) GSM8K also drops from 42.8% to 5.6%.
HandoffGuard and Adaptive Attacks
- J3 defense: In Table 6, p1 brings the three pairs' HarmBench ASR for the training-time de-aligned source back to within 4.5 percentage points of native; p2 is 9.2–16.2%, lower than their respective native values. When changing the mapper, p2 on Qwen CacheBridge only drops from 55.0% to 33.8%, and is 19.6% after retraining on that mapper.
- Utility and IPI: In Table 7, p1 loses at most 1.8 MMLU points relative to no guard and increases GSM8K by at most 10.0 points, and XSTest refusals differ from native by no more than 1.2 points; p2 over-refuses on Qwen and Llama. On Llama IPI, p1 lowers ASR from 29.6% to 10.0%, and p2 to 0%, but p2 refuses 94% of injected and 18% of clean inputs, which the authors describe as failing closed.
- Adaptive results: In Table 8, guard-aware LoRA through p2 reaches 73.3%, 87.5%, and 75.0% on Ministral, Qwen, and Llama respectively; gray-box LoRA drops to 12.1% and 9.2% on Qwen and Llama. PGD at ϵ=0.1 lowers Qwen from 53% to 20% and Llama from 83% to 43%, but a larger radius breaks all pipelines.
- Mechanism probe: De-aligned source lowers the refusal-direction probe to 0.20–0.41, and the guard restores it to 0.68–0.76; under guard-aware LoRA the probe is still 0.71–0.81. The authors therefore argue that this LoRA does not eliminate the refusal representation but forces a compliant opener through the cache.
Other Ablations and Analyses
- Appendix A: Qwen (ridge, FineWeb) recovers 94.6% of tokens from the mapped cache and exactly recovers all ten fields of 500 synthetic records.
- Appendix B: With a trigger, ridge/MLP reach 46.7–77.1% ASR across 24 settings, and clean mapper is 10.0–38.3%; 5 of the 6 SwaT reach 72.9–96.2%.
- Appendix C: After 6 hops each chain loses 28.0–92.4 points on GSM8K, and 16/24 chains solve at most 10%; CacheBridge loses 65.2–85.6 points after 3 hops.
- Appendix D: Changing batch size changes 47% of native and 64% of transfer HarmBench answers, but verdicts change by only 2.1% and 2.9%; independent runs differ by at most 2 pp.
- Second judge: Of the 797 comparisons with p<0.01 under the classifier, 782 (98.1%) have the same sign and p<0.05 under Gemma; the headline gain of the style-injection template loses statistical significance.
What are some points that can be further explored?
The authors list three future directions; the guard still has limitations against informed adaptive attacks and injection utility.
Limitations and Future Directions Noted by the Authors
- Switching with generation: J2 does not generate tokens between switches; real sessions often switch at turn boundaries, so multi-turn sessions, real switching policies, and the joint effects on safety, capability, and latency need study (Section 9, Switching with generation).
- Mappers for defended models: IPI reuses a mapper fitted for undefended Llama-3.1-8B; refitting for Meta-SecAlign-8B requires calibration data covering the input role and measuring both capability and injection effects (Section 9, Mappers for defended models).
- Injection defense still to be evaluated: HandoffGuard currently can only block injection via refusal; a guard trained against injection, and VReparo for defended models, remain to be evaluated (Section 9).
- Cache composition: Existing mappers hand off the entire source context at once and cannot attach a mapped segment to the target's existing cache; composition must preserve positional consistency and latency gains, and whether IPI defense can be partially retained remains open (Section 9, Cache composition).
- Secrecy of the guard: The authors state that p1 cannot stop a white-box attacker who knows the guard weights and fine-tunes the source, so the weights must be kept secret, and the guard cannot replace source authentication (Section 7.2).
Scope of Experimental Coverage
- Model scope: The authors explicitly write the scope as open 3B–32B models, matched KV geometry, and refusal-ablated de-aligned sources (Section 9, Scope).
- Output checking: The paper explicitly states that no human annotation was performed on samples of transfer outputs; the second judge's rubric was calibrated with 100 human labels (Section 9; Appendix D).
- Main experiment matrix: Three model families, four mapper types, two calibration corpora, 24 settings in total; plus three cross-family SwaT pairs and three reverse pairs (Sections 4, 5.6, 5.7).
- Defense coverage: D1 and D2 are preliminary; D3 is trained only through the stock FineWeb ridge mapper, and J3 training and evaluation use the same de-aligned source, so the authors make no claim about unseen sources (Sections 7, 7.2).
- Adaptive budget: Guard-aware LoRA is rank 16, 300 steps; GCG uses 20 behaviours on Ministral and 10 with a reduced budget elsewhere (Section 7.2).
Summarize the main content of the paper
The authors evaluate cross-model cache handoff as an independent attack surface and provide cache defenses that are conditionally effective.
This is an attack and defense study on the security of cross-model KV-cache transfer in heterogeneous multi-agent systems, with the core question: when the answering model no longer encodes the input itself, do its safety alignment and IPI defenses still hold.
- Method framework: CHASM divides risk into input template J1, repeated model switching J2, untrusted source J3, mapper-aware GCG J4, and IPI; all except J4 are zero-shot. Experiments cover three model families, four mapper types, and two calibration corpora, for 24 main settings in total.
- Zero-optimization attacks: J3 becomes a jailbreak in 24/24 settings, with HarmBench ASR increasing by +16.3 to +45.4 pp; J1 increases by up to +69.2 pp on Llama 3, SwaT (Chat). Even without attack, 13/24 settings rise, but 4/8 mappers for Llama instead lower ASR.
- White-box attack: On Llama 3, ordinary GCG is 37.5%, and mapper-aware GCG via SwaT (Chat) is 92.5%; but 4 of all 24 settings are numerically lower than ordinary GCG, none statistically significant.
- Prompt injection: Meta-SecAlign-8B's ASR on AlpacaFarm rises from native 0.4% to 44.2% for SwaT (Chat); with no mapper and only undefended 8B prefill it is also 31.9%. The authors therefore argue that defense depends heavily on how the model encodes untrusted data.
- Defenses and boundaries: HandoffGuard p1 brings the three pairs' HarmBench ASR for the training-time de-aligned source back to within 4.5 percentage points of native, and the authors report that p1 has no utility loss; but guard-aware LoRA still reaches 73.3–87.5%, and p2 blocks injection by relying on extensive refusals.
- Authors' conclusion: Caches from other agents should be treated as untrusted input, requiring authentication at the source, protection in transit, and red-teaming together with the serving system; the authors also emphasize that guard weights must be kept secret and cannot replace source authentication.