Introduction
As Large Language Model (LLM) agents transition from isolated tools to collaborative Multi-agent Systems (MAS), they increasingly rely on shared memory, tool-use, and inter-agent dialogue to solve complex tasks. While this interconnectedness enhances problem-solving capabilities, it introduces a significant security vulnerability: topological misinformation propagation. In these environments, a single compromised agent—whether through prompt injection, poisoned tools, or corrupted memory—can act as a vector, spreading malicious intent or misinformation throughout the entire network.
Existing security frameworks, such as LlamaGuard, typically focus on individual input/output pairs in isolation. These "point-of-entry" defenses fail to account for the structural dynamics of a network, leaving MAS vulnerable to sophisticated attacks that exploit the flow of information. To address this, we present G-Safeguard, a novel security framework that treats MAS security as a graph-based contagion problem, providing both a diagnostic lens and a therapeutic treatment for compromised systems.
The G-Safeguard Framework
G-Safeguard shifts the defensive paradigm from content filtering to topological intervention. The framework operates through a three-phase pipeline designed to detect and neutralize threats within the communication network.
1. Multi-agent Utterance Graph (MUG) Construction
The system first models the MAS as a dynamic Multi-agent Utterance Graph (MUG). In this representation, nodes represent individual agents, and edges represent the history of their interactions. To capture the semantic nuance of these interactions, textual messages are converted into high-dimensional embeddings using SentenceBERT. This allows the system to maintain a structural and semantic record of how information moves between entities.
2. Graph-based Attack Detection
Detection is handled by an edge-featured Graph Neural Network (GNN). Unlike traditional classifiers that analyze messages in a vacuum, the GNN evaluates both the message content and the structural dependencies between agents. By analyzing the "path of infection," the GNN assigns an attack probability to each agent, identifying those that have been compromised or are serving as carriers for toxic information.
3. Topological Intervention (Remediation)
Once a high-risk agent is identified, G-Safeguard implements a "quarantine" strategy via graph pruning. The system strategically severs the outgoing edges of the compromised agent for subsequent dialogue rounds. This effectively silences the attacker and prevents the further spread of misinformation without requiring a full system shutdown, allowing the remaining healthy agents to continue their task.
Inductive Learning and Scalability
A critical technical advantage of G-Safeguard is its use of inductive learning. Because GNNs can learn structural patterns that are independent of specific node counts, the framework exhibits remarkable scalability. G-Safeguard can be trained on a relatively small system (e.g., 8 agents) and successfully deployed on much larger systems (e.g., 80 agents) without retraining. This makes it uniquely suited for modern MAS, where the number of agents and network structures may change dynamically.
Experimental Evaluation
The researchers evaluated G-Safeguard across a variety of benchmarks and network topologies, including Chain, Tree, Star, and Random structures. The testing suite included:
- General Reasoning: CSQA, MMLU, and GSM8K.
- Adversarial Scenarios: Indirect prompt injections (via InjecAgent) and memory poisoning (via PoisonRAG).
Key Results
- Performance Recovery: In the presence of prompt injection attacks, G-Safeguard recovered over 40% of the performance loss compared to undefended systems.
- Attack Success Rate (ASR) Reduction: On the MMLU benchmark, the framework reduced the ASR by approximately 22% for prompt injections and 16% for memory poisoning.
- Cross-Model Generalization: The defense demonstrated robust transferability. A G-Safeguard model trained on data from GPT-4o-mini effectively protected systems running on more powerful models like Llama-3 or DeepSeek, suggesting that the structural patterns of adversarial behavior are consistent across different LLMs.
- Real-world Application: When integrated into the CAMEL multi-role framework, G-Safeguard achieved an attacker identification accuracy exceeding 80%, preventing system collapse during complex, multi-turn debates.
Discussion and Limitations
G-Safeguard introduces a vital "topology-aware" perspective to MAS security, yet it is primarily a reactive defense. It is designed to identify and contain an attack once it has manifested within the graph; it does not preemptively block the initial compromise of the first agent. Furthermore, the system's efficacy is tied to the volume of communication; subtle attackers who communicate sparingly may provide fewer data points for the GNN to analyze.
Future research will focus on proactive prevention strategies to complement this topological treatment, as well as exploring defenses for highly dynamic environments where agent relationships and roles shift in real-time. By viewing MAS security through the lens of graph intelligence, G-Safeguard provides a scalable and effective path toward more resilient autonomous systems.
Summary updated