Distributed Retrieval-Augmented Generation

Chenhao Xu, Longxiang Gao, Yuan Miao, Xi ZhengarXiv 2025 · OpenReview

Abstract

As large language models (LLMs) become increasingly adopted on edge devices, Retrieval-Augmented Generation (RAG) is gaining prominence as a solution to address factual deficiencies and hallucinations by integrating external knowledge. However, centralized RAG architectures face significant challenges in data privacy and scalability. For instance, smart healthcare services often rely on collecting sensitive patient data and building a centralized knowledge base to provide better diagnosis and treatment advice, while privacy concerns significantly impede this process. Besides, maintaining a comprehensive and continuously updated knowledge base is costly, particularly in response to regional epidemics and rapidly mutating viruses. To address these challenges, this paper introduces Distributed Retrieval-Augmented Generation (DRAG), a novel framework that improves data privacy by eliminating the need for a centralized knowledge base and restoring data control to owners. DRAG incorporates a Topic-Aware Random Walk (TARW) algorithm that leverages LLMs to extract query topics and facilitate targeted peer discovery within a peer-to-peer network, enabling efficient knowledge retrieval in decentralized environments. Extensive experiments across three diverse datasets and LLMs demonstrate that DRAG with TARW achieves near-centralized RAG performance by using half as many messages as flooding. The code is available at https://github.com/xuchenhao001/DRAG.

Introduction

Large Language Models (LLMs) are powerful but prone to "hallucinations"—generating confident but false information. Standard RAG fixes this by fetching facts from a central database before the LLM speaks. However, this centralized approach hits two major walls: privacy and scalability. In sensitive fields like healthcare or autonomous driving, users are often unwilling to upload private data to a central repository. Furthermore, maintaining a massive, real-time updated central knowledge base is expensive and creates a single point of failure.

The DRAG Framework

The researchers introduced the DRAG framework, which decentralizes the knowledge base by allowing edge devices (phones, medical workstations, cars) to query each other directly in a peer-to-peer (P2P) network. This approach ensures that data remains under the control of the original owners while still being accessible for collective intelligence.

The DRAG framework workflow across decentralized peers, illustrating the five-step process from query analysis to result caching.

As illustrated in the system architecture, DRAG operates in five distinct steps:

  1. Local Query Analysis: The device first checks if its own local knowledge can answer the user's question.
  2. Knowledge Discovery: If it cannot, it uses the Topic-Aware Random Walk (TARW) algorithm to find peers who might know the answer.
  3. Distributed Retrieval: The device requests "privacy-filtered" snippets from relevant peers.
  4. Local Generation: The local LLM synthesizes these snippets into a final answer.
  5. Result Caching: The device saves the answer and remembers which peers were helpful for specific topics.

Topic-Aware Random Walk (TARW)

Unlike traditional "random walks" that wander aimlessly through a network, TARW uses an LLM to extract the topic of a query. It then prioritizes peers who have historically provided good information on that specific topic. This makes the search "surgical" rather than "scattershot," significantly reducing the number of messages required to find an answer.

Experimental Results

The framework was evaluated using three diverse datasets: MMLU (general knowledge), Medical Extended (healthcare), and News (contextual retrieval).

Performance (F1 score) and communication efficiency (# Messages) of DRAG-TARW compared to flooding (DRAG-FL) and standard random walk (DRAG-RW) across varying network sizes.

Key insights from the evaluation include:

  • Near-Parity with Centralized RAG: On the MMLU dataset, DRAG-TARW achieved an F1 score of 83.92%, trailing the centralized baseline (85.75%) by less than 2%.
  • Massive Message Reduction: Compared to "flooding" (sending a query to everyone), TARW reduced communication overhead by approximately 50%. As shown in the performance graphs, while flooding (DRAG-FL) message counts spike with more peers, TARW maintains a much lower, linear growth.
  • Resilience and the "Wisdom of the Swarm": DRAG proves more robust than centralized RAG when data is fragmented. If a central database is missing specific topics, it fails; DRAG simply routes the query to a peer who has that specific "missing" piece. In tests where the central server only had 70% of the data, decentralized DRAG significantly outperformed it.

Conclusion

DRAG demonstrates that a collection of small, incomplete local knowledge bases can collectively match the performance of a centralized server while preserving privacy. By leveraging TARW, the system achieves high accuracy with minimal communication costs. Future work will address challenges in sparse networks, incentive mechanisms for peer participation, and defense against malicious actors providing misinformation.

Summary updated

BibTeX
@misc{xu2025distributed,
  author = {Chenhao Xu and Longxiang Gao and Yuan Miao and Xi Zheng},
  title = {{Distributed Retrieval-Augmented Generation}},
  year = {2025},
  eprint = {2505.00443},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2505.00443},
}
Figure