Source-linked AI summary

Corrective Retrieval Augmented Generation

Shi-Qi Yan, Jia-Chen Gu, Yun Zhu, Zhen-Hua Ling

arXiv:2401.15884v3cs.CL

TL;DR

LLM hallucinations and RAG’s dependence on accurate retrieval create a need for robustness when retrieval fails. CRAG evaluates retrieved documents, selectively refines or supplements them with web search, and significantly improves RAG-based performance across short- and long-form tasks.

  • Problem

    LLMs hallucinate, while RAG performance depends heavily on the relevance and accuracy of retrieved documents, leaving retrieval failures problematic.

  • Method

    CRAG uses a lightweight retrieval evaluator to trigger Correct, Incorrect, or Ambiguous actions, refine retrieved knowledge, and augment it with web search.

  • Results

    CRAG significantly improves standard RAG and Self-RAG across four datasets covering short-form, long-form, and closed-set generation tasks.

  • Takeaways & Limitations

    CRAG is a plug-and-play approach adaptable to RAG-based systems and supports automatic self-correction and efficient retrieved-document utilization.

  • Takeaways & Limitations

    Preliminary experiments found CRAG’s efficacy was easily affected by retrieval-evaluator accuracy when only Correct and Incorrect actions were used.

Abstract

from arXiv · show

Large language models (LLMs) inevitably exhibit hallucinations since the accuracy of generated texts cannot be secured solely by the parametric knowledge they encapsulate. Although retrieval-augmented generation (RAG) is a practicable complement to LLMs, it relies heavily on the relevance of retrieved documents, raising concerns about how the model behaves if retrieval goes wrong. To this end, we propose the Corrective Retrieval Augmented Generation (CRAG) to improve the robustness of generation. Specifically, a lightweight retrieval evaluator is designed to assess the overall quality of retrieved documents for a query, returning a confidence degree based on which different knowledge retrieval actions can be triggered. Since retrieval from static and limited corpora can only return sub-optimal documents, large-scale web searches are utilized as an extension for augmenting the retrieval results. Besides, a decompose-then-recompose algorithm is designed for retrieved documents to selectively focus on key information and filter out irrelevant information in them. CRAG is plug-and-play and can be seamlessly coupled with various RAG-based approaches. Experiments on four datasets covering short- and long-form generation tasks show that CRAG can significantly improve the performance of RAG-based approaches.

1 Introduction

RAG supplements LLMs with retrieved knowledge, but inaccurate or irrelevant retrieval can mislead generation. CRAG addresses this by evaluating retrieval quality, selectively correcting knowledge, and improving RAG-based performance across diverse tasks.

  • RAG augments LLM inputs with external documents, but its effectiveness depends on retrieved-document relevance and accuracy.
  • Low-quality retrieval can introduce irrelevant information that impedes accurate knowledge acquisition and potentially causes hallucinations.
  • CRAG evaluates retrieved-document quality, assigns Correct, Incorrect, or Ambiguous confidence actions, and uses web search when static corpora are insufficient.
  • CRAG refines retrieved documents by extracting key knowledge and filtering non-essential content.
  • CRAG is plug-and-play and improves standard RAG and Self-RAG across four datasets spanning short- and long-form generation.

2 Related Work

Prior work uses retrieval to augment generation, but commonly overlooks the consequences of incorrect retrieval. CRAG differs by targeting corrective strategies for inaccurate retrieved results and robustness of generation.

  • RAG supplements generative models with relevant documents from an external corpus, improving performance especially on knowledge-intensive tasks.
  • Earlier RAG systems use sparse or dense retrievers but generally overlook what happens when retrieval returns inaccurate knowledge.
  • Advanced approaches address selective retrieval, irrelevant context, instruction insertion, or API calls, rather than specifically correcting inaccurate retrieval.
  • CRAG focuses on designing corrective strategies for RAG when retrieval goes wrong, distinguishing it from closely related approaches.

3 Task Formulation

