TL;DR
Retrieval-Augmented Generation (RAG) keeps language models honest by feeding them external documents, but what happens when those documents are locked inside private silos like hospitals? Instead of sending raw, readable text over the network, FedRepRAG exchanges ultra-compact mathematical representations—shrinking each entire retrieved document down to a single token. It protects raw data from direct exposure while slashing the computational cost of inference.
What Problem Does This Paper Address?
Large language and vision-language models (LLMs/VLMs) hallucinate when their internal knowledge runs dry. RAG solves this by looking up relevant facts in a database and pasting them into the model’s prompt. However, standard RAG assumes all knowledge sits in one centralized library. In the real world—especially in medicine or finance—data is scattered across independent institutions that legally cannot pool or share raw records.
Recent "federated RAG" systems let institutions search each other's databases, but they still ship raw, human-readable text snippets across the network to be pasted into the querying client's prompt. That creates two massive headaches:
- Direct Data Exposure: Sensitive text leaves its home institution in plain sight.
- Compute Bottlenecks: Stuffing multiple long documents into an LLM prompt makes inference painfully slow and expensive.
Methods
The authors propose FedRepRAG, a system where raw documents never leave their local servers. Every client shares the same frozen LLM/VLM backbone (used for both encoding searches and generating answers).
During inference, a querying client converts its question into a vector embedding and sends it to a central server, which broadcasts it to all other clients. Each client searches its private database and returns only the embeddings and similarity scores of its top matches. The server picks the global winners and forwards those winning embeddings back to the asker.
Here is the catch: an LLM cannot natively "read" a raw retrieval embedding as if it were a word. To bridge this gap, the authors introduce a lightweight MLP projector (a tiny two-layer neural network) that translates each retrieved document embedding into a single "representation token" inside the generator's input space.
Because data is decentralized, clients collaboratively train this tiny projector using Federated Learning (specifically FedAvg, exchanging only the projector's weights) in two clever stages:
- Stage 1 (Semantic Alignment): Clients train the projector to reconstruct local documents from their embeddings—essentially teaching the frozen LLM how to "unpack" the compressed vector.
- Stage 2 (Task-Specific Alignment): Clients fine-tune the projector on local Q&A pairs so the compressed tokens actively help answer downstream questions.
Datasets
No new datasets were introduced; instead, the authors partitioned four existing benchmarks across 10 simulated clients using non-IID (unevenly distributed) splits to mimic specialized real-world institutions:
- Visual Question Answering (VQA): SLAKE-EN (radiology images and clinical questions) and ScienceQA (multimodal school science curricula).
- Text Question Answering (QA): PubMedQA (biomedical research abstracts) and KILT-NQ (open-domain Wikipedia queries based on Natural Questions).
Key Insights and Ideas
- Bad local context is worse than no context: When data is unevenly distributed across clients, relying solely on local RAG can actually hurt accuracy compared to not using RAG at all (dropping from 54.0% to 14.4% on PubMedQA!). Irrelevant local documents actively mislead the generator, proving why cross-client collaboration is vital.
- Two-stage training is a tug-of-war: Ablation studies show Stage 1 alone excels at open-ended questions (preventing multi-token generation noise), while Stage 2 alone shines on multiple-choice questions. Combining both gives the best overall balance.
- Federated training builds resilience: If 90% of clients suddenly drop offline during inference, FedRepRAG still beats Centralized Rep-RAG by 6.51 points. Training on fragmented local pools teaches the projector not to rely on perfect, global retrieval matches.
- Embeddings aren't magically private, but DP helps: Because Stage 1 explicitly trains the projector to reconstruct text, an insider could decode exchanged embeddings back into text (recovering up to 20.4% of short KILT-NQ contexts). However, adding Differential Privacy (DP-SGD) during Stage 1 drops that inversion rate to 0.2% with virtually zero loss in final QA accuracy!
Key Results
Across Qwen2.5-VL, Qwen3, and Gemma3 backbones, FedRepRAG consistently beats non-collaborative baselines while crushing computational overhead:
- Accuracy Gains: Outperforms the next-best privacy-preserving baselines (Direct Inference or Local RAG) by up to 14.13 points on VQA (SLAKE-EN) and 5.40 points on QA (PubMedQA). It also beats FedMosaic (a recent LoRA-based federated RAG method) by 15.33 Exact Match points on a KILT-NQ subset.
- Massive Compression & Speedup: Because an entire document becomes just one token, retrieval context lengths shrink by 19× to 398×. On PubMedQA, average retrieved tokens plummet from ~1,194 down to 3, slashing per-query compute by 92.49% (from 21,095 GFLOPs down to 1,584 GFLOPs).
Limitations and Future Work
- No Formal Privacy Guarantees Yet: Avoiding raw text transfer reduces obvious exposure, and DP-SGD mitigates basic reconstruction attacks, but residual leakage remains. End-to-end cryptographic protections (like secure aggregation) are needed for strict regulatory compliance.
- Scaling Pains: Splitting a fixed dataset across 20 clients instead of 10 caused a slight dip in accuracy (63.71% to 60.60% on SLAKE-EN) due to fragmented local training pools. Future work will explore smarter client-routing strategies (so the server doesn't broadcast queries to everyone) and much larger federations.
Summary updated