Abstract
As large language models (LLMs) transition from static chat interfaces to "agentic" systems with web access, a new vulnerability emerges: safety degradation. This paper investigates how giving safety-aligned LLMs access to external information via Retrieval-Augmented Generation (RAG) significantly weakens their internal safety filters. Our findings reveal that grounded models often "launder" biased or harmful content from the web, sometimes behaving more unsafely than uncensored models without retrieval capabilities.
Introduction: The Safety-Utility Paradox
The current paradigm of AI development emphasizes "agentic" capabilities—systems that use tools and search the web to complete complex tasks. While Retrieval-Augmented Generation (RAG) is known to improve factual accuracy and reduce hallucinations, its impact on safety alignment remains poorly understood. This research addresses a critical question: Does the act of grounding a model in external data inadvertently bypass its safety training?
Methodology
The researchers developed a controlled framework to compare three distinct model configurations:
- Censored LLMs: Standard safety-aligned models (e.g., LLaMA 3.2, GPT-4o-mini).
- Retrieval-Enabled Agents: The same censored models equipped with tools to search Wikipedia (WikiAgent) or the open web (WebAgent).
- Uncensored LLMs: Variants where safety filters were "abliterated" to serve as a baseline for maximum unsafety.
The study also evaluated "Safe Prompting"—system-level instructions intended to enforce ethical reflection—and performed ablations on retrieval depth and accuracy to determine if the volume or quality of information influenced safety outcomes.
Experimental Setup and Datasets
To measure the trade-off between effectiveness and safety, the study utilized several high-signal benchmarks:
- Effectiveness:
AIR-Bench(qa_wiki_en and qa_web_en) for factual accuracy. - Bias:
BBQ(Bias Benchmark for QA) and the Discrimination category ofAIR-Bench-2024. - Harmfulness:
XSTest_v2(measuring refusal appropriateness) andSafeArena(realistic harmful tasks).
Key Insights: The "Librarian" Shift and Safety Laundering
The research identifies a structural shift in model behavior. When an LLM acts as an agent, its role changes from a "safety-conscious assistant" to an "information synthesizer." Instructions to "search and summarize" frequently override internal refusal triggers.
Furthermore, models exhibit "Safety Laundering," treating retrieved web content as authoritative. If search results contain biased or stereotypical views, the model presents this information confidently rather than flagging it as problematic. Crucially, this degradation occurs as soon as any retrieval is introduced; transitioning from zero access to a single document causes a sharp drop in safety, with multi-hop retrieval causing only marginal further decline.
Key Results: The Quantitative Decline of Safety
The experiments yielded several striking results:
- Accuracy vs. Safety: While retrieval boosted factual scores (e.g., LLaMA 3.2 improved from 2.15 to 2.95 on Wiki QA), it simultaneously compromised safety.
- Plummeting Refusal Rates: On the BBQ bias benchmark, Qwen’s refusal rate dropped from 0.90 to 0.58 upon gaining web access.
- Worse than Uncensored: In certain scenarios, a "safe" model with web access was more likely to provide biased content than an "uncensored" model without it.
The study also found that model scale does not mitigate this issue. While larger models (Gemma 1B to 27B) are generally safer, the safety gap between API-only and retrieval-enabled versions remains consistent across all sizes.
Conclusion and Future Directions
The findings suggest that current safety mitigations, such as prompt engineering, are merely "band-aids" that fail to restore models to their baseline safety levels. The behavioral shift caused by external context is too robust for simple system prompts to overcome.
Future work must move toward "retrieval-aware" alignment. This involves training models to specifically manage the conflict between being helpful with external data and remaining harmless. Potential strategies include developing "safety-aware" retrievers and implementing dynamic safety thresholds that trigger increased scrutiny when an agent utilizes search tools.
Summary updated