RAG Foundry: A Framework for Enhancing LLMs for Retrieval Augmented Generation
Daniel Fleischer, Moshe Berchansky, Moshe Wasserblat, Peter Izsak
TL;DR
RAG Foundry tackles the complexity of building Retrieval-Augmented Generation systems by delivering an open-source, end-to-end framework that unifies data creation, training, inference, and evaluation in a configurable workflow. The approach supports rapid prototyping of RAG techniques, including data augmentation, retrieval pipelines, prompt design, and model fine-tuning via TRL and LoRA, all within a modular, reproducible environment. Empirical results across three knowledge-intensive datasets show performance gains from RAG configurations, with multi-metric evaluation addressing fidelity and relevancy of retrieved content. The work provides a practical, extensible platform for researchers and practitioners to systematically develop and evaluate RAG systems while promoting transparency and reproducibility.
Abstract
Implementing Retrieval-Augmented Generation (RAG) systems is inherently complex, requiring deep understanding of data, use cases, and intricate design decisions. Additionally, evaluating these systems presents significant challenges, necessitating assessment of both retrieval accuracy and generative quality through a multi-faceted approach. We introduce RAG Foundry, an open-source framework for augmenting large language models for RAG use cases. RAG Foundry integrates data creation, training, inference and evaluation into a single workflow, facilitating the creation of data-augmented datasets for training and evaluating large language models in RAG settings. This integration enables rapid prototyping and experimentation with various RAG techniques, allowing users to easily generate datasets and train RAG models using internal or specialized knowledge sources. We demonstrate the framework effectiveness by augmenting and fine-tuning Llama-3 and Phi-3 models with diverse RAG configurations, showcasing consistent improvements across three knowledge-intensive datasets. Code is released as open-source in https://github.com/IntelLabs/RAGFoundry.
