RankRAG: Unifying Context Ranking with Retrieval-Augmented Generation in LLMs

Large language models (LLMs) typically utilize the top-k contexts from a retriever in retrieval-augmented generation (RAG). In this work, we propose a novel instruction fine-tuning framework RankRAG, which instruction-tunes a single LLM for the dual purpose of context ranking and answer generation in RAG. In particular, the instruction-tuned LLMs work surprisingly well by adding a small fraction of ranking data into the training blend, and outperform existing expert ranking models, including the same LLM exclusively fine-tuned on a large amount of ranking data. For generation, we compare our model with many strong baselines, including GPT-4-0613, GPT-4-turbo-2024-0409, and ChatQA-1.5, an open-sourced model with the state-of-the-art performance on RAG benchmarks. Specifically, our Llama3-RankRAG significantly outperforms Llama3-ChatQA-1.5 and GPT-4 models on nine knowledge-intensive benchmarks. In addition, it also performs comparably to GPT-4 on five RAG benchmarks in the biomedical domain without instruction fine-tuning on biomedical data, demonstrating its superb capability for generalization to new domains.

Paper

Similar papers

Peer review

Reviewer y5n55/10 · confidence 4/52024-07-08

Summary

This paper proposed a method about how to use a single LLM for both context reranking and answer in RAG tasks. Particularly, they finetuned a LLM with both ranking data and QA data with two stages. For inference, they use the trained llm to sample the top_k contexts at first, and then input them into llm to get the answer. Compared with normal rag workflow, this method choose the contexts by llm itself. Experiments in some QA tasks evaluated the QA effectiveness of this LLM.

Strengths

1. Two stages of training enhance the reranking capacity of llm using fewer ranking data. 2. Using just a single llm for context ranking and answer at the same time.

Weaknesses

1. The motivation is unclear. In lines 23 to 31, limitations 1 and 2 precisely explain the need for a reranker, which is also a challenge related to retrieval. Only with limited text in limitation 3 briefly mentions why the LLM is used for reranking contexts due to zero-shot performance, which has been proved with other rerankers in this paper. It is unclear about why using llm reranking itself rather than a separate reranker, maybe including the semantic gap between the reranker and llm or the larger length of reranking input at once. 2. Insufficient experiments in same reranking setting. It is lack of baselines with RAG methods also using a reranker, which can prove the core reranking effectiveness of RankRAG, such as rankgpt(Is ChatGPT Good at Search? Investigating Large Language Models as Re-Ranking Agents) and rankvicuna(RankVicuna: Zero-Shot Listwise Document Reranking with Open-Source Large Language Models). And also, the amount of top-k contexts after reranking is also hard to find in Table 2&6. How many contexts for reranking are input into llm at once? In addition, there are some blank spaces in Table 2 that are not convincing. 3. Incremental techniques. Compared with ChatQA, RankRAG introduced the new training data RQA and RAR in stage 2th and reranking phrase during inference. But as shown in ablation study, each component contribute a little.

Questions

1. Can you analyze the relationship between high retrieval call and QA performance in RankRAG for limitation2 on line 26? Can you provide further analysis to demonstrate that your method can solve this limitation? 2. Have you conducted experiments to test whether RankRAG's reranking performance is robust when using different retrievers on lines 300?

Rating

5

Confidence

4

Soundness

2

Presentation

3

Contribution

2

Limitations

No potential negative societal impacts.

Authorsrebuttal2024-08-13

A Gentle Reminder

Dear Reviewer y5n5, Thank you again for your detailed comments and constructive suggestions. We will incorporate all of them into the final version of our submission. We hope our response can help address your concerns. As the discussion period is closing, please let us know if you have any further questions. We would be happy to discuss them further with you. Best, Authors

Reviewer LbZs8/10 · confidence 4/52024-07-13

Summary

The authors introduce a novel approach to instruction fine-tuning large language models (LLMs) for ranking and answer generation tasks. Their approach involves two main steps: 1. Supervised Fine-Tuning: Initially, the LLM is fine-tuned on a general instruction-following dataset. 2. Ranking Task Fine-Tuning: The LLM is then further fine-tuned using a mix of different instruction ranking datasets that contains multiple ranking-oriented tasks. Incorporating ranking-based data during fine-tuning enhances the LLM's ability to rank documents retrieved through retrieval-augmented generation (RAG). The fine-tuned LLM is then used to rank the RAG-retrieved documents, and only the top-k ranked documents are added in the context. The authors demonstrate that their method significantly improves the LLM's performance for knowledge intensive RAG based tasks.

Strengths

1. The authors introduce a novel method of fine-tuning LLMs for combined ranking and answer generation tasks. 2. The proposed method outperforms existing approaches on RAG benchmarks, especially on challenging datasets where RAG retrieval is suboptimal, due to the LLM-based re-ranking. 3. Their model exceeds the performance of re-ranking models trained on much larger datasets. 4. The fine-tuned LLM demonstrates strong generalization capabilities, showcased by its performance on medical benchmarks. 5. The paper is well-written and includes exhaustive experiments.

