Skip to content

Latest commit

 

History

History
79 lines (63 loc) · 3.45 KB

Readme.md

File metadata and controls

79 lines (63 loc) · 3.45 KB

FastFiD: Improve Inference Efficiency of Open Domain Question Answering via Sentence Selection

This is the official PyTorch implementation for ACL 2024 paper "FastFiD: Improve Inference Efficiency of Open Domain Question Answering via Sentence Selection"

Quick Links

Overview

model In this work, we propose FastFiD, which executes sentence selection on the encoded passages to address the inference efficiency problem of FiD and other similar RAG system. This aids in retaining valuable information while reducing the context length required for generating answers. Experiments on three commonly used datasets (Natural Questions, TriviaQA and ASQA) demonstrate that our method can enhance the inference speed by 2.3X-5.7X, while simultaneously maintaining the model’s performance.

Requirments

  • Python: 3.8.12
pip install -r requirements.txt

Note that you should install the correct version of PyTorch that matches your CUDA version. See PyTorch official website for instructions.

Model and Data Preparation

Required checkpoints and embeddings

Retriever Model:

Pretrained Model:

Required data files

Wikipedia evidence passages & NQ & TriviaQA & ASQA

Data Process

  1. Build retriving index for wikipedia passages using retriever models.
    bash scripts/build_index.sh
  2. Process datas to get retrieved passages for each qa pair.
    bash scripts/evaluate_retriever.sh
    bash scripts/build_qap_dataset.sh
  3. Process data to recognize supported sentences in retrieved passages.
    bash scripts/build_qap_sentence_dataset.sh

Main Experiments

results

First Stage Training

During the first stage training, we will utilize a multi-task training method, which involves sentence selection and answer generation. By doing this, we will get a model which can not only predict final answer given question and retrieved passages, but also select valuable information in the retrieved passages.

bash scripts/train_hybrid.sh

Second Stage Training

In this stage, we will train the model to make predictions based only on the selected information to achieve inference acceleration.

bash scripts/train_select_generation.sh