{"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/knowledge-base-question-answering-by-case","title":"Knowledge Base Question Answering by Case-based Reasoning over Subgraphs","arxiv_id":"2202.10610","date":"2022-02-22","proceeding":null,"authors":["Rajarshi Das","Ameya Godbole","Ankita Naik","Elliot Tower","Robin Jia","Manzil Zaheer","Hannaneh Hajishirzi","Andrew McCallum"],"abstract":"Question answering (QA) over knowledge bases (KBs) is challenging because of the diverse, essentially unbounded, types of reasoning patterns needed. However, we hypothesize in a large KB, reasoning patterns required to answer a query type reoccur for various entities in their respective subgraph neighborhoods. Leveraging this structural similarity between local neighborhoods of different subgraphs, we introduce a semiparametric model (CBR-SUBG) with (i) a nonparametric component that for each query, dynamically retrieves other similar $k$-nearest neighbor (KNN) training queries along with query-specific subgraphs and (ii) a parametric component that is trained to identify the (latent) reasoning patterns from the subgraphs of KNN queries and then apply them to the subgraph of the target query. We also propose an adaptive subgraph collection strategy to select a query-specific compact subgraph, allowing us to scale to full Freebase KB containing billions of facts. We show that CBR-SUBG can answer queries requiring subgraph reasoning patterns and performs competitively with the best models on several KBQA benchmarks. Our subgraph collection strategy also produces more compact subgraphs (e.g. 55\\% reduction in size for WebQSP while increasing answer recall by 4.85\\%)\\footnote{Code, model, and subgraphs are available at \\url{https://github.com/rajarshd/CBR-SUBG}}.","url_abs":"https://arxiv.org/abs/2202.10610v2","url_pdf":"https://arxiv.org/pdf/2202.10610v2.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":"knowledge-base-question-answering-by-case","repo_url":"https://github.com/rajarshd/cbr-subg","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"knowledge-base-question-answering","task_name":"Knowledge Base Question Answering"},{"task_slug":"question-answering","task_name":"Question Answering"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2202.10610","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2202.10610"}},"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":"deterministic:regex_extraction","url":"https://github.com/rajarshd/CBR-SUBG","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/rajarshd/cbr-subg","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"unverified":4},"by_repo_kind":{"official":{"samples":4,"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":"fdb222b2bc63bbcc","entry":"create_new_vocab","repo":"rajarshd/CBR-SUBG","repo_kind":"official","path":"adaptive_subgraph_collection/create_input_with_cbr_subgraph.py","file_url":"https://github.com/rajarshd/CBR-SUBG/blob/HEAD/adaptive_subgraph_collection/create_input_with_cbr_subgraph.py","link_basis":"harvester_set","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":"fdb222b2bc63bbcc"}},{"code_sha256_prefix":"57cd6171bd6cc811","entry":"gather_paths","repo":"rajarshd/CBR-SUBG","repo_kind":"official","path":"adaptive_subgraph_collection/adaptive_graph_collection.py","file_url":"https://github.com/rajarshd/CBR-SUBG/blob/HEAD/adaptive_subgraph_collection/adaptive_graph_collection.py","link_basis":"harvester_set","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":"57cd6171bd6cc811"}},{"code_sha256_prefix":"3fa9bfbde6dc1cfa","entry":"read_cbr_subgraphs","repo":"rajarshd/CBR-SUBG","repo_kind":"official","path":"adaptive_subgraph_collection/create_input_with_cbr_subgraph.py","file_url":"https://github.com/rajarshd/CBR-SUBG/blob/HEAD/adaptive_subgraph_collection/create_input_with_cbr_subgraph.py","link_basis":"harvester_set","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":"3fa9bfbde6dc1cfa"}},{"code_sha256_prefix":"21be15434d5e6ef7","entry":"sparqlQuery","repo":"rajarshd/CBR-SUBG","repo_kind":"official","path":"adaptive_subgraph_collection/adaptive_utils.py","file_url":"https://github.com/rajarshd/CBR-SUBG/blob/HEAD/adaptive_subgraph_collection/adaptive_utils.py","link_basis":"harvester_set","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":"21be15434d5e6ef7"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}