FedRAG: A Framework for Fine-Tuning Retrieval-Augmented Generation Systems

Val Andrei Fajardo, D. B. Emerson, Amandeep Singh, Marcelo Lotif, Veronica Chatrath, Izuki Matsuba, Chi Ho Cheung, Ravi Theja DesettyCODEML @ ICML 2025

TL;DR

This paper introduces FedRAG, a novel framework designed to simplify the fine-tuning of Retrieval-Augmented Generation (RAG) systems. FedRAG supports both centralized and federated learning architectures, offering a unified interface for state-of-the-art fine-tuning methods and seamless integration with the existing RAG ecosystem. This framework aims to accelerate research and development in RAG by making advanced fine-tuning techniques more accessible and reproducible.

What Problem Does This Paper Address?

Large Language Models (LLMs) are powerful but can suffer from factual inaccuracies or "hallucinations," especially when dealing with knowledge beyond their training data. Retrieval-Augmented Generation (RAG) systems address this by retrieving relevant external information to augment the LLM's generation process. While fine-tuning both the retriever and generator components of RAG systems has shown promise for improving performance, the tools and frameworks for doing so, particularly in a federated learning setting (where data is distributed across multiple clients without being centralized), are lacking. This gap hinders researchers and practitioners from easily experimenting with and deploying advanced RAG fine-tuning techniques, especially in privacy-sensitive environments.

Methods

FedRAG provides a modular framework with a focus on ease of use and flexibility. Its core components include:

  • core.RAGSystem: An abstraction that brings together knowledge stores, retrievers, and generators.
  • trainers: Modules for implementing various fine-tuning methods, such as RALT (Retrieval-Augmented Language Model Training) and LSR (Language Model Supervised Retriever Training).
  • trainer_managers: Orchestrators that handle the fine-tuning process, managing which model (retriever or generator) is trained and which is frozen.
  • fl_tasks: Components that enable the seamless conversion of centralized fine-tuning tasks into federated learning workflows, leveraging frameworks like Flower.
  • evals: Tools for benchmarking and evaluating RAG system performance.

A key innovation is FedRAG's ability to facilitate a smooth transition from centralized to federated fine-tuning with minimal code changes. It also emphasizes integration with popular tools like HuggingFace, Unsloth, and LlamaIndex, aiming to be a central piece of the RAG development ecosystem.

Datasets

The paper mentions the use of the following datasets:

  • Wikipedia dump (December 2021): Used as the source for text chunks for the knowledge store.
  • Web Questions: Utilized as the fine-tuning dataset for the RALT objective.
  • MMLU (global facts subset): Employed for evaluation, specifically the test split containing 100 data points.

The paper does not introduce new benchmarks but rather uses existing ones to demonstrate the framework's capabilities.

Key Insights and Ideas

  • Unified Framework for Centralized and Federated RAG Fine-Tuning: The most significant contribution is providing a single, intuitive framework that supports both centralized and federated fine-tuning. This drastically lowers the barrier to entry for exploring advanced RAG techniques in diverse settings.
  • Seamless Transition: The ability to convert a centralized fine-tuning setup to a federated one with minimal code modifications is a major practical advantage.
  • Ecosystem Integration: FedRAG's deep integration with existing popular RAG tools and libraries (HuggingFace, LlamaIndex, etc.) ensures it fits into current workflows rather than requiring users to adopt entirely new ecosystems.
  • Reproducibility Focus: By providing a structured framework and clear examples, FedRAG aims to promote reproducible research in RAG fine-tuning.

Key Results

The paper presents a lightweight experiment (RA-DIT inspired) demonstrating the effectiveness of RALT fine-tuning. The results show a significant improvement in exact match performance on the MMLU (global_facts) benchmark after RALT fine-tuning, increasing the average score from 22.0 to 30.5. This corroborates findings from prior work that RAG fine-tuning can lead to substantial performance gains. The framework's flexibility is highlighted by the ability to easily switch between different fine-tuning methods and evaluation metrics.

Limitations and Future Work

The authors acknowledge that the presented experiment is a lightweight version of prior work. Future development plans include:

  • MCP Integration: Integrating MCP (Model Context Protocol) clients and RAG systems to enable knowledge retrieval from third-party MCP servers.
  • ReSearch Generator Trainer: Implementing a generator trainer that equips LLMs with reasoning infused with search capabilities.
  • Improved Retriever Trainers: Developing new training objectives for supervised retriever fine-tuning.
  • Advanced Federated Learning: Expanding support for more sophisticated federated learning techniques.
  • LangChain Integration: Adding a bridge to LangChain inference objects.
  • Optimizations: Enhancing batch RAG system querying and concurrent benchmarking.

Summary updated

BibTeX
@inproceedings{fajardo2025fedrag,
  author = {Val Andrei Fajardo and D. B. Emerson and Amandeep Singh and Marcelo Lotif and Veronica Chatrath and Izuki Matsuba and Chi Ho Cheung and Ravi Theja Desetty},
  title = {{FedRAG: A Framework for Fine-Tuning Retrieval-Augmented Generation Systems}},
  booktitle = {CODEML @ ICML},
  year = {2025},
  url = {https://openreview.net/forum?id=I2is1QsDuD},
}
Figure