{"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/unikgqa-unified-retrieval-and-reasoning-for","title":"UniKGQA: Unified Retrieval and Reasoning for Solving Multi-hop Question Answering Over Knowledge Graph","arxiv_id":"2212.00959","date":"2022-12-02","proceeding":null,"authors":["Jinhao Jiang","Kun Zhou","Wayne Xin Zhao","Ji-Rong Wen"],"abstract":"Multi-hop Question Answering over Knowledge Graph~(KGQA) aims to find the answer entities that are multiple hops away from the topic entities mentioned in a natural language question on a large-scale Knowledge Graph (KG). To cope with the vast search space, existing work usually adopts a two-stage approach: it first retrieves a relatively small subgraph related to the question and then performs the reasoning on the subgraph to find the answer entities accurately. Although these two stages are highly related, previous work employs very different technical solutions for developing the retrieval and reasoning models, neglecting their relatedness in task essence. In this paper, we propose UniKGQA, a novel approach for multi-hop KGQA task, by unifying retrieval and reasoning in both model architecture and parameter learning. For model architecture, UniKGQA consists of a semantic matching module based on a pre-trained language model~(PLM) for question-relation semantic matching, and a matching information propagation module to propagate the matching information along the directed edges on KGs. For parameter learning, we design a shared pre-training task based on question-relation matching for both retrieval and reasoning models, and then propose retrieval- and reasoning-oriented fine-tuning strategies. Compared with previous studies, our approach is more unified, tightly relating the retrieval and reasoning stages. Extensive experiments on three benchmark datasets have demonstrated the effectiveness of our method on the multi-hop KGQA task. Our codes and data are publicly available at~\\url{https://github.com/RUCAIBox/UniKGQA}.","url_abs":"https://arxiv.org/abs/2212.00959v2","url_pdf":"https://arxiv.org/pdf/2212.00959v2.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":"unikgqa-unified-retrieval-and-reasoning-for","repo_url":"https://github.com/rucaibox/unikgqa","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"language-modelling","task_name":"Language Modelling"},{"task_slug":"multi-hop-question-answering","task_name":"Multi-hop Question Answering"},{"task_slug":"question-answering","task_name":"Question Answering"},{"task_slug":"retrieval","task_name":"Retrieval"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2212.00959","atlas_url":"https://app.syntology.ai/?focus=2212.00959","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2212.00959"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+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/RUCAIBox/UniKGQA","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/rucaibox/unikgqa","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":9,"unverified":8},"by_repo_kind":{"official":{"samples":17,"ran":9,"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":"33c05189007d001e","entry":"compute_gold_const_rel_recall","repo":"RUCAIBox/UniKGQA","repo_kind":"official","path":"UniModel/extract_abstract_subgraph.py","file_url":"https://github.com/RUCAIBox/UniKGQA/blob/HEAD/UniModel/extract_abstract_subgraph.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"33c05189007d001e"}},{"code_sha256_prefix":"c9ddcdb426b7415c","entry":"compute_gold_rel_str_recall","repo":"RUCAIBox/UniKGQA","repo_kind":"official","path":"UniModel/extract_abstract_subgraph.py","file_url":"https://github.com/RUCAIBox/UniKGQA/blob/HEAD/UniModel/extract_abstract_subgraph.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"c9ddcdb426b7415c"}},{"code_sha256_prefix":"a8bf75a4078ff37e","entry":"extract_shortest_paths","repo":"RUCAIBox/UniKGQA","repo_kind":"official","path":"UniModel/extract_abstract_subgraph.py","file_url":"https://github.com/RUCAIBox/UniKGQA/blob/HEAD/UniModel/extract_abstract_subgraph.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"a8bf75a4078ff37e"}},{"code_sha256_prefix":"6cc4c2a66647120f","entry":"get_answers","repo":"RUCAIBox/UniKGQA","repo_kind":"official","path":"UniModel/convert_abs_to_NSM_format.py","file_url":"https://github.com/RUCAIBox/UniKGQA/blob/HEAD/UniModel/convert_abs_to_NSM_format.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"6cc4c2a66647120f"}},{"code_sha256_prefix":"e27d30e88c385923","entry":"get_global_const_entities","repo":"RUCAIBox/UniKGQA","repo_kind":"official","path":"UniModel/convert_inst_to_NSM_format.py","file_url":"https://github.com/RUCAIBox/UniKGQA/blob/HEAD/UniModel/convert_inst_to_NSM_format.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"e27d30e88c385923"}},{"code_sha256_prefix":"bc4cb80d7dd8de17","entry":"get_global_topic_entities","repo":"RUCAIBox/UniKGQA","repo_kind":"official","path":"UniModel/convert_abs_to_NSM_format.py","file_url":"https://github.com/RUCAIBox/UniKGQA/blob/HEAD/UniModel/convert_abs_to_NSM_format.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"bc4cb80d7dd8de17"}},{"code_sha256_prefix":"26dd036f60f5cb63","entry":"get_global_topic_entity","repo":"RUCAIBox/UniKGQA","repo_kind":"official","path":"UniModel/convert_inst_to_NSM_format.py","file_url":"https://github.com/RUCAIBox/UniKGQA/blob/HEAD/UniModel/convert_inst_to_NSM_format.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"26dd036f60f5cb63"}},{"code_sha256_prefix":"256c66dbbebcc087","entry":"get_meta_info_gold_entities","repo":"RUCAIBox/UniKGQA","repo_kind":"official","path":"UniModel/map_kg_2_global_id.py","file_url":"https://github.com/RUCAIBox/UniKGQA/blob/HEAD/UniModel/map_kg_2_global_id.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"256c66dbbebcc087"}},{"code_sha256_prefix":"d1508d96f5948a8e","entry":"load_dict","repo":"RUCAIBox/UniKGQA","repo_kind":"official","path":"UniModel/convert_abs_to_NSM_format.py","file_url":"https://github.com/RUCAIBox/UniKGQA/blob/HEAD/UniModel/convert_abs_to_NSM_format.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"d1508d96f5948a8e"}},{"code_sha256_prefix":"8764d92556a06708","entry":"construct_contrastive_pos_neg_paths","repo":"RUCAIBox/UniKGQA","repo_kind":"official","path":"UniModel/extract_valid_weak_paths.py","file_url":"https://github.com/RUCAIBox/UniKGQA/blob/HEAD/UniModel/extract_valid_weak_paths.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":"8764d92556a06708"}},{"code_sha256_prefix":"8e4f03b5d7ed6f80","entry":"construct_contrastive_pos_neg_paths","repo":"RUCAIBox/UniKGQA","repo_kind":"official","path":"UniModel/s1_construct_relation_retrieval_training_data.py","file_url":"https://github.com/RUCAIBox/UniKGQA/blob/HEAD/UniModel/s1_construct_relation_retrieval_training_data.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":"8e4f03b5d7ed6f80"}},{"code_sha256_prefix":"e8ced166b1cf4873","entry":"extract_shortest_paths","repo":"RUCAIBox/UniKGQA","repo_kind":"official","path":"UniModel/s2_extract_abstract_subgraph.py","file_url":"https://github.com/RUCAIBox/UniKGQA/blob/HEAD/UniModel/s2_extract_abstract_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":"e8ced166b1cf4873"}},{"code_sha256_prefix":"068354e2944b30d0","entry":"get_neg_rels_neibouring","repo":"RUCAIBox/UniKGQA","repo_kind":"official","path":"UniModel/s1_construct_relation_retrieval_training_data.py","file_url":"https://github.com/RUCAIBox/UniKGQA/blob/HEAD/UniModel/s1_construct_relation_retrieval_training_data.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":"068354e2944b30d0"}},{"code_sha256_prefix":"fba844611b43fecd","entry":"get_paths_from_tpe_to_ans","repo":"RUCAIBox/UniKGQA","repo_kind":"official","path":"UniModel/s0_extract_weak_super_relations.py","file_url":"https://github.com/RUCAIBox/UniKGQA/blob/HEAD/UniModel/s0_extract_weak_super_relations.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":"fba844611b43fecd"}},{"code_sha256_prefix":"eb939eeb1bbe1dda","entry":"get_paths_from_tpe_to_ans_with_specific_hop","repo":"RUCAIBox/UniKGQA","repo_kind":"official","path":"UniModel/s0_extract_weak_super_relations.py","file_url":"https://github.com/RUCAIBox/UniKGQA/blob/HEAD/UniModel/s0_extract_weak_super_relations.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":"eb939eeb1bbe1dda"}},{"code_sha256_prefix":"a93b4bf7311c5d95","entry":"get_paths_from_tpe_to_cpes","repo":"RUCAIBox/UniKGQA","repo_kind":"official","path":"UniModel/s0_extract_weak_super_relations.py","file_url":"https://github.com/RUCAIBox/UniKGQA/blob/HEAD/UniModel/s0_extract_weak_super_relations.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":"a93b4bf7311c5d95"}},{"code_sha256_prefix":"52af9ff41cf852e7","entry":"get_subgraph","repo":"RUCAIBox/UniKGQA","repo_kind":"official","path":"UniModel/s2_extract_abstract_subgraph.py","file_url":"https://github.com/RUCAIBox/UniKGQA/blob/HEAD/UniModel/s2_extract_abstract_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":"52af9ff41cf852e7"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}