Differentially Private Synthetic Text Generation for Retrieval-Augmented Generation (RAG)

Junki Mori, Kazuya Kakizaki, Taiki Miyagawa, Jun Sakuma · DOI

Introduction

Retrieval-Augmented Generation (RAG) has emerged as a powerful technique to ground Large Language Models (LLMs) in domain-specific knowledge. By retrieving relevant documents from a database to inform model responses, RAG improves accuracy and reduces hallucinations. However, this process introduces significant privacy risks when the underlying data contains sensitive information, such as medical records or private user profiles. Standard RAG systems are susceptible to extraction attacks, where the model's output may inadvertently leak private details from the retrieved context. Current solutions often rely on query-time Differential Privacy (DP), which consumes a finite privacy budget ($\epsilon$) with every interaction, eventually leading to a trade-off between privacy and utility as the system scales.

The DP-SynRAG Framework

To address these privacy concerns without the performance degradation typical of query-time methods, the authors propose DP-SynRAG. This framework generates a differentially private synthetic version of the sensitive database. Once the synthetic database is created, it can be queried indefinitely without further privacy loss, as the privacy guarantees are inherent to the data itself. This effectively turns the inference phase into a "post-processing" step in DP terms, which does not incur additional privacy costs.

The DP-SynRAG two-stage pipeline for generating private synthetic databases.

The pipeline consists of two main stages:

  1. Stage 1: Soft Clustering: The system identifies representative keywords via an LLM to create a noisy histogram. Documents are then "soft-clustered" based on these keywords. Unlike "hard clustering," which assigns a document to only one group, soft clustering allows for overlap, which the authors found essential for maintaining coherence in the generated text. To ensure semantic consistency, DP-protected mean embeddings are used to filter outliers, preserving local factual details rather than just global dataset averages.
  2. Stage 2: Synthetic Text Generation: For each cluster, an LLM rephrases the documents using a "subsample-and-aggregate" approach. Logits from different subsets are combined and sampled via an exponential mechanism to provide formal DP guarantees. A final self-filtering step uses an LLM as a quality controller to discard low-quality synthetic snippets that lack utility for the target task.

Experimental Evaluation

The framework was evaluated across three diverse domains to test its versatility:

  • Medical Synth: A dataset of 8,000 fictitious medical records where the task is to diagnose a disease based on symptoms.
  • Movielens-1M: User profiles and movie ratings converted into natural language descriptions to test recommendation capabilities.
  • SearchQA: A standard RAG benchmark consisting of Jeopardy!-style questions and search snippets.

Results and Scalability

A primary advantage of DP-SynRAG is its scalability. Traditional "Private RAG" methods (DP-RAG) inject noise at query time, causing accuracy to plummet as the privacy budget is exhausted. In contrast, DP-SynRAG maintains stable, high-utility performance regardless of the query volume.

Accuracy vs. Number of Queries across three benchmark datasets.

As shown in the experimental results, DP-SynRAG outperformed existing synthetic generation methods because its clustering mechanism better preserved specific knowledge. On the Medical Synth dataset using Llama-3.1-8B, DP-SynRAG achieved approximately 67% accuracy, significantly outperforming DP-RAG after only a few queries. Furthermore, the framework demonstrated lower leakage rates in targeted attacks designed to extract sensitive patient names compared to standard RAG systems.

Conclusion

DP-SynRAG offers a robust solution for privacy-preserving RAG by shifting the privacy protection from the query phase to the data generation phase. While the method requires a degree of data redundancy and necessitates regeneration for database updates, it provides a scalable path for deploying LLMs on sensitive datasets without compromising user privacy or system utility. Future work may explore more efficient ways to handle dynamic database updates without full regeneration.

Summary updated

BibTeX
@misc{mori2025differentially,
  author = {Junki Mori and Kazuya Kakizaki and Taiki Miyagawa and Jun Sakuma},
  title = {{Differentially Private Synthetic Text Generation for Retrieval-Augmented Generation (RAG)}},
  year = {2025},
  eprint = {2510.06719},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2510.06719},
}
Figure