The task formulation separates retrieval from generation: a retriever selects documents relevant to an input, and a generator produces the output from the input and retrieved results. This coupling makes failed retrieval consequential.

  • Given input X and corpus C, the retriever R selects top-K relevant documents D for the generator.
  • The generator G uses input X and retrieved documents D to generate output Y.
  • Because retriever and generator are tightly coupled, unsuccessful retrieval can produce an unsatisfactory response despite generator capability.

4 CRAG

CRAG evaluates retrieved documents and routes inference through corrective actions based on confidence. It refines correct results and supplements incorrect or uncertain retrieval with external knowledge.

  • A lightweight evaluator scores document relevance and converts the scores into Correct, Incorrect, or Ambiguous confidence actions.
  • For Correct retrieval, CRAG decomposes, filters, and recomposes documents into more precise knowledge strips.
  • Evaluator accuracy affects downstream system performance, motivating careful retrieval-quality assessment.
  • The inference algorithm evaluates each retrieved question-document pair, aggregates scores into a confidence judgment, and generates a response.

14 G predicts y given x and k

CRAG evaluates retrieval confidence and selectively applies correction, refinement, or combined knowledge actions. It supplements weak retrieval with web knowledge and uses an ambiguous action to reduce dependence on evaluator accuracy.

  • Action Trigger: CRAG assigns retrieval-confidence scores that trigger Correct, Incorrect, or Ambiguous actions.Correct and Incorrect correspond to high- and low-confidence retrieval, while intermediate confidence triggers Ambiguous processing.
  • Action Trigger: Incorrect retrieval triggers web search to obtain new knowledge rather than remain stuck with unreliable results.The paper uses web search as a corrective action when retrieved knowledge is judged inaccurate.
  • Discussion: Preliminary experiments found that using only Correct and Incorrect actions made efficacy sensitive to retrieval-evaluator accuracy, while Ambiguous processing reduced this dependence.The Ambiguous action combines processed Correct and Incorrect knowledge instead of switching distinctly for every case.
  • Knowledge Refinement: Retrieved relevant documents are segmented into smaller strips, then refined to extract critical knowledge and filter irrelevant content.Short results may remain individual strips, whereas longer documents are split into units of a few sentences.
  • External Knowledge: Web-derived knowledge is refined using the same method, with authoritative pages such as Wikipedia preferred to mitigate bias and unreliability.CRAG navigates returned URLs, transcribes page content, and derives relevant external knowledge.

5 Experiments

Experiments evaluate CRAG across four datasets, multiple RAG baselines, ablations, retrieval-evaluator comparisons, and robustness tests. CRAG improves RAG-based generation across tasks and remains more robust as retrieval quality declines.

  • Tasks, Datasets and Metrics: CRAG is evaluated on PopQA, Biography, PubHealth, and Arc-Challenge using accuracy or FactScore across short-form, long-form, true-or-false, and multiple-choice tasks.The experiments use the same retrieval results as previous work while applying corrective strategies to improve retrieval quality.
  • Baselines: The study compares no-retrieval models, standard RAG, and advanced RAG systems including SAIL and Self-RAG, using several underlying language models.CRAG and Self-CRAG denote the proposed method coupled with standard RAG and Self-RAG, respectively.
  • Results: CRAG improved RAG by 7.0% accuracy on PopQA, 14.9% FactScore on Biography, 36.6% accuracy on PubHealth, and 15.4% accuracy on Arc-Challenge with SelfRAG-LLaMA2-7b.With LLaMA2-hf-7b, CRAG exceeded RAG by 4.4% accuracy on PopQA, 2.8% FactScore on Biography, and 10.3% on Arc-Challenge.
  • Results: Self-CRAG outperformed Self-RAG by margins reaching 20.0% accuracy on PopQA, 36.9% FactScore on Biography, and 4.0% accuracy on Arc-Challenge with LLaMA2-hf-7b.The reported gains also include 6.9% accuracy on PopQA, 5.0% FactScore on Biography, and 2.4% accuracy on PubHealth with SelfRAG-LLaMA2-7b.
  • Results: CRAG showed consistent effectiveness across short-form, long-form, and closed-set tasks, demonstrating generalizability across diverse generation scenarios.The benchmarks represent entity generation, long-form generation, true-or-false questions, and multiple-choice questions.
  • Robustness to Retrieval Performance: As retrieval performance declined, both Self-RAG and Self-CRAG degraded, but Self-CRAG declined more slightly, indicating greater robustness to poor retrieval.The study simulated low-quality retrieval by randomly removing part of the accurate retrieval results.

