GRADA: Graph-based Reranking against Adversarial Documents Attack

J. P. Zheng, Aryo Pradipta Gema, Giwon Hong, Xuanli He, Pasquale Minervini, Youcheng Sun, Qiongkai Xu

Abstract

Retrieval Augmented Generation (RAG) frameworks can improve the factual accuracy of large language models (LLMs) by integrating external knowledge from retrieved documents, which is useful for overcoming the limitations of models' static intrinsic knowledge. However, these systems are susceptible to adversarial attacks that manipulate the retrieval process by introducing documents that are adversarial yet semantically similar to the query. Notably, while these adversarial documents resemble the query, they exhibit weak similarity to benign documents in the retrieval set. Thus, we propose a simple yet effective Graph-based Reranking against Adversarial Document Attacks (GRADA) framework aimed at preserving retrieval quality while significantly reducing the success of adversaries. Our study evaluates the effectiveness of our approach through experiments conducted on six LLMs, including GPT-3.5-Turbo. We use three datasets to assess performance, with results from the Natural Questions dataset showing up to an 80% reduction in attack success rates while maintaining minimal loss in accuracy.

Introduction

Retrieval-Augmented Generation (RAG) has emerged as a standard architecture for grounding Large Language Models (LLMs) in external, verifiable facts. By fetching relevant context from a curated corpus, RAG systems significantly reduce hallucinations and allow models to access information beyond their training cutoff. However, this reliance on external retrieval introduces a critical security vulnerability: adversarial document attacks.

In these attacks, a malicious actor injects "poisoned" documents into the knowledge base. These documents are engineered to exploit the retriever's reliance on semantic similarity. A common technique involves prepending a likely user query to misinformation (e.g., "Who is the CEO of Apple? The current CEO of Apple is Elon Musk"). Because the document contains the exact query, it is often ranked as the most relevant result. The LLM, trusting the retrieved context, then generates a false response. Existing defenses, such as keyword filtering or LLM-based verification, are often either easily bypassed or too computationally expensive for real-time applications.

Methodology: The GRADA Framework

To counter these threats, we introduce GRADA (Graph-based Reranking against Adversarial Document Attacks). The core insight behind GRADA is that while adversarial documents are highly similar to the user's query, they are typically semantic "outliers" relative to the broader set of benign documents that cover the same topic.

Comparison between a Vanilla RAG pipeline and the GRADA framework.

The GRADA framework operates in three distinct stages:

  1. Graph Construction: GRADA takes the top $M$ documents retrieved by the initial system and represents each as a node in a similarity graph. Edges are drawn between nodes based on their mutual semantic similarity.
  2. Hybrid Relevance Similarity (HRSIM): Standard similarity metrics can be fooled if two documents both repeat the query verbatim. HRSIM addresses this by introducing a penalty term that weakens the connection between documents if their similarity is primarily driven by query overlap. This prevents multiple adversarial documents from "colluding" to dominate the graph.
  3. Iterative Reranking: Inspired by Google’s PageRank algorithm, GRADA propagates relevance scores across the graph. Benign documents tend to form dense clusters because they share a rich semantic context. These documents effectively "vote" for one another, maintaining high scores. Conversely, adversarial documents—which lack deep semantic ties to the truth—become isolated and see their scores diminish over successive iterations.

Finally, the system filters the reranked list, providing only the most "voted-for" documents to the LLM for generation.

Experimental Setup and Results

We evaluated GRADA using three benchmark datasets: Natural Questions (NQ), MS-MARCO, and HotpotQA. The framework was tested against a variety of attack vectors, ranging from simple query-prepending to sophisticated "white-box" attacks like Hotflip and Phantom.

Performance and Defense

The experimental results demonstrate that GRADA is highly effective at neutralizing adversarial content. On the Natural Questions dataset, GRADA achieved up to an 80% reduction in the Attack Success Rate (ASR) compared to an undefended vanilla RAG pipeline.

Impact of different M values on Attack Success Rate (ASR) and Exact Match (EM).

As illustrated in the results, the parameter $M$ (the number of initial documents considered for the graph) plays a crucial role. When $M$ is sufficiently large (e.g., $M \ge 2n$), GRADA has more context to identify the benign cluster, leading to a dramatic drop in the percentage of poisoned documents reaching the LLM and a corresponding increase in the Exact Match (EM) score.

Efficiency and Comparison

Unlike LLM-based filtering methods, which can be slow and costly, GRADA’s graph-based computations are purely numerical. This allows the framework to operate approximately 10x faster than LLM-based alternatives, adding negligible latency to the production pipeline. Furthermore, GRADA consistently outperformed other state-of-the-art rerankers, such as BGE-reranker, which proved surprisingly vulnerable to adversarial manipulation.

Conclusion and Future Work

GRADA provides a robust, efficient defense against adversarial document attacks by shifting the focus from query-document similarity to document-document coherence. While the system shows great promise, challenges remain in multi-hop reasoning tasks where benign documents are naturally more diverse. Future work will explore adaptive retrieval strategies to further harden RAG systems against sophisticated, large-scale poisoning attempts.

Summary updated

BibTeX
@misc{zheng2025grada,
  author = {J. P. Zheng and Aryo Pradipta Gema and Giwon Hong and Xuanli He and Pasquale Minervini and Youcheng Sun and Qiongkai Xu},
  title = {{GRADA: Graph-based Reranking against Adversarial Documents Attack}},
  year = {2025},
  eprint = {2505.07546},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2505.07546},
}
Figure