Weaknesses

1. Scoring each document individually increases the latency significantly. Have you considered scoring multiple documents simultaneously? Similar to retrieval-augmented ranking dataset, you could input a group of documents and score them in a single pass. The group size could be tunable, balancing performance drop against latency improvement. 2. It would be helpful to include examples where RankRAG fails, particularly in cases where relevant documents are not ranked higher. Providing these examples can help understand scenarios where it might not perform optimally.

Questions

N/A

Rating

8

Confidence

4

Soundness

4

Presentation

4

Contribution

4

Limitations

The authors have acknowledged the limitations, specifically in terms of latency and its lack of training on code or mathematical data.

Reviewer ze6x8/10 · confidence 5/52024-07-19

Summary

This work proposes an effective approach that enhances existing RAG methods by introducing an additional context refinement step. This step filters out retrieved, but non-relevant contexts prior to including them as context in the input for answer generation. The authors train context reranking alongside answer generation using a single LLM. They demonstrate that adding only a fraction of ranking data to the training blend yields superior ranking performance compared to training the same model in isolation on the ranking data, while outperforming other models that have been trained on 10 times more ranking data. For evaluation, the authors compare their method on 9 general- and 5 specific-domain datasets, showing consistent improvements across LLM sizes for the Llama model family (Llama 2 and 3) over existing methods.

Strengths

- The paper introduces the novel idea of using the same LLM to first assess the relevance of individual contexts in a cross-encoder ranking style before using them as input for answer generation. - The proposed RankRAG outperforms existing methods on various general and specific-domain datasets. - Extensive experimentation and ablations covers a wide range of possible setups including LLM size, retriever, and efficiency and effect of different model components.

Weaknesses

Main concern: - Reranking contributes only around 5% of the overall effectiveness on average (Table 4 RankRAG compared to Llama3-ChatQA-1.5-X), and the 7x computational overhead in inference time raises questions about its realistic application, given the computational demands of large models already without ranking contexts. The ratio of performance gained ( in combination with no sig. testing) and increase in computation is my main issue with this work. I am aware reranking fewer contexts decreases performance, however, similarity decreases performance gain over other methods. - No significance testing was done (for both generation on ranking ) to strengthen effectiveness claims as differences for most datasets are minor. Authors justify in their additionally provided checklist that sig. testing is not needed as generation and ranking is deterministic, this however, touches upon a different aspect and does not remove the need for testing whether the performance is significantly better than previous methods. Further, improvements in Table 2 stem from NQ and PopQA which are relatively simple datasets that can be answered with a single context, therefore it is not apparent why RankRAG would particularly excel at those. Moreover, the ranking performance for these datasets in Table 6 only marginally improves over other rerankers, therefore it is to be expected to obtain similar gains when replacing the RankRAG reranker module with other strong rerankers. As a side note averaging over different metrics - even though seen in many recent works - should not be done. Other points to improve upon: - No information about the crowdsourced dataset is provided. - In Section 4.2.3, the claim that LLM needs to be robust against irrelevant context contradicts the proposal to filter out irrelevant context beforehand. Some experimental setups are unclear: - It is not described how true/false tokens from context ranking are translated into a score that can be used for ranking. - In Section 5.1, it is not clear if baselines use different retrieval setups; otherwise, effectiveness claims do not seem valid. - It is unclear which number k is eventually used in RankRAG. The paper mentions optimizing for k=5,10,20, the baselines. - The related work section could mention GRITLM as the first model jointly training answer generation and ranking for RAG: Muennighoff, Niklas, et al. "Generative representational instruction tuning." arXiv preprint arXiv:2402.09906 (2024). Issues in Writing: - Line 332: "Observe that even with N = 20, We noted that" – incomplete sentence. - Line 41: "in RAG framework" -> "in the RAG framework". - Caption Fig 1: "the strongest RAG model," -> "the strongest RAG models,". - Line 100: "embedding model" -> "embedding models". - Line 111: "As illurstraded" -> "As illustrated". - Line 112: "one of the strongest model." -> "one of the strongest models". - Line 157: "that, it is" -> "that it is". - Line 165: "The LLM need" -> "The LLM needs". - Line 169: "ranking data are" -> "ranking data is".

Questions

- Why is a fixed number of contexts used? Some questions might need more contexts such as multi-hop datasets while others such as NQ (single context dataset) would need less. Instead of a score cutoff, why not use a dynamic number of contexts that is determined by the binary true/false label the mode already outputs? - In Section 5.4, the paper states that it incurs an additional 1.8× to 7.0× increase in time, significantly less than the 20× to 100× increase one might expect. It is not sufficiently explained why one would expect a 100x increase in time. - The approach for reranking context looks at passages individually, but retrieval training included listwise ranking. Was listwise ranking also tried for context reranking?

Rating

8

Confidence

5

Soundness

4

Presentation

3

Contribution

3

Limitations

