Abstract
Federated Retrieval (FR) is a critical component of distributed Retrieval-Augmented Generation (RAG) systems, tasked with routing queries to the most relevant private or heterogeneous knowledge sources. However, existing FR methods often struggle with semantic ambiguity and overlapping domain boundaries. This paper introduces DFAMS (Dynamic-flow guided Federated Alignment based Multi-prototype Search), a framework that probes the internal Dynamic Information Flow (DIF) of an LLM to identify user intent. By employing multi-prototype contrastive learning to align these internal activations with external knowledge bases, DFAMS achieves superior retrieval accuracy and significantly faster inference compared to state-of-the-art prompt-based and routing baselines.
Introduction
Standard Retrieval-Augmented Generation (RAG) typically relies on a centralized vector database. However, real-world data is frequently distributed across heterogeneous, private silos—such as clinical records, academic textbooks, and internal corporate policies. Federated Retrieval (FR) addresses the challenge of routing a user query to the appropriate source.
Two primary hurdles impede current FR methods:
- Semantic Ambiguity: Queries often lack explicit context (e.g., a medical query might require different sources for a student versus a clinician).
- Boundary Overlap: Knowledge bases often contain overlapping sub-domains, making "one-vector-per-source" representations insufficient.
DFAMS addresses these by treating the LLM as an internal router, leveraging its latent neural activation patterns to decode intent and domain relevance.
Methodology
The DFAMS framework operates on the principle that specific "neuron paths" within an LLM activate based on query intent. The architecture is divided into two main components: intent detection via internal probing and knowledge alignment through multi-prototype search.
Dynamic Information Flow (DIF) Probing
DFAMS identifies "Dynamic Information Flow" by using Shapley value-based attribution to determine which neurons in the Feed-Forward Network (FFN) layers are most responsible for domain-sensitive behavior. This probing reveals that intent-related signals are strongest in early-to-middle layers, while domain integration occurs in deeper layers (e.g., layers 26–27 in Qwen2.5-7B).
Multi-Prototype Alignment and Learning
To handle fuzzy boundaries, DFAMS avoids single-vector representations. Instead, it uses K-Means clustering to generate multiple "prototypes" for each knowledge base. A two-stage contrastive learning process is employed:
- Inter-KB Alignment: Trains an alignment module to separate different knowledge bases in the embedding space.
- Intra-KB Alignment: Refines the space so queries align with specific sub-domain prototypes within a single knowledge base.
Adaptive Triggering
During inference, the system calculates a similarity score between the query and the prototypes. If the score falls below a dynamic threshold, the system abstains from retrieval, relying on the LLM's internal knowledge to prevent noise from irrelevant documents.
Experimental Evaluation
The authors evaluated DFAMS using several diverse datasets:
- Wiki: 1M English passages split into 10 semantic knowledge bases.
- Med: Four distinct medical sources (PubMed, StatPearls, textbooks, Wikipedia).
- PEP: Chinese-language corporate documents across four sub-domains.
- Out-of-Domain (OOD): Subsets of MMLU and MIRAGE to test generalization.
Results and Discussion
DFAMS consistently outperformed state-of-the-art methods such as RAGRoute and RopMura across all metrics.
Key findings include:
- Accuracy and Recall: DFAMS improved classification accuracy by up to 14.37% and retrieval recall by 5.38% compared to baselines.
- Downstream QA: End-to-end question-answering accuracy improved by up to 6.45%.
- Efficiency: DFAMS achieved a 10x speedup over prompt-based methods (1.48s vs. 15.59s on the Med dataset), as it utilizes a lightweight MLP on top of internal activations rather than expensive LLM generation for routing.
Conclusion
DFAMS demonstrates that an LLM's internal neural pathways provide a robust signal for federated retrieval. By aligning these signals with multi-prototype representations of external knowledge, the framework significantly enhances both the accuracy and efficiency of distributed RAG systems. Future work will focus on adapting the system for dynamic, evolving knowledge bases and reducing the overhead of the initial probing phase.
Summary updated