FlashRAG

RUC-NLPIRMIT活跃维护

面向 RAG 研究的 Python 工具包,内置多种检索增强生成算法、数据集和评测基准,方便快速复现和对比实验。

⚡FlashRAG: A Python Toolkit for Efficient RAG Research (WWW2025 Resource)

v0.4.1发布于 2026-10-27 00:46 UTC3,604star333fork同步于 2026-11-10 11:40 UTC

怎么上手

由 README 提炼,执行前请确认
pip install flashrag-dev[full]
硬件要求按 README 说明

README 未说明具体显存要求;faiss-gpu 需 Linux x86_64 且 CUDA 11.4 或 12.1,也可用 faiss-cpu 纯 CPU 版本。

纯 CPU 可运行需要 CUDA
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

FlashRAG 是复现和开发 RAG 研究的 Python 工具库,内置数据集与算法

面向 RAG 研究的 Python 工具包,内置多种检索增强生成算法、数据集和评测基准,方便快速复现和对比实验。

核心能力

  • 集成检索器、重排器、生成器、压缩器等可组装组件
  • 提供 36 个预处理好的 RAG 基准数据集
  • 预实现 23 种 RAG 算法,含 7 种推理型方法
  • 用 vLLM、FastChat 加速推理,Faiss 管理向量索引
  • 提供可视化 UI 配置并评测 RAG 基线

容易踩的坑

