When Agents Go Rogue: Activation-Based Detection of Malicious Behavior in Multi-Agent SystemsWhen Agents Go Rogue: Activation-Based Detection of Malicious Behaviors in Multi-Agent Systems
The authors propose AcMAS, which uses agents' internal activations to detect and correct malicious behavior in multi-agent systems; the authors report that under asynchronous settings it achieves an F1 of 0.93, higher than the graph baseline's 0.38.
Attackers can compromise a single agent through multiple attack vectors (stealthy prompt injection, tool manipulation, memory poisoning), and the compromised agent propagates malicious behavior along communication edges, causing cascading failures; the defender assumes access to the internal activations of local agent LLMs (open-weight deployment) and does not rely on an explicit interaction graph or semantic supervision.
- Multi-agent systems face agent-level and interaction-level attacks; the authors argue that existing defenses rely on two assumptions—semantically explicit attack signals and globally synchronized graph modeling—whereas real attacks are increasingly stealthy, MAS execution is mostly asynchronous, and isolation-based mitigation breaks collaboration.
- Proposes AcMAS: extract activation vectors from the last layer of local agent LLMs, use the centroid of normal activations as the prototype, and detect anomalies by cosine divergence; after detection, adaptively steer activations toward the normal prototype according to the magnitude of divergence to correct behavior, rather than isolating the agent.
- Evaluated on five attack scenarios under both synchronous and asynchronous execution modes: the authors report AcMAS average F1 of 0.95 synchronous and 0.94 asynchronous, higher than the graph baselines (asynchronous G-Safeguard 0.46); average TCR 0.98, ASR 0.04, and high detection maintained across four open-source backbones and at scales of 8–80 agents.
- The authors note: under domain shift, initial performance drops, and 50–100 benign trajectories from the target domain are needed to re-estimate the prototype; adaptive attacks that gradually shift the activation distribution remain unsolved and are left for future work; the threat model requires access to internal activations and applies only to open-weight models; current evaluation is limited to homogeneous-backbone MAS.
- Evaluated models
- GPT-OSS-20BDeepSeek-V3LLaMA3-8BQwen3-30B-A3B
- Benchmarks
- CSQAGSM8KInjecAgentPoisonRAGHotPotQA
- Metrics
- F1PrecisionRecallFPRAUROCASRTCR
AcMAS is an activation-based detection framework that identifies malicious behavior in large language model multi-agent systems by analyzing internal reasoning states in the agents' activation space. It does not rely on explicit interaction graphs, is robust to asynchronous execution, and can repair compromised agents rather than isolating them. In stealthy attack evaluations, AcMAS achieves F1 of 0.94 (synchronous) and 0.93 (asynchronous), higher than the graph baseline's 0.72 and 0.38, and generalizes across multiple open-source LLM backbones and system scales.
Paper analysis
What problem does this paper attempt to solve?
Addressing the problem that existing graph defenses fail under semantically stealthy attacks and asynchronous execution in MAS, the authors propose an activation-based detection and correction framework.
Core problem: how to detect and mitigate malicious agent behavior in multi-agent systems (MAS) that is semantically stealthy and occurs in asynchronous execution environments, without breaking the system's collaborative capability.
- Problem setting and importance: LLM-driven MAS collaborate through role division and message passing to complete complex tasks, but attacks can propagate among agents and be amplified (the authors cite Khan et al., 2025, etc.), affecting the entire system.
- Shortcomings of existing methods (three points summarized by the authors): ❶ Existing defenses assume attacks are semantically explicit and can be detected by output-level semantic analysis, whereas attacks such as MINJA mask malicious logic with a benign appearance; ❷ GNN-type defenses assume a globally synchronized round topology, and the authors cite Solodova et al. stating that they fail under asynchronous settings; ❸ isolation-based mitigation removes key agents, which the authors state causes task collapse.
- Core observation: The authors believe that deviations in neural activation patterns precede anomalous output behavior, and that compromised agents exhibit correlated clustering patterns in activation space (Eq. 8), which can serve as a detection signal independent of surface-level communication.
- Proposed in the paper: AcMAS, an activation-level MAS security framework comprising two components, divergence-based anomaly detection and restorative activation correction, evaluated on five benchmark scenarios under both synchronous and asynchronous modes.
- Threat model (Section 3.1 and Appendix A):
- Goal: The attacker compromises a single agent, causing it to propagate malicious behavior along communication edges and produce cascading failures.
- Attack vectors: three types: stealthy prompt injection, tool output manipulation, memory poisoning.
- Defender knowledge/capability: access to the internal activations of local agent LLMs (open-weight deployment assumption), not relying on an explicit interaction graph.
- Victim systems: LLM-based MAS executing synchronously (lock-step rounds) or asynchronously (event-driven, task allocation).
What related research exists?
Related work is divided into three groups: MAS, MAS attacks, and MAS detection; baselines are G-Safeguard, BlindGuard, and two graph anomaly detection methods.
Multi-Agent Systems
- Li et al. (2023a), Hong et al. (2024)—use specialized agent roles; Talebirad & Nadiri (2023), Wu et al. (2024)—structured interaction, enabling MAS capabilities to surpass single agents.
- Du et al. (2023), Zhuge et al. (2025), Liang et al. (2024)—collaborative reasoning paradigms such as debate, voting, and negotiation.
- Zhang et al. (2024a; 2025d;a)—automated design of MAS, dynamically constructing agentic workflows adapted to different tasks.
Adversarial attacks on MAS (the paper classifies them into three types by the exploited component)
- Agent-level attacks: Evil Geniuses (Tian et al., 2023), Wolf Within (Tan et al., 2024b), SCAV (Xu et al., 2024), PsySafe (Zhang et al., 2024b), which compromise a single agent's reasoning and decision-making.
- Communication-level attacks: Agent Smith (Gu et al., 2024), Prompt Infection (Lee & Tiwari, 2024), AiTM (He et al., 2025b), which exploit inter-agent communication to propagate malicious influence.
- System-level attacks: MASTER (Zhu et al., 2025), CORBA (Zhou et al., 2025), AgentUnderSiege (Khan et al., 2025), which target the overall architecture and coordination mechanisms.
MAS detection mechanisms (the paper's criticism focuses on this group)
- G-Safeguard (Wang et al., 2025b), NetSafe (Yu et al., 2024), BlindGuard (Miao et al., 2025)—model agents and communication as graphs and use supervised or unsupervised learning to detect malicious behavior; the paper points out that such topology-based methods rely on explicit interaction signals, and the authors cite Solodova et al. stating that topology-based GNN models fail under asynchronous settings.
- AgentSafe (Mao et al., 2025)—improves robustness through hierarchical information management; A-Trust (He et al., 2025a)—uses internal attention patterns to assess message trustworthiness. The paper's overall assessment: these defenses act on communication, structural statistics, or input-level cues, and do not touch the dynamics of agents' internal reasoning.
Baselines and benchmarks: comparison baselines are G-Safeguard (supervised GNN detector), BlindGuard (contrastive-learning unsupervised anomaly detection), and two graph anomaly detection (GAD) methods PERM (Pan et al., 2023) and TAM (Qiao & Pang, 2023); evaluation benchmarks are CSQA, GSM8K, InjecAgent, PoisonRAG, HotPotQA.
Positioning of this paper: the authors state that AcMAS does not analyze surface text outputs and interaction graphs, but instead detects activation patterns inside each local agent and replaces isolation with activation correction; in the Impact Statement, the authors state that AcMAS is the first framework to address adversarial compromise of MAS through activation-level analysis and correction.
How does the paper address this problem?
AcMAS extracts last-layer activations, computes cosine divergence against the normal prototype for detection, and then adaptively steers activations back to the normal manifold according to the divergence.
Overall idea: instead of looking at agents' text outputs and interaction graphs, represent each local agent's internal reasoning state as an activation vector, model the distribution of normal behavior in activation space, and detect attacks as deviations from that distribution; after detection, steer the activations back toward the normal prototype to restore functionality rather than isolating the agent. The framework is named AcMAS.
Problem setting and formalization
- MAS model: N agents each have an LLM backbone Mi and pass messages along a directed communication graph G; there are two execution paradigms: synchronous (K lock-step rounds) and asynchronous (task-queue driven, no global rounds).
- Detection goal: learn a mapping f: H(t) → {0,1}N, i.e., at each time step determine which agents are compromised based on the activation representations H(t) of all agents; in synchronous mode all N agents are detected each round, while in asynchronous mode only the currently executing subset is detected.
- Key observation: in the normalized activation space, the pairwise cosine distance between compromised agents is smaller than their distance to normal agents (clustering property, Eq. 8), and malicious patterns can propagate along messages and cause activation drift in receivers (Eq. 9).
Activation feature representation
- Extraction method: take the hidden state h(L) of the final generated token at the last layer as a summary of the entire input context (Eq. 6); the authors' rationale is that causal attention makes it aggregate information from all preceding tokens.
- Multi-backbone deployment: different LLM backbones each maintain independent normal prototypes, with no cross-architecture alignment (Appendix B).
Divergence-based detection
- Normal prototype: unit-normalize the activations of benign execution trajectories and take the centroid as µnormal (Eq. 10).
- Detection rule: δi(t) = 1 − ⟨ hi(t)/|hi(t)|, μnormal ⟩, i.e., the cosine divergence between the agent's activation and the prototype; exceeding the threshold τdetect is judged as compromised; τdetect is calibrated on the validation set by maximizing F1 (Appendix D).
- Paradigm adaptation: in synchronous mode, the prototype is adaptively updated with momentum α=0.7 using the activations of agents judged normal in the previous round (Eq. 13); in asynchronous mode, a fixed prototype from initial benign trajectories is used to avoid temporal alignment assumptions.
Activation-level correction
- Adaptive steering: correct the compromised agent's activation toward the prototype direction, with strength λi determined linearly by the position of the divergence within the interval [τdetect, τmax] (Eq. 14–15); the larger the deviation, the stronger the correction; τmax is taken as the 95th percentile of malicious divergence on the validation set.
- Default parameters: experiments use τdetect = 0.12, τmax = 0.35; the corrected activation is injected at the last layer and the response is regenerated (details in Appendix D).
Evaluation method
- Attack scenarios: three attack types across five scenarios—stealthy prompt injection on CSQA/GSM8K (adversarial text mimics benign queries in format and language style), tool manipulation on InjecAgent, memory poisoning on PoisonRAG and HotPotQA; Appendix A gives specific attack examples.
- Metrics: detection uses F1, Precision, Recall, FPR, AUROC; defense effectiveness uses ASR and TCR (TCR only measures whether the MAS completes execution and produces a final output, unrelated to answer correctness).
What experiments did the paper conduct?
Five-scenario dual-mode detection and defense comparison, generalization across four backbones and 8–80 scale, ablation, sensitivity, efficiency, and domain shift experiments.
Experimental setup
- Backbones tested: four open-source LLMs: GPT-OSS-20B, DeepSeek-V3, LLaMA3-8B, Qwen3-30B-A3B; the main table, Table 1, uses gpt-oss-20b throughout.
- Datasets/attacks: S-PI (CSQA, GSM8K), TA (InjecAgent), MA (PoisonRAG, HotPotQA), five scenarios in total, each instantiated as both synchronous and asynchronous MAS; the paper does not report sample sizes for each dataset.
- Baselines: G-Safeguard (supervised GNN), BlindGuard (unsupervised contrastive learning), PERM, TAM (two GAD methods).
- Metrics: detection F1/Precision/Recall/FPR/AUROC; defense ASR, TCR; results are mean ± standard deviation over multiple runs (the paper does not state the number of repetitions).
- Attack strength: the proportion of compromised agents varies from 0 to 40%, and average metrics are reported.
- MAS scale: generalization experiments cover 8–80 agents (Figure 3).
Main results
Table 1 (gpt-oss-20b, five-scenario averages given in the paper's main text) and Table 2:
Swipe horizontally to read the table
Method Synchronous F1 (CSQA) Asynchronous F1 (CSQA) Synchronous F1 (InjecAgent) Asynchronous F1 (InjecAgent) Average TCR Average ASR TAM 0.28 0.19 0.51 0.34 not reported not reported PERM 0.38 0.27 0.64 0.43 not reported not reported G-Safeguard 0.74 0.46 0.69 0.41 0.83 not reported BlindGuard 0.58 0.35 0.54 0.31 0.78 not reported AcMAS 0.95 0.94 0.93 0.92 0.98 0.04 (F1 per Table 1; TAM/PERM do not appear in Table 2; AcMAS achieves synchronous F1 0.95 and asynchronous 0.94 on PoisonRAG, synchronous 0.94 and asynchronous 0.93 on HotPotQA, and the same as CSQA on GSM8K.)
- Authors' interpretation: the authors report that AcMAS achieves F1 of 0.92–0.95 across five scenarios in both modes (std ≤ 0.04), higher than G-Safeguard (average 0.72) and BlindGuard (average 0.56), with AUROC 98.5–99.5 and FPR 0.04–0.07.
- Asynchronous robustness: the authors report that G-Safeguard's F1 drops in asynchronous mode, whereas AcMAS's performance is nearly unchanged; the abstract gives the asynchronous comparison as 0.93 vs. 0.38 (+0.55 F1).
- Defense effectiveness (Table 2): without defense, ASR is 0.85–0.91; AcMAS achieves TCR 0.96–1.00 and ASR 0.02–0.05 across scenarios; the authors report that isolation-based defenses reduce TCR on HotPotQA from 0.96 to 0.68 (G-Safeguard) and 0.66 (BlindGuard).
Generalization (Section 4.3)
- What was tested: detection accuracy across four LLM backbones × 8–80 agent scale (Figure 3).
- Results: the authors report detection accuracy >97% on all backbones, standard deviation <0.8%;Figure 3 的纵轴为 Accuracy (%),范围 90.0–100.0,图中具体数值标注在文本转换中不可读。
- 作者解读:作者称恶意推理模式在不同架构的激活空间中一致显现,且拓扑无关设计带来可扩展性。
任务表现与案例(附录 F.1、E.1)
- 测了什么:CSQA/GSM8K 准确率与 HotPotQA EM/F1 在不同防御下的表现(Table 6)。
- 结果:AcMAS 接近 Clean 上界(CSQA 98.6% vs. Clean 98.9%;GSM8K 81.3% vs. 82.8%;HotPotQA EM 61.9 vs. 62.1),G-Safeguard 为 78.9%/63.9%/35.5,BlindGuard 为 73.5%/58.1%/33.2;Attack-only 下界为 16.1%/9.0%/4.4。
- 作者解读:作者称纠正式防御在降低 ASR 的同时保住了任务效用,附录 E.1 用 HotPotQA 三智能体案例说明隔离会打断推理链而纠正不会。
其他消融与分析
- 消融(Table 3,HotPotQA 同步、gpt-oss-20b):去掉自适应更新 F1 0.95→0.87;去掉归一化 F1→0.89;纠正换隔离 TCR 0.98→0.68、ASR 0.05→0.15;取早期层(1–4)F1→0.71,中间层(10–14)F1 0.86。
- 阈值灵敏度(4.5 节、Figure 4):τdetect = 0.12 时 F1 0.95;τ = 0.08 时 FPR 0.12,τ = 0.16 时 FNR 0.15;[0.10, 0.14] 内 F1 保持 0.92 以上。
- 攻击强度:50% 智能体被攻陷前 F1 > 0.90 and TCR > 0.90 under scale variation; at 75% compromise, TCR is 0.82, still higher than the isolation baseline's 0.52 (per the authors).
- Number of benign trajectories (Figure 5): F1 rises between 5–20 and stabilizes after about 50, with the gap from the default value of 100 being less than 0.03 on each dataset.
- Efficiency (Table 4, single A100): activation extraction 2.3ms (0.15%), distance computation <1ms (<0.07%), detection totaling 0.22% of inference time; correction (steering regeneration) 185.3ms (12.4%), triggered only for compromised agents.
- Domain shift (Appendix F.2): CSQA→InjecAgent with only the source-domain prototype gives F1 0.49 and FPR 1.00; after increasing target-domain benign trajectories to 1:2, F1 is 0.86, and at 1:3 it is 0.92; CSQA→PoisonRAG reaches F1 0.83 already at 1:1.
What are some points that can be further explored?
The authors list four directions: domain shift, adaptive attacks, the activation access assumption, and heterogeneous backbones; experiments cover four open-source backbones and five scenarios.
Limitations and future directions noted by the authors
- Domain shift (Section 5): AcMAS relies on learned representations to construct benign prototypes, and distribution mismatch exists under domain shift; the authors state that adding a small number of target-domain benign trajectories can recover it, with 50–100 trajectories sufficient to lightly re-estimate the centroids, and list domain-adaptive prototype construction as a future direction.
- Adaptive attacks (Section 5): Adaptive attacks that gradually shift the activation distribution remain an open challenge; the authors propose an anomaly-gated update rule as a possible mitigation and leave robust defenses against adaptive adversaries for future work.
- Activation access assumption (Section 5, Appendix C): The threat model requires access to internal activations; the authors consider this consistent with cost/privacy-aware MAS deployments that place safety-critical subtasks on local open-weight models, but this assumption does not apply to all real-world scenarios.
- Heterogeneous-backbone MAS (Appendix B.3): The current evaluation is limited to homogeneous MAS in which all agents within the same system share the same backbone; extending to heterogeneous MAS in which different agents in the same execution use different backbones is listed as future work.
Scope of experimental coverage
- Models tested: 4 open-source backbones in total: GPT-OSS-20B, DeepSeek-V3, LLaMA3-8B, and Qwen3-30B-A3B; the main tables (Table 1, 2) are all on gpt-oss-20b, and the other backbones appear only in the detection accuracy in Figure 3.
- Attacks and benchmarks: three types of attacks (S-PI, TA, MA) across five scenarios in total (CSQA, GSM8K, InjecAgent, PoisonRAG, HotPotQA), each with both synchronous and asynchronous modes.
- Scale and intensity: MAS scale of 8–80 agents; the main experiments use an attack intensity of 0–40% compromised proportion, and the sensitivity analysis extends to 50% and 75%.
- Baselines: 4 in total: G-Safeguard, BlindGuard, PERM, and TAM; the defense effectiveness comparison (Table 2, 6) includes only G-Safeguard and BlindGuard.
- Not reported in the paper: sample size for each dataset, number of experimental repetitions, measured results under adaptive attacks (discussion only); Figure 3 reports only detection accuracy and does not give F1/ASR breakdowns for each backbone.
Summarize the main content of the paper
AcMAS uses activation divergence to detect compromised agents in MAS and performs activation-level correction; the authors report that its advantage is greatest in asynchronous scenarios.
A MAS security defense paper proposing an activation-level detection and correction framework, AcMAS, aimed at semantically stealthy attacks and asynchronous execution—two scenarios the authors consider existing graph defenses unable to cover.
- Problem addressed: Existing MAS defenses assume attack semantics are explicit, execution is globally synchronous, and isolation is used for mitigation; the authors argue these three assumptions do not hold in real MAS—attacks can hide under benign appearances, asynchronous execution has no global rounds, and removing key agents causes task collapse.
- Method highlights: The hidden state of the last token in the last layer of each agent LLM is taken as the reasoning state representation, and cosine divergence from normal prototypes built from benign trajectories is used for detection (threshold τdetect = 0.12); after detection, activations are adaptively steered back toward the prototype according to the magnitude of divergence and the response is regenerated, correcting rather than isolating; in synchronous mode prototypes are adaptively updated with momentum 0.7, while asynchronous mode uses fixed prototypes.
- Main results (gpt-oss-20b, Table 1, 2): across five attack scenarios, average F1 is 0.95 synchronous and 0.94 asynchronous, compared with 0.72 and 0.46 for G-Safeguard; average TCR 0.98, average ASR 0.04, while isolation baselines have average TCR of 0.83 (G-Safeguard) and 0.78 (BlindGuard).
- Generalization and cost: The authors report detection accuracy >97% on all four open-source backbones, with standard deviation <0.8% at scales of 8–80 agents; detection overhead accounts for 0.22% of inference time, and correction is triggered only for compromised agents, accounting for 12.4% (Table 4).
- Authors' conclusion: The authors state that this work shifts MAS security from topology graph analysis to activation-level modeling of internal reasoning, enabling the system to self-correct without sacrificing the collaboration structure; they also acknowledge domain shift, adaptive attacks, and the activation access assumption as open problems.