Manuscript Offprint

arXiv:2609.11758

RAG-Safety-Bench: Reliable Evaluation of Retrieval-Augmented LLM Safety

Adithiyan Rajan Indira Saravanan, Kathleen C. Fraser

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Allowing large language models (LLMs) to retrieve information from a set of trusted documents can increase reliability and reduce hallucination. However, recent work has demonstrated that retrieval-augmented generation (RAG) can have unintended side effects on the overall safety of the generated responses, when prompted for harmful or dangerous content. A clearer understanding of the mechanisms leading to this result is needed, as increasing numbers of end users turn to RAG to incorporate corporate documents and knowledge bases into LLM-based systems. We introduce RAG-Safety-Bench, a benchmark to measure the safety impact of RAG on LLM models. By removing the confounding effect of retriever quality, and cleanly separating the problem into four conditions – non-RAG, RAG with an oracle document containing the answer to the harmful request, RAG with documents related to the harmful request but without the specific answer, and RAG with random, safe documents – the benchmark isolates the impacts of different factors in the observed safety degradation. We report results across five open-source LLMs, showing an inverse relationship between benign and unsafe capability, strong evidence that baseline safety guardrails do not lead to downstream safety guarantees in the RAG case, and model-specific support for previous findings that even benign documents can lead to unsafe generation in retrieval-enabled systems.

1 Introduction

Retrieval-augmented generation, or RAG, is a widely adopted approach for grounding large language models in external information (Lewis et al., 2020). Retrieved documents can provide up-to-date facts, reduce reliance on stale parametric memory, and improve answer quality without retraining the generator. Furthermore, RAG can improve

Figure

Figure 1: The four conditions in RAG-Safety-Bench allow for detailed safety evaluation of RAG-enabled systems.

trustworthiness and accuracy by reducing hallucinations, relative to non-RAG LLMs (Shuster et al., 2021). For these reasons, conventional wisdom would suggest that RAG-based LLMs should be safer than non-RAG models, with the primary security risk being data poisoning attacks on the RAG corpus. In the absence of poisoned data, there would be little reason to suspect a RAG system would output more harmful content than its base LLM component.

However, this assumption has been upended by recent work from An et al. (2025), who presented compelling evidence that when LLMs are enabled with RAG they are generally less safe than when relying on their parametric knowledge, even when the retrieved documents are benign. In the current work, we contribute to the understanding of this newly-identified problem by disentangling the notions of safety and capability through a new RAG-specific safety benchmark, RAG-Safety-Bench. Furthermore, we take a closer look at what it means for documents and outputs to be “unsafe,” to support more detailed analysis of the problematic case where safe RAG documents appear to lead to unsafe outputs.

RAG systems are challenging to evaluate because they are composed of multiple components, each of which contributes to the overall end-to-end performance of the system (Wampler et al., 2025). In particular, the retrieval quality can have a major impact on the quality of the output. The MIRAGE benchmark (Park et al., 2025) enables the evaluation of RAG systems while controlling for retrieval quality by providing sets of relevant and irrelevant oracle documents.

We modify and extend this style of evaluation to safety evaluation in the RAG setting. Our RAG-Safety-Bench benchmark consists of a set of unsafe English queries and three sets of documents (Figure 1): in the oracle setting, the unsafe answer is available in the document set. This setting could represent a data-poisoning attack – however, since we sourced all of our data from Wikipedia, it also represents the more common case that the data is believed to be generally benign but has not been meticulously curated. In the on-topic setting, the documents are relevant to the topic of the query but do not explicitly contain the unsafe answer. In the random setting, randomly-selected documents on safe topics are provided.

This testing framework allows us to answer several key open research questions relating to the safety of RAG systems:

  1. To what extent is the observed RAG safety decline correlated with a model’s RAG capability? Previous work suggests that some models which appear “safe” may simply be less capable of extracting and summarizing relevant information. We test this rigorously, and hypothesize the following (H1): Models which perform better on MIRAGE (benign capability) will also have higher accuracy and therefore lower safety in the oracle setting of RAG-Safety-Bench.

  2. Is RAG safety decline a factor of unsafe information or unsafe context drift? The conventional view, challenged by An et al. (2025), is that RAG models are less safe only when the documents they retrieve are unsafe. An alternative explanation is that the increased context length, possibly containing many words semantically related to the unsafe query, shift the models into a less-aligned domain. 1^{1} Our hypothesis (H2) is that the direct availability of the answer (oracle setting) will lead to the highest number of unsafe answers, but that the on-topic setting will lead to a higher number of unsafe answers relative to the baseline non-RAG setting, due to the destabilizing effect of the harmful-topic context. If the effect is purely due to context length, the random setting will lead to an equivalent harmfulness rate.

  3. What is the impact of RAG on the refusal rate of LLMs? In many studies, safety is operationalized as refusal: a safe model is one which refuses to answer harmful questions. We distinguish between two varieties of refusal; namely, unwillingness to fulfill a harmful request versus inability to find the answer in the retrieved documents. We hypothesize (H3) that the refusal rate for harmful requests will be highest in the random setting, and attributed to a lack of information. We argue that this case should be distinguished from “true” model safety, which should rely on an inherent unwillingness to provide dangerous advice. At the same time, the oracle setting offers contrasting evaluation in which we ensure the model has access to the requested information, so refusal can be more clearly interpreted as effective implementation of safety guardrails.

  4. Do different safety evaluators agree on what is safe versus harmful? Standard safety evaluation relies on LLM-based “judges” to label text as safe or unsafe. We compare multiple safety evaluators, with the hypothesis (H4) that there will be a high level of disagreement between the LLM evaluators.

RAG-Safety-Bench is freely available for research use at the following URL: https://github.com/The-Safe-AI-Lab/RAG-Safety-Bench.

References (11)