P$^2$RAG: Efficient Privacy-Preserving RAG Service Supporting Arbitrary Top-k Retrieval

Yulong Ming, Mingyue Wang, Jijia Yang, Jie Xu, Zihan Wu +2 more
3/16/2026
cs.CRcs.AI
rag

No confident code implementation found for this paper.

Abstract

Retrieval-Augmented Generation (RAG) enables large language models to use external knowledge, but outsourcing the RAG service raises privacy concerns for both data owners and users. Privacy-preserving RAG systems address these concerns by performing secure top-$k$ retrieval, which is typically implemented using secure sorting to identify relevant documents.

Show full abstract

However, existing systems face challenges supporting arbitrary $k$ due to their inability to change $k$, new security issues, and in particular, efficiency degradation with large $k$. This is a significant limitation because applications such as finance, law, and healthcare require a $k$ that is large enough to cause huge overhead for existing systems. Also, modern long-context models generally achieve higher accuracy with larger retrieval sets. We propose P$^2$RAG, an efficient privacy-preserving RAG service that supports arbitrary top-$k$ retrieval. Unlike existing systems, P$^2$RAG avoids sorting candidate documents. Instead, it uses an interactive bisection method to determine the set of top-$k$ documents. For security, P$^2$RAG uses secret sharing on two semi-honest non-colluding servers to protect the data owner's database and the user's prompt. It enforces restrictions and verification to defend against malicious users and tightly bounds the information leakage of the database. The experiments show that P$^2$RAG is 3--300$\times$ faster than the state-of-the-art PRAG for $k = 16$--$1024$.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{ming2026prag,
  title  = {P$^2$RAG: Efficient Privacy-Preserving RAG Service Supporting Arbitrary Top-k Retrieval},
  author = {Yulong Ming and Mingyue Wang and Jijia Yang and Jie Xu and Zihan Wu and Cong Wang and Xiaohua Jia},
  year   = {2026},
  eprint = {2603.14778},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2603.14778v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2603.14778.svg)](https://codeofpaper.com/paper/2603.14778)

Discussion