GitHub

RAG-FiT Project Description

What is the project about?

RAG-FiT (formerly RAG Foundry) is a library designed to improve the ability of Large Language Models (LLMs) to utilize external information effectively. It achieves this by enabling fine-tuning of LLMs on specially curated datasets augmented with Retrieval-Augmented Generation (RAG) techniques. It provides tools for creating these datasets, training models efficiently, performing inference, and evaluating the results with RAG-specific metrics.

What problem does it solve?

The project addresses the limitations of LLMs in accessing and integrating up-to-date or domain-specific information that is not present in their training data. Standard LLMs can hallucinate or provide outdated answers. RAG-FiT helps to improve the accuracy and reliability of LLMs when dealing with tasks that require external knowledge by allowing to fine-tune models on datasets that include retrieved context.

What are the features of the project?

  • Dataset Creation: Generates datasets for RAG training and inference. This includes data loading, normalization, aggregation (e.g., few-shot examples), information retrieval (integration with external tools/frameworks), API integration, and prompt generation using templates. Data is saved in a consistent, model-independent format.
  • Training: Leverages Parameter-Efficient Fine-Tuning (PEFT) and libraries like TRL (Transformer Reinforcement Learning) for efficient training of LLMs on the augmented datasets. Trained models can be pushed to the Hugging Face Hub.
  • Inference: Generates predictions using the augmented datasets, supporting both trained and untrained LLMs.
  • Evaluation: Provides a comprehensive evaluation framework with various RAG-specific metrics, including both local (per-example) and global (dataset-level) metrics. Supports metrics like EM, F1, ROUGE, BERTScore, Deepeval, RAGAS, and Hugging Face evaluate. Metrics can utilize any feature in the dataset, not just input/output.
  • Modularity and Configurability: The library is modular, with workflows customizable via configuration files using Hydra. This allows for easy experimentation with different RAG settings.
  • Reproducibility: Provides configurations to reproduce experiments from the associated research paper.

What are the technologies used in the project?

  • Python: The primary programming language.
  • PEFT (Parameter-Efficient Fine-Tuning): For efficient model training.
  • TRL (Transformer Reinforcement Learning): Used for supervised fine-tuning.
  • Hugging Face Hub: For model storage and sharing.
  • Hydra: A configuration management tool for flexible and hierarchical configuration.
  • Optional Integrations:
    • Haystack
    • Deepeval
  • Evaluation Libraries:
    • ROUGE
    • BERTScore
    • RAGAS
    • Hugging Face evaluate

What are the benefits of the project?

  • Improved LLM Accuracy: Enhances the accuracy and reliability of LLMs when dealing with tasks requiring external knowledge.
  • Efficient Training: Uses PEFT for efficient fine-tuning, reducing computational cost and time.
  • Comprehensive Evaluation: Offers a wide range of RAG-specific metrics for thorough performance assessment.
  • Flexibility and Customization: Modular design and Hydra configuration allow for easy experimentation and adaptation to different RAG setups.
  • Reproducibility: Facilitates reproducible research by providing configurations for replicating experiments.
  • Fast Prototyping: Enables rapid experimentation with various RAG settings.

What are the use cases of the project?

  • Fine-tuning LLMs for specific domains: Creating specialized LLMs that excel in areas requiring up-to-date or niche knowledge (e.g., medical, legal, scientific).
  • Improving question answering systems: Building more accurate and reliable QA systems that can leverage external knowledge sources.
  • Enhancing chatbots and conversational AI: Developing chatbots that can provide more informative and contextually relevant responses.
  • Research on RAG techniques: Providing a platform for experimenting with and evaluating different RAG approaches.
  • Any task requiring LLMs to access and integrate external information: This is a broad category, encompassing tasks like document summarization with external context, code generation with API documentation, and more.
RAG-FiT screenshot