{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/corrective-retrieval-augmented-generation","title":"Corrective Retrieval Augmented Generation","arxiv_id":"2401.15884","date":"2024-01-29","proceeding":null,"authors":["Shi-Qi Yan","Jia-Chen Gu","Yun Zhu","Zhen-Hua Ling"],"abstract":"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.","url_abs":"https://arxiv.org/abs/2401.15884v3","url_pdf":"https://arxiv.org/pdf/2401.15884v3.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"corrective-retrieval-augmented-generation","repo_url":"https://github.com/huskyinsalt/crag","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"corrective-retrieval-augmented-generation","repo_url":"https://github.com/Grecil/Corrective-RAG","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok"}}],"tasks":[{"task_slug":"rag","task_name":"RAG"},{"task_slug":"retrieval","task_name":"Retrieval"},{"task_slug":"retrieval-augmented-generation","task_name":"Retrieval-augmented Generation"}],"methods":[{"method_slug":"focus","method_name":"Focus"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2401.15884","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2401.15884"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/huskyinsalt/crag","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/Grecil/Corrective-RAG","reach":{"status":"ok"}}],"summary":{"ran_draft_wrong":5},"by_repo_kind":{"official":{"samples":5,"ran":5,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":5,"samples":[{"code_sha256_prefix":"fe367c4c597e80fb","entry":"data_preprocess","repo":"huskyinsalt/crag","repo_kind":"official","path":"scripts/CRAG_Inference.py","file_url":"https://github.com/huskyinsalt/crag/blob/HEAD/scripts/CRAG_Inference.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"fe367c4c597e80fb"}},{"code_sha256_prefix":"e2fa12823815d636","entry":"data_preprocess","repo":"huskyinsalt/crag","repo_kind":"official","path":"scripts/train_evaluator.py","file_url":"https://github.com/huskyinsalt/crag/blob/HEAD/scripts/train_evaluator.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"e2fa12823815d636"}},{"code_sha256_prefix":"3881f4fd643eb25c","entry":"format_prompt","repo":"huskyinsalt/crag","repo_kind":"official","path":"scripts/CRAG_Inference.py","file_url":"https://github.com/huskyinsalt/crag/blob/HEAD/scripts/CRAG_Inference.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"3881f4fd643eb25c"}},{"code_sha256_prefix":"8074203f52def78e","entry":"get_data","repo":"huskyinsalt/crag","repo_kind":"official","path":"scripts/train_evaluator.py","file_url":"https://github.com/huskyinsalt/crag/blob/HEAD/scripts/train_evaluator.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"8074203f52def78e"}},{"code_sha256_prefix":"67c1d27cfad0cce6","entry":"postprocess_answer_option_conditioned","repo":"huskyinsalt/crag","repo_kind":"official","path":"scripts/CRAG_Inference.py","file_url":"https://github.com/huskyinsalt/crag/blob/HEAD/scripts/CRAG_Inference.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"67c1d27cfad0cce6"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}