faiss 不能用 pip 装,需用 conda 安装 faiss-cpu 或 faiss-gpu;BM25 索引需另装 pyserini 或 bm25s;SPLADE 索引需先装 Rust 和 pyseismic-lsr。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本v0.4.1
  1. v0.4.1最新正式版2026-10-27 · 2026-10-27 00:46 UTC

    What's Changed

    New Contributors

    Full Changelog: https://github.com/RUC-NLPIR/FlashRAG/compare/v0.4.0...v0.4.1

  2. v0.4.02026-10-01 · 2026-10-01 01:55 UTC
    查看更新说明

    What's Changed

    New Contributors

    Full Changelog: https://github.com/RUC-NLPIR/FlashRAG/compare/v0.3.0...v0.4.0

  3. v0.3.0v0.3.0: Support Various Reasoning Methods2025-08-18 · 2025-08-18 09:22 UTC
    查看更新说明

    What's Changed

    New Contributors

    Full Changelog: https://github.com/RUC-NLPIR/FlashRAG/compare/v0.2.0...v0.3.0

  4. v0.2.0v0.2.0 Support multimodal RAG2025-03-10 · 2025-03-10 02:14 UTC
    查看更新说明

    What's Changed

    New Contributors

    Full Changelog: https://github.com/RUC-NLPIR/FlashRAG/compare/v0.1.4...v0.2.0

  5. v0.1.4v0.1.4 Introduce FlashRAG-UI2025-01-13 · 2025-01-13 02:25 UTC
    查看更新说明

    What's Changed

    New Contributors

    Full Changelog: https://github.com/RUC-NLPIR/FlashRAG/compare/v0.1.3...v0.1.4

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    ⚡FlashRAG: A Python Toolkit for Efficient RAG Research

    [ English | 中文 ]

    FlashRAG is a Python toolkit for the reproduction and development of Retrieval Augmented Generation (RAG) research. Our toolkit includes 36 pre-processed benchmark RAG datasets and 23 state-of-the-art RAG algorithms, including 7 reasoning-based methods that combine reasoning ability with retrieval.

    With FlashRAG and provided resources, you can effortlessly reproduce existing SOTA works in the RAG domain or implement your custom RAG processes and components. Besides, we provide an easy-to-use UI:

    https://github.com/user-attachments/assets/8ca00873-5df2-48a7-b853-89e7b18bc6e9

    :link: Navigation

    :sparkles: Features

    • Extensive and Customizable Framework: Includes essential components for RAG scenarios such as retrievers, rerankers, generators, and compressors, allowing for flexible assembly of complex pipelines.

    • Comprehensive Benchmark Datasets: A collection of 36 pre-processed RAG benchmark datasets to test and validate RAG models' performances.

    • Pre-implemented Advanced RAG Algorithms: Features 23 advancing RAG algorithms with reported results, based on our framework. Easily reproducing results under different settings.

    • 🚀 Reasoning-based Methods: NEW! We now support 7 reasoning-based methods that combine reasoning ability with retrieval, achieving superior performance on complex multi-hop tasks.

    • Efficient Preprocessing Stage: Simplifies the RAG workflow preparation by providing various scripts like corpus processing for retrieval, retrieval index building, and pre-retrieval of documents.

    • Optimized Execution: The library's efficiency is enhanced with tools like vLLM, FastChat for LLM inference acceleration, and Faiss for vector index management.

    • Easy to Use UI : We have developed a very easy to use UI to easily and quickly configure and experience the RAG baselines we have implemented, as well as run evaluation scripts on a visual interface.

    :mag_right: Roadmap

    FlashRAG is still under development and there are many issues and room for improvement. We will continue to update. And we also sincerely welcome contributions on this open-source toolkit.

    • Support OpenAI models
    • Provdide instructions for each component
    • Integrate sentence Transformers
    • Support multimodal RAG
    • Support reasoning-based methods
    • Inlcude more RAG approaches
    • Enhance code adaptability and readability
    • Add support for api-based retriever (vllm server)

    :page_with_curl: Changelog

    [25/11/06] 🎯 NEW Retriever! We have integrated a Web Search Engine-based Retriever, which seamlessly integrates with existing methods and can be enabled quickly with just a Serper API key! This enhancement significantly expands retrieval coverage and real-time capability, supporting dynamic information access and external knowledge augmentation. Experience a more flexible and powerful retrieval workflow now!

    [25/08/06] 🎯 NEW! We have added support for Reasoning Pipeline, which is a new paradigm that combines reasoning ability and retrieval, representing work that includes R1-Searcher, Search-R1,.... We evaluate the performance of the pipeline on various RAG benchmarks, it can achieve F1 scores close to 60 on multi hop inference datasets such as HotpotQA. See it in result table.

    [25/03/21] 🚀 Major Update! We have expanded our toolkit to support 23 state-of-the-art RAG algorithms, including 7 reasoning-based methods that significantly improve performance on complex reasoning tasks. This represents a major milestone in our toolkit's evolution!

    [25/02/24] 🔥🔥🔥 We have added support for multimodal RAG, including MLLMs like Llava, Qwen, InternVL, and various multimodal retrievers with Clip architecture. More information can be found in our new version of arxiv article and our documentation. Try it!

    [25/01/21] Our technical paper FlashRAG: A Python Toolkit for Efficient RAG Research is honored to have been accepted to the Resource Track of the 2025 ACM Web Conference (WWW 2025). Please Check it out!

    [25/01/12] Introduce FlashRAG-UI, an easy to use interface. You can easily and quickly configure and experience the supported RAG methods and evaluate them on the benchmarks.

    [25/01/11] We have added support for a new method RQRAG method, see it in reproduce_experiment.

    [25/01/07] We have currently support the aggregation of multiple retrievers, see it in multi retriever usage.

    [25/01/07] We have integrated a very flexible and lightweight corpus chunking library Chunkie, which supports various custom chunking methods (tokens, sentences, semantic, etc.). Use it in chunking doc corpus.

    [24/10/21] We have released a version based on the Paddle framework that supports Chinese hardware platforms. Please refer to FlashRAG Paddle for details.

    [24/10/13] A new in-domain dataset and corpus - DomainRAG have been added to the dataset. The dataset is based on the internal enrollment data of Renmin University of China, covering seven types of tasks, which can be used for conducting domain-specific RAG testing.

    [24/09/24] We have released a version based on the MindSpore framework that supports Chinese hardware platforms. Please refer to FlashRAG MindSpore for details.

    [24/09/18] Due to the complexity and limitations of installing Pyserini in certain environments, we have introduced a lightweight BM25s package as an alternative (faster and easier to use). The retriever based on Pyserini will be deprecated in future versions. To use retriever with bm25s, just set bm25_backend to bm25s in config.

    [24/09/09] We add support for a new method Adaptive-RAG, which can automatically select the RAG process to execute based on the type of query. See it result in result table.

    [24/08/02] We add support for a new method Spring, significantly improve the performance of LLM by adding only a few token embeddings. See it result in result table.

    [24/07/17] Due to some unknown issues with HuggingFace, our original dataset link has been invalid. We have updated it. Please check the new link if you encounter any problems.

    [24/07/06] We add support for a new method: Trace, which refine text by constructing a knowledge graph. See it results and details.

    [24/06/19] We add support for a new method: IRCoT, and update the result table.

    [24/06/15] We provide a demo to perform the RAG process using our toolkit.

    [24/06/11] We have integrated sentence transformers in the retriever module. Now it's easier to use the retriever without setting pooling methods.

    [24/06/05] We have provided detailed document for reproducing existing methods (see how to reproduce, baseline details), and configurations settings.

    [24/06/02] We have provided an introduction of FlashRAG for beginners, see an introduction to flashrag (中文版 한국어).

    [24/05/31] We supported Openai-series models as generator.

    :wrench: Installation

    PyPI - Version PyPI - Downloads PyPI - Downloads

    To get started with FlashRAG, you can simply install it with pip:

    pip install flashrag-dev --pre
    

    Or you can clone it from Github and install (requires Python 3.10+):

    git clone https://github.com/RUC-NLPIR/FlashRAG.git
    cd FlashRAG
    pip install -e .
    

    If you want to use vllm, sentence-transformers or pyserini, you can install the optional dependencies:

    # Install all extra dependencies
    pip install flashrag-dev[full]
    
    # Install vllm for faster speed
    pip install vllm>=0.4.1
    
    # Install sentence-transformers
    pip install sentence-transformers
    
    # Install pyserini for bm25
    pip install pyserini
    

    Due to the incompatibility when installing faiss using pip, it is necessary to use the following conda command for installation.

    # CPU-only version
    conda install -c pytorch faiss-cpu=1.8.0
    
    # GPU(+CPU) version
    conda install -c pytorch -c nvidia faiss-gpu=1.8.0
    

    Note: It is impossible to install the latest version of faiss on certain systems.

    From the official Faiss repository (source):

    • The CPU-only faiss-cpu conda package is currently available on Linux (x86_64 and arm64), OSX (arm64 only), and Windows (x86_64)
    • faiss-gpu, containing both CPU and GPU indices, is available on Linux (x86_64 only) for CUDA 11.4 and 12.1

    :rocket: Quick Start

    Corpus Construction

    To build an index, you first need to save your corpus as a jsonl file with each line representing a document.

    {"id": "0", "contents": "..."}
    {"id": "1", "contents": "..."}
    

    If you want to use Wikipedia as your corpus, you can refer to our documentation Processing Wikipedia to convert it into an indexable format.

    Index Construction

    You can use the following code to build your own index.

    • For dense retrieval methods, especially popular embedding models, we use faiss to build the index.

    • For sparse retrieval methods (BM25), we use Pyserini or bm25s to build the corpus into a Lucene inverted index. The built index contains the original documents.

    For Dense Retrieval Methods

    Modify the parameters in the following code to your own.

    python -m flashrag.retriever.index_builder \
      --retrieval_method e5 \
      --model_path /model/e5-base-v2/ \
      --corpus_path indexes/sample_corpus.jsonl \
      --save_dir indexes/ \
      --use_fp16 \
      --max_length 512 \
      --batch_size 256 \
      --pooling_method mean \
      --faiss_type Flat 
    
    • --pooling_method: If this parameter is not specified, we will automatically select it based on the model name and model file. However, since different embedding models use different pooling methods, we may not have fully implemented them. To ensure accuracy, you can specify the pooling method corresponding to the retrieval model you are using (mean, pooler, or cls).

    • ---instruction: Some embedding models require additional instructions to be concatenated to the query before encoding, which can be specified here. Currently, we will automatically fill in the instructions for E5 and BGE models, while other models need to be supplemented manually.

    If the retrieval model supports the sentence transformers library, you can use the following code to build the index (without considering the pooling method).

    python -m flashrag.retriever.index_builder \
      --retrieval_method e5 \
      --model_path /model/e5-base-v2/ \
      --corpus_path indexes/sample_corpus.jsonl \
      --save_dir indexes/ \
      --use_fp16 \
      --max_length 512 \
      --batch_size 256 \
      --pooling_method mean \
      --sentence_transformer \
      --faiss_type Flat 
    
    For Sparse Retrieval Methods (BM25)

    If building a bm25 index, there is no need to specify model_path.

    Building Index with BM25s
    python -m flashrag.retriever.index_builder \
      --retrieval_method bm25 \
      --corpus_path indexes/sample_corpus.jsonl \
      --bm25_backend bm25s \
      --save_dir indexes/ 
    
    Building Index with Pyserini
    python -m flashrag.retriever.index_builder \
      --retrieval_method bm25 \
      --corpus_path indexes/sample_corpus.jsonl \
      --bm25_backend pyserini \
      --save_dir indexes/ 
    

    For Sparse Neural Retrieval Methods (SPLADE)

    Install Seismic Index:
    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh # Install Rust for compiling
    pip install pyseismic-lsr # Install Seismic
    
    Then build the index with Seismic:
    python -m flashrag.retriever.index_builder \ # builder
            --retrieval_method splade \ # Model name to trigger seismic index (splade only available)
            --model_path retriever/splade-v3 \ # Local path or repository path are both supported.
            --corpus_embedded_path data/ms_marco/ms_marco_embedded_corpus.jsonl \  # Use cached embedded corpus if corpus is already available in seismic expected format
            --corpus_path data/ms_marco/ms_marco_corpus.jsonl \ # Corpus path in format {id, contents} jsonl file to be embedded if not already built
            --save_dir indexes/ \ # save index directory
            --use_fp16 \ # tell to use fp16 for splade model
            --max_length 512 \ # max tokens for each document
            --batch_size 4 \ # batch size for splade model (4-5 seems the best size for Tesla T4 16GB)
            --n_postings 1000 \ # seismic number of posting lists
            --centroid_fraction 0.2 \ # seismic centroids
            --min_cluster_size 2 \ # seismic min cluster
            --summary_energy 0.4 \ # seismic energy
            --batched_indexing 10000000 # seismic batch
            --nknn 32 # Optional parameter. Tell to seismic to use also knn graph. if not present seismic will work without knn graph
    

    Using the ready-made pipeline

    You can use the pipeline class we have already built (as shown in pipelines) to implement the RAG process inside. In this case, you just need to configure the config and load the corresponding pipeline.

    Firstly, load the entire process's config, which records various hyperparameters required in the RAG process. You can input yaml files as parameters or directly as variables.

    Please note that variables as input take precedence over files.

    from flashrag.config import Config
    
    # hybrid load configs
    config_dict = {'data_dir': 'dataset/'}
    my_config = Config(
        config_file_path = 'my_config.yaml',
        config_dict = config_dict
    

    We provide comprehensive guidance on how to set configurations, you can see our configuration guidance. You can also refer to the basic yaml file we provide to set your own parameters.

    Next, load the corresponding dataset and initialize the pipeline. The components in the pipeline will be automatically loaded.

    from flashrag.utils import get_dataset
    from flashrag.pipeline import SequentialPipeline
    from flashrag.prompt import PromptTemplate
    from flashrag.config import Config
    
    config_dict = {'data_dir': 'dataset/'}
    my_config = Config(
        config_file_path = 'my_config.yaml',
        config_dict = config_dict
    )
    all_split = get_dataset(my_config)
    test_data = all_split['test']
    
    pipeline = SequentialPipeline(my_config)
    

    You can specify your own input prompt using PromptTemplete:

    prompt_templete = PromptTemplate(
        config,
        system_prompt = "Answer the question based on the given document. Only give me the answer and do not output any other words.\nThe following are given documents.\n\n{reference}",
        user_prompt = "Question: {question}\nAnswer:"
    )
    pipeline = SequentialPipeline(
      my_config,
      prompt_template = prompt_templete
    )
    

    Finally, execute pipeline.run to obtain the final result.

    output_dataset = pipeline.run(test_data, do_eval=True)
    

    The output_dataset contains the intermediate results and metric scores for each item in the input dataset. Meanwhile, the dataset with intermediate results and the overall evaluation score will also be saved as a file (if save_intermediate_data and save_metric_score are specified).

    Build your own pipeline!

    Sometimes you may need to implement more complex RAG process, and you can build your own pipeline to implement it. You just need to inherit BasicPipeline, initialize the components you need, and complete the run function.

    from flashrag.pipeline import BasicPipeline
    from flashrag.utils import get_retriever, get_generator
    
    class ToyPipeline(BasicPipeline):
      def __init__(self, config, prompt_templete=None):
        # Load your own components
        pass
    
      def run(self, dataset, do_eval=True):
        # Complete your own process logic
    
        # get attribute in dataset using `.`
        input_query = dataset.question
        ...
        # use `update_output` to save intermeidate data
        dataset.update_output("pred",pred_answer_list)
        dataset = self.evaluate(dataset, do_eval=do_eval)
        return dataset
    

    Please first understand the input and output forms of the components you need to use from our documentation.

    Just use components

    If you already have your own code and only want to use our components to embed the original code, you can refer to the basic introduction of the components to obtain the input and output formats of each component.

    :gear: Components

    In FlashRAG, we have built a series of common RAG components, including retrievers, generators, refiners, and more. Based on these components, we have assembled several pipelines to implement the RAG workflow, while also providing the flexibility to combine these components in custom arrangements to create your own pipeline.

    RAG-Components
    Pipelines

    Referring to a survey on retrieval-augmented generation, we categorized RAG methods into four types based on their inference paths.

    • Sequential: Sequential execuation of RAG process, like Query-(pre-retrieval)-retriever-(post-retrieval)-generator
    • Conditional: Implements different paths for different types of input queries
    • Branching : Executes multiple paths in parallel, merging the responses from each path
    • Loop: Iteratively performs retrieval and generation

    In each category, we have implemented corresponding common pipelines. Some pipelines have corresponding work papers.

    :art: FlashRAG-UI

    :star2: Features

    • One-Click Configuration Loading
      • You can load parameters and configuration files for various RAG methods through simple clicks, selections, and inputs.
      • Supports preview interface for intuitive parameter settings.
      • Provides save functionality to easily store configurations for future use.
    • Quick Method Experience
      • Quickly load corpora and index files to explore the characteristics and application scenarios of various RAG methods.
      • Supports loading and switching different components and hyperparameters, seamlessly connecting different RAG Pipelines to quickly experience their performance and differences!
    • Efficient Benchmark Reproduction
      • Easily reproduce the built-in baseline methods and carefully collected benchmarks on FlashRAG-UI.
      • Use cutting-edge research tools directly without complex settings, providing a smooth experience for your research work!
    Experience our meticulously designed FlashRAG-UI—both user-friendly and visually appealing:
    cd webui
    python interface.py
    

    :robot: Supporting Methods

    We have implemented 23 works with a consistent setting of:

    • Generator: LLAMA3-8B-instruct with input length of 2048
    • Retriever: e5-base-v2 as embedding model, retrieve 5 docs per query
    • Prompt: A consistent default prompt, template can be found in the method details.

    For open-source methods, we implemented their processes using our framework. For methods where the author did not provide source code, we will try our best to follow the methods in the original paper for implementation.

    For necessary settings and hyperparameters specific to some methods, we have documented them in the specific settings column. For more details, please consult our reproduce guidance and method details.

    It's important to note that, to ensure consistency, we have utilized a uniform setting. However, this setting may differ from the original setting of the method, leading to variations in results compared to the original outcomes.

    MethodTypeNQ (EM)TriviaQA (EM)Hotpotqa (F1)2Wiki (F1)PopQA (F1)WebQA(EM)Specific setting
    Naive GenerationSequential22.655.728.433.921.718.8
    Standard RAGSequential35.158.935.321.036.715.7
    AAR-contriever-kiltSequential30.156.833.419.836.116.1
    LongLLMLinguaSequential32.259.237.525.038.717.5Compress Ratio=0.5
    RECOMP-abstractiveSequential33.156.437.532.439.920.2
    Selective-ContextSequential30.555.634.418.533.517.3Compress Ratio=0.5
    TraceSequential30.750.234.015.537.419.9
    SpringSequential37.964.642.637.354.827.7Use Llama2-7B-chat with trained embedding table
    SuReBranching37.153.233.420.648.124.2Use provided prompt
    REPLUGBranching28.957.731.221.127.820.2
    SKRConditional33.256.032.423.431.717.0Use infernece-time training data
    Adaptive-RAGConditional35.156.639.128.440.416.0
    Ret-RobustLoop42.968.235.843.457.233.7Use LLAMA2-13B with trained lora
    Self-RAGLoop36.438.229.625.132.721.9Use trained selfrag-llama2-7B
    FLARELoop22.555.828.033.920.720.2
    Iter-Retgen, ITRGLoop36.860.138.321.637.918.2
    IRCoTLoop33.356.941.532.445.620.7
    RQRAGLoop32.652.533.535.846.426.2Use trained rqrag-llama2-7B
    🚀 Reasoning-based Methods (NEW!)

    We now support 7 reasoning-based methods that combine reasoning ability with retrieval, achieving superior performance on complex multi-hop tasks:

    MethodTypeNQ (EM)TriviaQA (EM)PopQA (EM)Hotpotqa (F1)2Wiki (F1)Musique (F1)Bamboogle (F1)Specific setting
    Search-R1Reasoning45.262.249.254.542.629.259.9SearchR1-nq_hotpotqa_train-qwen2.5-7b-em-ppo
    R1-SearcherReasoning36.961.642.049.049.124.757.7Qwen-2.5-7B-base-RAG-RL
    O2-SearcherReasoning41.451.446.843.448.619.047.6O2-Searcher-Qwen2.5-3B-GRPO
    AutoRefineReasoning43.859.832.454.050.323.646.6AutoRefine-Qwen2.5-3B-Base
    ReaRAGReasoning26.351.824.642.941.621.241.9ReaRAG-9B
    CoRAGReasoning40.963.136.056.660.731.954.1CoRAG-Llama3.1-8B-MultihopQA
    SimpleDeepSearcherReasoning36.161.642.049.049.124.757.7Qwen-7B-SimpleDeepSearcher

    :notebook: Supporting Datasets & Document Corpus

    Datasets

    We have collected and processed 36 datasets widely used in RAG research, pre-processing them to ensure a consistent format for ease of use. For certain datasets (such as Wiki-asp), we have adapted them to fit the requirements of RAG tasks according to the methods commonly used within the community. All datasets are available at Huggingface datasets.

    For each dataset, we save each split as a jsonl file, and each line is a dict as follows:

    {
      'id': str,
      'question': str,
      'golden_answers': List[str],
      'golden_doc_ids': List[str],  # optional, for document-level retrieval metrics
      'metadata': dict
    }
    

    When golden_doc_ids is available, FlashRAG can evaluate retrieved source documents with retrieval_doc_recall, retrieval_doc_precision, retrieval_doc_f1, and retrieval_doc_map.

    Below is the list of datasets along with the corresponding sample sizes:

    TaskDataset NameKnowledge Source# Train# Dev# Test
    QANQwiki79,1688,7573,610
    QATriviaQAwiki & web78,7858,83711,313
    QAPopQAwiki//14,267
    QASQuADwiki87,59910,570/
    QAMSMARCO-QAweb808,731101,093/
    QANarrativeQAbooks and story32,7473,46110,557
    QAWikiQAwiki20,3602,7336,165
    QAWebQuestionsGoogle Freebase3,778/2,032
    QAAmbigQAwiki10,0362,002/
    QASIQA-33,4101,954/
    QACommonSenseQA-9,7411,221/
    QABoolQwiki9,4273,270/
    QAPIQA-16,1131,838/
    QAFermiwiki8,0001,0001,000
    multi-hop QAHotpotQAwiki90,4477,405/
    multi-hop QA2WikiMultiHopQAwiki15,00012,576/
    multi-hop QAMusiquewiki19,9382,417/
    multi-hop QABambooglewiki//125
    multi-hop QAStrategyQAwiki2290//
    Long-form QAASQAwiki4,353948/
    Long-form QAELI5Reddit272,6341,507/
    Long-form QAWikiPassageQAwiki3,332417416
    Open-Domain SummarizationWikiASPwiki300,63637,04637,368
    multiple-choiceMMLU-99,8421,53114,042
    multiple-choiceTruthfulQAwiki/817/
    multiple-choiceHellaSWAGActivityNet39,90510,042/
    multiple-choiceARC-3,3708693,548
    multiple-choiceOpenBookQA-4,957500500
    multiple-choiceQuaRTz-2696384784
    Fact VerificationFEVERwiki104,96610,444/
    Dialog GenerationWOWwiki63,7343,054/
    Entity LinkingAIDA CoNll-yagoFreebase & wiki18,3954,784/
    Entity LinkingWNEDWiki/8,995/
    Slot FillingT-RExDBPedia2,284,1685,000/
    Slot FillingZero-shot REwiki147,9093,724/
    In-domain QADomainRAGWeb pages of RUC//485

    Document Corpus

    Our toolkit supports jsonl format for retrieval document collections, with the following structure:

    {"id":"0", "contents": "..."}
    {"id":"1", "contents": "..."}
    

    The contents key is essential for building the index. For documents that include both text and title, we recommend setting the value of contents to {title}\n{text}. The corpus file can also contain other keys to record additional characteristics of the documents.

    In the academic research, Wikipedia and MS MARCO are the most commonly used retrieval document collections. For Wikipedia, we provide a comprehensive script to process any Wikipedia dump into a clean corpus. Additionally, various processed versions of the Wikipedia corpus are available in many works, and we have listed some reference links.

    For MS MARCO, it is already processed upon release and can be directly downloaded from its hosting link on Hugging Face.

    Index

    To facilitate easier replication of the experiments, we now provide a preprocessed index available in the ModelScope dataset page: FlashRAG_Dataset/retrieval_corpus/wiki18_100w_e5_index.zip.

    The index was created using the e5-base-v2 retriever on our uploaded wiki18_100w dataset, which is consistent with the index used in our experiments.

    :lollipop: Awesome Work using FlashRAG

    • R1-Searcher, a method that incentivizes the search capability in LLMs via reinforcement learning
    • ReSearch, a method that learns to reason with search for LLMs via reinforcement learning
    • AutoCoA, a method that internalizes chain-of-action generation into reasoning models

    :raised_hands: Additional FAQs

    :bookmark: License

    FlashRAG is licensed under the MIT License.

    :star2: Citation

    Please kindly cite our paper if helps your research:

    @inproceedings{FlashRAG,
      author       = {Jiajie Jin and
                      Yutao Zhu and
                      Zhicheng Dou and
                      Guanting Dong and
                      Xinyu Yang and
                      Chenghao Zhang and
                      Tong Zhao and
                      Zhao Yang and
                      Ji{-}Rong Wen},
      editor       = {Guodong Long and
                      Michale Blumestein and
                      Yi Chang and
                      Liane Lewin{-}Eytan and
                      Zi Helen Huang and
                      Elad Yom{-}Tov},
      title        = {FlashRAG: {A} Modular Toolkit for Efficient Retrieval-Augmented Generation
                      Research},
      booktitle    = {Companion Proceedings of the {ACM} on Web Conference 2025, {WWW} 2025,
                      Sydney, NSW, Australia, 28 April 2025 - 2 May 2025},
      pages        = {737--740},
      publisher    = {{ACM}},
      year         = {2025},
      url          = {https://doi.org/10.1145/3701716.3715313},
      doi          = {10.1145/3701716.3715313}
    }
    

    Star History

    Star History Chart