IntelLabs/RAG-FiT
Framework for enhancing LLMs for RAG tasks using fine-tuning.
What it solves
RAG-FiT improves the ability of Large Language Models (LLMs) to utilize external information by providing a structured framework for fine-tuning models on specially created RAG-augmented datasets.
How it works
The library is organized into four modular components:
- Dataset Creation: Generates training data by persisting RAG interactions, including data loading, retrieval from external tools, and prompt creation. The data is saved in a model-independent format.
- Training: Employs Parameter-Efficient Fine-Tuning (PEFT) and TRL (e.g., supervised fine-tuning) to train models on the augmented datasets.
- Inference: Generates predictions using either trained or untrained LLMs on the augmented datasets.
- Evaluation: Measures performance using a variety of RAG-specific metrics (such as RAGAS, Deepeval, BERTScore, and ROUGE) that can analyze retrieval results, reasoning, and citations.
Who it’s for
Developers and researchers who want to prototype and experiment with different RAG configurations, data selection, and fine-tuning strategies to enhance LLM performance on external data.
Highlights
- Modular Workflow: Separate scripts for processing, training, inference, and evaluation.
- Cofiguration-as-Code: Uses Hydra for hierarchical configurations, allowing easy overrides via CLI and integration with remote job runners like SLURM and Ray.
- Cofiguration-as-Code: Uses Hydra for Hydra for hierarchical configurations, allowing easy easy override of values in the CLI.
- RAG-Specific Metrics: Supports both local and global metrics to evaluate the quality of retrieval and generation.
- PEFT Support: Enables efficient training of models via parameter-efficient methods.