Reducing context size and increasing QA score simultaneously for ODQA(Open-Domain Question Answering)
Large Language Models (LLMs) demonstrate strong performance in various tasks like Question Answering and Reasoning. However, due to the nature of the Transformer structure, they are limited to considering only a restricted length of context. Despite recent attempts to extend context using techniques like Sparse Attention, there is a lack of research on context shortening. Reducing context while maintaining the same performance can be computationally efficient and particularly effective in removing noise that contained unrelated to query in document retrieved by Retrieval-Augmented Generation (RAG). Summarization is a task that creates a shorter version of text while preserving its principal information content. We proposes a ReSRer architecture, which incorporates a Summarizer model between the traditional Reader-Retriever architecture in an Open-Domain Question Answering system. This approach provides the several Reader and Retriever with improving the overall QA pipeline performance.
- Demo in Huggingface Space
![ReSRer Demo](image/image.png)
![ReSRer Demo](https://private-user-images.githubusercontent.com/27716524/323654065-ba5a6751-1091-498f-9807-ca431cb792d5.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM0MDgwOTcsIm5iZiI6MTcyMzQwNzc5NywicGF0aCI6Ii8yNzcxNjUyNC8zMjM2NTQwNjUtYmE1YTY3NTEtMTA5MS00OThmLTk4MDctY2E0MzFjYjc5MmQ1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODExVDIwMjMxN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTIyNjQ4M2Y0ZThiZmZkMWQwZjQ4ODVhMmMzZGMzYWUwMDdlNjk2MzU2ODA5MjkyYWU0M2E0ZGFiMjg5YTEyMGEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.U24xzrZgSJnRFDR5Zb3YZEfJGeotxO0Oms-5xC1qmns)
![ReSRer Demo](https://private-user-images.githubusercontent.com/27716524/323655015-82a15456-0cda-4a67-a2de-3ba3c3505fbb.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM0MDgwOTcsIm5iZiI6MTcyMzQwNzc5NywicGF0aCI6Ii8yNzcxNjUyNC8zMjM2NTUwMTUtODJhMTU0NTYtMGNkYS00YTY3LWEyZGUtM2JhM2MzNTA1ZmJiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODExVDIwMjMxN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWYzMDI2NDUwYjIyOWY4MDdiNDg1N2ZjMDAzZGQ2ODBlMThjN2I0NjA2NmM0YjdmZjQ5YmY1MGQ5NzEzNGMwYmQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.8SjbXHbHsmu17GReZwrTXL61gOOOA4oflRd3Mi2oXLs)
![Token count](https://private-user-images.githubusercontent.com/27716524/323654005-3f518759-8687-4675-becf-c5df1d785651.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM0MDgwOTcsIm5iZiI6MTcyMzQwNzc5NywicGF0aCI6Ii8yNzcxNjUyNC8zMjM2NTQwMDUtM2Y1MTg3NTktODY4Ny00Njc1LWJlY2YtYzVkZjFkNzg1NjUxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODExVDIwMjMxN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTY5NzkxMTliZTg2MmY5OTQ1NjNkNTRjYWQ5NDIxNGIzODZlYzEzNjA1NTY3ZGRjMjk3MjNmZmJiZGYzMzY2NmYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.CYyYlf5VM8scbT0J-vexE9uNiZ1eOLSmuWDRu5wqBXM)
We mainly focused on NQ(Natural Question) dataset for this time.
Extract a concise noun-based answer from the provided context for the question. Your answer should be under three words and extracted directly from a context of no more than five words. You can analyze the context step by step to derive the answer. Avoid using prefixes that indicate the type of answer; simply present the shortest relevant answer span from the context.
We did several
Condense the provided passages to focus on key elements directly answering the question. Your summary should be a third of the original passages' length and at least 150 words. Highlight critical information and evidence supporting the answer. Avoid generalizations or unrelated details. Ensure the final answer is present in the summary, keeping the exact span of the answer to under five words. Present the summary in a clear, bullet-point format for each key element related to the question. Aim for a balance between conciseness and completeness.
Trained model for ReSRer reader on Huggingface trained in 55k Training Dataset generated from GPT-3 with the below prompt Our main goal was not to train a summarizing small model, but rather to prove that a summarizer module between the retriever and reader is an efficient method. So, we did not delve into training with the most recent summarizer prompt dataset. Therefore, this model's performance is not as good as with the original context (even better than native summarizer though). We disclose this because it might be helpful for people who want to reduce computing costs dramatically.
As I mentioned earlier, our research was aimed at exploring the potential benefits of an effective abstractive summarizer for QA tasks. Initially, we planned to test this approach. However, given the significant advancements made by SuRe and LLMLingua in this domain, we decided to halt our research.
Although our improvements of 4% (which translates to nearly 20% from the original score) may not seem impressive, we demonstrate that a single summarizer module can effectively handle simple tasks such as single-hop question answering, in contrast to more complex multi-step approaches. However, we were unable to confirm whether this single-step context pruning is effective for more intricate tasks like reasoning and code generation. Therefore, there may be room for further contributions in this area in the future.
git clone https://github.com/seonglae/ReSRer
cd ReSRer
rye sync
# or
pip insatll .
# for training
pip install git+https://github.com/NVIDIA/TransformerEngine.git@stable
pip install --force-reinstall typing-extensions==4.5.0
pip uninstall deepspeed
pip install deepspeed
pip uninstall -y apex
MILVUS_PW=
MILVUS_HOST=resrer
python qa_pipeline.py
indexing.json
- check embedding dimension of tei
- subset target
- streaming or not
- collection name
python indexing.py
npm i -g pm2
model=
pm2 start data/tei.json