arXiv:2610.35071cs.CROct 2026

Manuscript Offprint

arXiv:2610.35071

GuardRAG: A Post-Retrieval Defense against Poisoning Attacks in Retrieval-Augmented Generation

Linghui Jiao, Kang Wei, Fushuo Huo, Ruijie Zhao, Yiyang Ni, Jingcai Guo, Yipeng Zhou, Jun Li

Abstract

Retrieval-Augmented Generation (RAG) enhances the factual grounding of Large Language Models (LLMs) by incorporating external evidence, but also exposes them to corpus poisoning attacks. In particular, coordinated attacks can introduce multiple mutually reinforcing poisoned documents into retrieved contexts, making reliable evidence filtering challenging. To address this problem, we propose GuardRAG, a training-free and plug-and-play post-retrieval defense that exploits the semantic structure of retrieved evidence to identify suspicious document groups. Specifically, GuardRAG first expands the retrieval range and removes near-duplicate candidates, then partitions the retained documents using Hierarchical Agglomerative Clustering (HAC) with a query-adaptive threshold. Finally, it scores and prunes suspicious clusters based on query relevance, cluster size, and semantic compactness. Experiments across three question-answering datasets, multiple poisoning attacks, and six LLMs demonstrate that GuardRAG substantially reduces attack success rates while maintaining answer utility under clean retrieval.

1 Introduction

Large Language Models (LLMs) have demonstrated remarkable performance across a wide range of knowledge-intensive tasks, including open-domain question answering and multi-step reasoning. However, hallucination issues and the limitations of static parametric knowledge fundamentally constrain their practical capabilities (Huang et al., 2025; Sahoo et al., 2024). Retrieval-Augmented Generation (RAG) addresses these limitations by incorporating external corpora, enabling LLMs to access supporting evidence beyond their parametric memory (Lewis et al., 2020).

However, reliance on external corpora exposes RAG systems to security threats, particularly corpus poisoning attacks that manipulate retrieved evidence to influence downstream generation (Zou et al., 2025; Su et al., 2025; Zhang et al., 2025; Xue et al., 2024; Cheng et al., 2024). In such attacks, adversaries inject malicious passages into external knowledge sources and optimize their relevance to target queries, increasing the likelihood that poisoned evidence will be retrieved. Since RAG systems often rely on large-scale or continuously updated corpora, verifying the trustworthiness of every document before retrieval is impractical. This motivates defenses that identify and filter poisoned evidence after retrieval but before generation.

To counter corpus poisoning, existing RAG defenses employ strategies such as robust aggregation (Xiang et al., 2024), reliability-aware scoring (Shen et al., 2025), knowledge consolidation (Wang et al., 2025), and self-reflective generation (Asai et al., 2023). However, high-intensity coordinated poisoning poses a particular challenge: multiple poisoned documents can reinforce the same attacker-specified misinformation and dominate the retrieved evidence, making conventional evidence aggregation and reliability assessment less effective. This motivates examining the collective structure of retrieved documents rather than assessing each passage independently.

To address this challenge, we introduce GuardRAG, a training-free and plug-and-play post-retrieval defense framework designed to defend RAG systems against coordinated corpus poisoning attacks. As illustrated in Figure 1, while standard RAG is easily misled by poisoned documents, GuardRAG mitigates attacks by shifting the focus from individual document assessment to group-level pattern detection. Specifically, our framework follows a three-stage pipeline: it first expands the retrieval range and removes near-duplicate candidates, then employs adaptive semantic clustering.

User query: what day is groundhog's day?

Figure

Figure 1: Comparison between vanilla RAG and GuardRAG under corpus poisoning attacks. While vanilla RAG can be misled by poisoned retrieved documents, GuardRAG mitigates such attacks through retrieval expansion and deduplication, adaptive semantic clustering, and suspicious cluster pruning before generation.

to group semantically consistent documents, and finally prunes suspicious clusters prior to the generation phase.

Our contributions can be summarized as follows:

• We identify a characteristic structural pattern of coordinated corpus poisoning: retrieved poisoned documents tend to exhibit stronger local semantic concentration than benign evidence in the embedding space.

• We propose GuardRAG, a training-free, plug-and-play post-retrieval defense that filters coordinated poisoned evidence through three stages: retrieval expansion with deduplication, adaptive semantic clustering, and suspicious-cluster pruning.

• We evaluate GuardRAG across three datasets, multiple retrievers, six generators, and several poisoning strategies, demonstrating substantially lower attack success while preserving answer utility under standard clean retrieval.