Safeguarding Privacy of Retrieval Data against Membership Inference Attacks: Is This Query Too Close to Home?

Yujin Choi, Youngjoo Park, Junyoung Byun, Jaewook Lee, Jinseong Park · DOI

Introduction

Retrieval-Augmented Generation (RAG) has emerged as the standard architecture for enhancing Large Language Models (LLMs) with external, often private, knowledge. By allowing models to "look up" relevant documents from a database before generating a response, RAG improves accuracy and reduces hallucinations. However, this retrieval mechanism introduces a significant privacy vulnerability: Membership Inference Attacks (MIAs). In an MIA, an attacker attempts to determine if a specific sensitive document—such as a medical record or proprietary code—exists within the RAG system's private database.

The Vulnerability of RAG

Current defenses against MIAs generally fall into two categories, both of which suffer from significant drawbacks. Agent-based filtering uses a secondary LLM to audit incoming queries, but this is computationally expensive and easily bypassed by "stealthy" queries that mimic benign requests. Alternatively, Differential Privacy (DP) adds mathematical noise to the retrieval process. While theoretically secure, DP often severely degrades the utility of the system, causing the quality of generated answers to plummet.

Mirabel: A Detect-and-Hide Defense

To address these limitations, we introduce Mirabel (MIA in RAG systems using Gumbel), a lightweight, system-agnostic defense strategy. Mirabel operates on a "detect-and-hide" principle that identifies malicious queries based on their statistical signatures without requiring model retraining or significantly impacting system performance.

Overview of the Mirabel system architecture, illustrating the detect-and-hide mechanism within the RAG pipeline.

As shown in the architecture above, Mirabel integrates directly into the retriever. When a query is received, the system calculates similarity scores for all documents. If a query is flagged as a potential attack, the system does not block the user—which would alert the attacker—but instead hides the "too-close" document and proceeds with the next best matches.

Statistical Foundations

The core innovation of Mirabel lies in its use of Extreme Value Theory. The researchers observed that benign queries typically relate to a broad context, resulting in similarity scores that follow a predictable distribution. In contrast, a membership inference query is designed to be extremely similar to exactly one target document, making it a statistical outlier.

Similarity distributions for benign and attack queries, showing how the Gumbel threshold effectively separates member queries.

Mirabel uses the Gumbel distribution to model the expected maximum similarity score for any given query. By calculating a dynamic threshold for every request, the system can identify when a top-1 similarity score significantly exceeds what is statistically expected for a benign interaction. This approach is particularly effective against "Interrogation Attacks" (IA), which use complex phrasing to deceive semantic filters but cannot hide the raw vector similarity to the target document.

Experimental Results

Mirabel was evaluated across several sensitive benchmarks, including the NFCorpus, SciDOCS, and TREC-COVID datasets, as well as general utility benchmarks like Natural Questions (NQ) and TriviaQA.

  • Detection Performance: Against stealthy Interrogation Attacks, where traditional agent-based defenses achieved nearly 0% recall, Mirabel successfully detected 70-81% of attacks.
  • Privacy Protection: The defense reduced Adjusted Attack Accuracy from as high as 0.40 to near-zero levels (0.004 to 0.08), effectively neutralizing the attacker's advantage.
  • Utility Preservation: Unlike DP-RAG, which saw Exact Match scores drop from ~0.27 to ~0.03, Mirabel maintained performance nearly identical to an undefended RAG system. Legitimate users receive the information they need, while sensitive outliers remain protected.

Conclusion

Mirabel demonstrates that effective privacy defense in RAG systems does not require a trade-off with utility. By leveraging the statistical properties of similarity scores and Extreme Value Theory, Mirabel provides a robust, efficient, and stealth-resistant shield for private databases. Future work will focus on optimizing performance for massive-scale vector databases and extending these protections to multi-modal retrieval systems.

Summary updated

BibTeX
@misc{choi2025safeguarding,
  author = {Yujin Choi and Youngjoo Park and Junyoung Byun and Jaewook Lee and Jinseong Park},
  title = {{Safeguarding Privacy of Retrieval Data against Membership Inference Attacks: Is This Query Too Close to Home?}},
  year = {2025},
  eprint = {2505.22061},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2505.22061},
}
Figure