The authors addressed the limitations adequately, however, could emphasize more on the dramatic inference time increase that results from the reranking step.

Authorsrebuttal2024-08-07

Response to the remaining questions

This is a follow-up response to the remaining questions. The author's rebuttal will be released after the rebuttal deadline. It is recommended to read this response along with the rebuttal. --- > "The related work section could mention GRITLM" - Many thanks for mentioning this very relevant paper. We will cite and discuss it in our paper. --- > “In Section 5.1, it is not clear if baselines use different retrieval setups.” - Good question. we note that RankRAG and top baselines such as Llama-3-Instruct, ChatQA-1.5, InstructRetro, RA-DIT, and RePlug all employ DRAGON retriever, and some methods further finetune DRAGON (e.g. RA-DIT) for RAG applications. In main experiments of Table 2, we adopt the original setup of DRAGON as Llama3-Instruct, ChatQA-1.5 and InstructRetro to ensure a fair comparison, as RA-DIT and RePlug do not release their fine-tuned DRAGON. - Self-RAG uses Contriever by default. Comparing RankRAG-8b and Self-RAG-13b with the same retriever (Contriever/DRAGON) and corpus (Wikipedia), RankRAG consistently outperforms Self-RAG by 1.5%-8% on TriviaQA and PopQA, as detailed in Table 8 of the attached PDF in the author rebuttal. --- > “Issues in Writing: ...” - We appreciate the detailed comments. We will follow your advice to fix these typos. --- > “Why not use a dynamic number of contexts that is determined by the binary true/false label the mode already outputs?” - Thanks for this very interesting suggestion! We have compared this idea v.s. static $k$ on four datasets, but does not observe significant gains. Please refer to Table 7 of the attached PDF in author rebuttal for details. --- > “It is not sufficiently explained why one would expect a 100x increase in time.” - This is due to the need for an additional 100 LLM forward passes for ranking inferences. However, these inferences are much more efficient. --- > “Was listwise ranking also tried for context reranking?” - Thanks for raising this question. Indeed, we tried listwise ranking in our early experiments, but did not observe performance gains. Besides, we have also evaluated RankVicuna, a listwise ranking model in Table 6 of the supplementary PDF but found it generally performs worse than pointwise methods. Exploring how to further improve the model using listwise ranking can be an interesting future work. --- --- Thank you once again for your review. We wish our response could address your concerns. If you have any further questions, we would be happy to discuss them further.

Reviewer ze6x2024-08-08

Additional results significantly strengthened experimental results

I thank the authors for addressing all of my questions and for providing extensive additional experiments that I believe strengthen the experimental results and help to back up the claims that the authors made. I am willing to update my score, given that these results find their way into the final version of the manuscript. The last remaining question regards the type of significance testing that was done. Why did the authors choose Fisher's randomization test over a vanilla paired t-test?

Authorsrebuttal2024-08-09

Thank you so much for your reply and your kind words regarding the update of the score. We sincerely appreciate your constructive comments and suggestions, which greatly enhance the quality of our paper. We will incorporate all these additional results into the final version of the paper. Regarding your last question, we chose Fisher's randomization test since the distribution of test statistics in practical scenarios is often unknown and may not conform to a Gaussian distribution. Under such conditions, non-parametric tests like Fisher's randomization test are preferred for assessing statistical significance. This method is commonly employed in studies in the fields of Natural Language Processing (NLP) [1] and Information Retrieval (IR) [2]. Per your question, we also tried paired t-test in the following: | Metric | NQ | TQA | PopQA | HotpotQA | 2wikimQA | Fever | Doc2dial | TopiOCQA | Inscit | |--------|---------|-----------|-----------|----------|-----------|----------|----------|----------|--------| | RankRAG 8B v.s. ChatQA-1.5-8B | **7e-6** | **2e-6/1e-5** | **4e-7/1e-5** | **0.04/0.03** |**9e-7/6e-7** | **1.9e-3** | **0.03** | 0.15 | **0.02** | | RankRAG 70B v.s. ChatQA-1.5-70B | **3e-6** | **3e-4/4e-4** | **2e-8/8e-6** | 0.12/0.08 | **1e-5/8e-6** | **4.00e-3** | 0.19 | -- | **0.03** | From the paired t-test results, we observe that RankRAG significantly outperforms ChatQA-1.5 on the majority of datasets (8 out of 9 for 8B and 6 out of 9 for 70B). --- References: [1] Dror et al. "The hitchhiker’s guide to testing statistical significance in natural language processing." ACL. 2018. [2] Smuckere et al. "A comparison of statistical significance tests for information retrieval evaluation." CIKM. 2007.

Reviewer LbZs2024-08-13

Thanks for the response. Including failure cases in the final version would be great.

Authorsrebuttal2024-08-13

Thank you again for your insightful feedback! We will incorporate them in our next version of the manuscript.

Program Chairsdecision2024-09-25

Decision

Accept (poster)

© 2026 NYSGPT2525 LLC