{"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/arxiv-2602-05728","title":"CompactRAG: Reducing LLM Calls and Token Overhead in Multi-Hop Question Answering","arxiv_id":"2602.05728","date":"2026-02-05","proceeding":null,"authors":["Hao Yang","Zhiyu Yang","Xupeng Zhang","Wei Wei","Yunjie Zhang","Lin Yang"],"abstract":"Retrieval-augmented generation (RAG) has become a key paradigm for knowledge-intensive question answering. However, existing multi-hop RAG systems remain inefficient, as they alternate between retrieval and reasoning at each step, resulting in repeated LLM calls, high token consumption, and unstable entity grounding across hops. We propose CompactRAG, a simple yet effective framework that decouples offline corpus restructuring from online reasoning. In the offline stage, an LLM reads the corpus once and converts it into an atomic QA knowledge base, which represents knowledge as minimal, fine-grained question-answer pairs. In the online stage, complex queries are decomposed and carefully rewritten to preserve entity consistency, and are resolved through dense retrieval followed by RoBERTa-based answer extraction. Notably, during inference, the LLM is invoked only twice in total - once for sub-question decomposition and once for final answer synthesis - regardless of the number of reasoning hops. Experiments on HotpotQA, 2WikiMultiHopQA, and MuSiQue demonstrate that CompactRAG achieves competitive accuracy while substantially reducing token consumption compared to iterative RAG baselines, highlighting a cost-efficient and practical approach to multi-hop reasoning over large knowledge corpora. The implementation is available at GitHub.","url_abs":"https://arxiv.org/abs/2602.05728","url_pdf":"https://arxiv.org/pdf/2602.05728","source":{"archive":null,"snapshot":"2025-07-28","note":"not in the Papers with Code archive (frozen at the snapshot)","row_kind":"graph","title_abstract_authors_date":"arXiv metadata, CC0 1.0 (https://info.arxiv.org/help/license)"},"code_links":[],"tasks":[],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":null,"mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2602.05728"}},"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":[{"mentioned_in_github":null,"is_official":null,"provenance":"deterministic:regex_extraction","mentioned_in_paper":null,"url":"https://github.com/How-Young-X/CompactRAG","reach":null}],"summary":{"unverified":10},"by_repo_kind":{"found_in_text":{"samples":10,"ran":0,"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":0,"samples":[{"code_sha256_prefix":"0098b487d7dc437e","entry":"coverage_check","repo":"How-Young-X/CompactRAG","repo_kind":"found_in_text","path":"src/core/ReadingCorpus.py","file_url":"https://github.com/How-Young-X/CompactRAG/blob/HEAD/src/core/ReadingCorpus.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"0098b487d7dc437e"}},{"code_sha256_prefix":"1a90d2afb9055e47","entry":"exact_match_score","repo":"How-Young-X/CompactRAG","repo_kind":"found_in_text","path":"src/metrics/F1Eval.py","file_url":"https://github.com/How-Young-X/CompactRAG/blob/HEAD/src/metrics/F1Eval.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"1a90d2afb9055e47"}},{"code_sha256_prefix":"dabb9e40f05a14a2","entry":"extract_entities_and_relations","repo":"How-Young-X/CompactRAG","repo_kind":"found_in_text","path":"ReadingCorpus2.py","file_url":"https://github.com/How-Young-X/CompactRAG/blob/HEAD/ReadingCorpus2.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"dabb9e40f05a14a2"}},{"code_sha256_prefix":"9f0a5786975dd602","entry":"extract_json","repo":"How-Young-X/CompactRAG","repo_kind":"found_in_text","path":"src/core/AskCorpus.py","file_url":"https://github.com/How-Young-X/CompactRAG/blob/HEAD/src/core/AskCorpus.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"9f0a5786975dd602"}},{"code_sha256_prefix":"a4de989b76f916f5","entry":"f1_score","repo":"How-Young-X/CompactRAG","repo_kind":"found_in_text","path":"src/metrics/F1Eval.py","file_url":"https://github.com/How-Young-X/CompactRAG/blob/HEAD/src/metrics/F1Eval.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"a4de989b76f916f5"}},{"code_sha256_prefix":"9f6e3af87078a74c","entry":"format_entities_for_prompt","repo":"How-Young-X/CompactRAG","repo_kind":"found_in_text","path":"ReadingCorpus2.py","file_url":"https://github.com/How-Young-X/CompactRAG/blob/HEAD/ReadingCorpus2.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"9f6e3af87078a74c"}},{"code_sha256_prefix":"95285251b374c3d2","entry":"has_bad_word","repo":"How-Young-X/CompactRAG","repo_kind":"found_in_text","path":"ReadingCorpus2.py","file_url":"https://github.com/How-Young-X/CompactRAG/blob/HEAD/ReadingCorpus2.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"95285251b374c3d2"}},{"code_sha256_prefix":"7c8c64b457f3afd4","entry":"has_bad_word","repo":"How-Young-X/CompactRAG","repo_kind":"found_in_text","path":"src/core/ReadingCorpus.py","file_url":"https://github.com/How-Young-X/CompactRAG/blob/HEAD/src/core/ReadingCorpus.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"7c8c64b457f3afd4"}},{"code_sha256_prefix":"26a63699755bd04e","entry":"normalize_answer","repo":"How-Young-X/CompactRAG","repo_kind":"found_in_text","path":"src/metrics/F1Eval.py","file_url":"https://github.com/How-Young-X/CompactRAG/blob/HEAD/src/metrics/F1Eval.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"26a63699755bd04e"}},{"code_sha256_prefix":"911346ae88836fbc","entry":"validate_qa_pairs","repo":"How-Young-X/CompactRAG","repo_kind":"found_in_text","path":"src/core/AskCorpus.py","file_url":"https://github.com/How-Young-X/CompactRAG/blob/HEAD/src/core/AskCorpus.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"911346ae88836fbc"}}]},"arxiv_metadata":{"licence":"arXiv metadata, CC0 1.0 (https://info.arxiv.org/help/license)","fields":["title","abstract","authors","date"],"primary_category":"cs.CL","source":"arxiv_2026.jsonl"},"syntology_extracted_results":null}