6 Conclusion & Limitation

CRAG improves RAG robustness by evaluating retrieval quality, selectively applying corrective retrieval actions, and refining knowledge utilization. Its adaptability and generalizability are demonstrated across RAG-based approaches and short- and long-form tasks, while external evaluator fine-tuning remains necessary.

  • CRAG addresses inaccurate retrieval in RAG-based approaches by improving automatic self-correction and efficient utilization of retrieved documents.
  • CRAG combines a lightweight retrieval evaluator with web search and optimized knowledge utilization to improve generation robustness.
  • Experiments demonstrate CRAG’s adaptability to RAG-based approaches and generalizability across short- and long-form generation tasks.
  • Fine-tuning an external retrieval evaluator remains necessary, motivating future work on evaluator-free retrieval assessment by LLMs.

A Task Prompts

The appendix documents prompts for generating web-search keywords and evaluating retrieved documents. It includes direct, chain-of-thought, and few-shot evaluator prompts alongside question-document examples and binary answers.

  • A Task Prompts: The appendix includes a few-shot prompt for generating knowledge keywords as web search queries.
  • A Task Prompts: It includes direct, chain-of-thought, and few-shot prompts for instructing GPT-3.5 Turbo as a retrieval evaluator.
  • A Task Prompts: The evaluator prompt asks whether a document contains exact information needed to answer a question, requiring only a yes-or-no response.
  • A Task Prompts: An example labels a document as relevant when it identifies Wilcza Jama as being in Poland.
  • A Task Prompts: Another example labels a document as relevant to a question about the sport played at the 2004 Legg Mason Tennis Classic.
  • A Task Prompts: A document describing The Skin We’re In by Desmond Cole is labeled irrelevant for the question asking who authored Skin.
  • A Task Prompts: The appendix also provides a generic question-document-answer prompt template without a filled example.

B.1 Tasks, Datasets and Metrics

CRAG is evaluated on four public research datasets spanning short-form generation, long-form biography generation, health true-or-false questions, and multiple-choice science questions. Accuracy is used for three datasets, while Biography uses FactScore.

  • CRAG is evaluated on four public-domain datasets licensed for research purposes.
  • PopQA tests short-form generation, using 1,399 rare-entity queries from a long-tail subset and accuracy as its metric.
  • Biography tests detailed long-form biography generation and uses FactScore to evaluate the generated biographies.
  • PubHealth contains healthcare true-or-false questions requiring factuality judgments, evaluated with accuracy.
  • Arc-Challenge presents daily commonsense science phenomena with three or four answer choices and uses accuracy.
  • Experiments used an NVIDIA A800 80GB GPU, while LLaMA-2 7B inference occupied over 40GB of memory.

B.3 Implementation Details

Implementation fine-tunes a lightweight retrieval evaluator, applies document segmentation and external search, and integrates CRAG with LLaMA2 and Self-RAG. Additional materials describe ablations and a task-specific instruction-comprehension issue.

  • The retrieval evaluator is fine-tuned from T5-large, using non-test PopQA samples while transferring the evaluator to Bio, Pub, and ARC during inference.
  • Evaluator relevance scores range from -1 to 1, with empirically selected confidence thresholds varying across datasets.
  • Retrieved documents are segmented into internal strips so filtering can operate on smaller units containing independent information.
  • Google Search API retrieves five URLs, preferentially including Wikipedia, and evaluator-based paragraph selection is applied to web pages.
  • CRAG supports RAG-compatible generators and is implemented with LLaMA2 and SelfRAG-LLaMA2-7b for baseline-consistent comparisons.
  • Self-CRAG replaces Self-RAG’s retrieved items with processed internal, external, or combined knowledge for Correct, Incorrect, or Ambiguous cases.
  • LLaMA2-hf-7b performs poorly on PubHealth partly because it often fails to generate the required binary labels, with a similar issue on Arc-Challenge.
Loading 2401.15884v3…