{"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/answering-complex-logical-queries-on","title":"Answering Complex Logical Queries on Knowledge Graphs via Query Computation Tree Optimization","arxiv_id":"2212.09567","date":"2022-12-19","proceeding":null,"authors":["Yushi Bai","Xin Lv","Juanzi Li","Lei Hou"],"abstract":"Answering complex logical queries on incomplete knowledge graphs is a challenging task, and has been widely studied. Embedding-based methods require training on complex queries, and cannot generalize well to out-of-distribution query structures. Recent work frames this task as an end-to-end optimization problem, and it only requires a pretrained link predictor. However, due to the exponentially large combinatorial search space, the optimal solution can only be approximated, limiting the final accuracy. In this work, we propose QTO (Query Computation Tree Optimization) that can efficiently find the exact optimal solution. QTO finds the optimal solution by a forward-backward propagation on the tree-like computation graph, i.e., query computation tree. In particular, QTO utilizes the independence encoded in the query computation tree to reduce the search space, where only local computations are involved during the optimization procedure. Experiments on 3 datasets show that QTO obtains state-of-the-art performance on complex query answering, outperforming previous best results by an average of 22%. Moreover, QTO can interpret the intermediate solutions for each of the one-hop atoms in the query with over 90% accuracy. The code of our paper is at https://github.com/bys0318/QTO.","url_abs":"https://arxiv.org/abs/2212.09567v3","url_pdf":"https://arxiv.org/pdf/2212.09567v3.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":"answering-complex-logical-queries-on","repo_url":"https://github.com/bys0318/qto","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"complex-query-answering","task_name":"Complex Query Answering"},{"task_slug":"knowledge-graphs","task_name":"Knowledge Graphs"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/complex-query-answering-on-fb15k","task":"Complex Query Answering","dataset":"FB15k","model":"QTO","rank_in_archive_order":1,"of":9,"metrics":{"MRR 1p":"0.895","MRR 2i":"0.803","MRR 2p":"0.674","MRR 2u":"0.767","MRR 3i":"0.836","MRR 3p":"0.588","MRR ip":"0.740","MRR pi":"0.752","MRR up":"0.613"},"uses_additional_data":false},{"leaderboard":"/sota/complex-query-answering-on-fb15k-237","task":"Complex Query Answering","dataset":"FB15k-237","model":"QTO","rank_in_archive_order":1,"of":9,"metrics":{"MRR 1p":"0.490","MRR 2i":"0.431","MRR 2p":"0.214","MRR 2u":"0.227","MRR 3i":"0.568","MRR 3p":"0.212","MRR ip":"0.280","MRR pi":"0.381","MRR up":"0.214"},"uses_additional_data":false},{"leaderboard":"/sota/complex-query-answering-on-nell-995","task":"Complex Query Answering","dataset":"NELL-995","model":"QTO","rank_in_archive_order":1,"of":6,"metrics":{"MRR 1p":"0.607","MRR 2i":"0.425","MRR 2p":"0.241","MRR 2u":"0.204","MRR 3i":"0.506","MRR 3p":"0.216","MRR ip":"0.265","MRR pi":"0.313","MRR up":"0.179"},"uses_additional_data":false}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2212.09567","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2212.09567"}},"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/bys0318/QTO","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/bys0318/qto","reach":{"status":"ok"}}],"summary":{"ran_fixture":1,"unverified":6},"by_repo_kind":{"official":{"samples":7,"ran":1,"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":7,"samples":[{"code_sha256_prefix":"f4ec06f37defd643","entry":"filtering","repo":"bys0318/qto","repo_kind":"official","path":"model.py","file_url":"https://github.com/bys0318/qto/blob/HEAD/model.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"f4ec06f37defd643"}},{"code_sha256_prefix":"9a630d4670730e61","entry":"ComplEx","repo":"bys0318/qto","repo_kind":"official","path":"model.py","file_url":"https://github.com/bys0318/qto/blob/HEAD/model.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"9a630d4670730e61"}},{"code_sha256_prefix":"a6252f4d8c14ca93","entry":"KBCModel","repo":"bys0318/qto","repo_kind":"official","path":"model.py","file_url":"https://github.com/bys0318/qto/blob/HEAD/model.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"a6252f4d8c14ca93"}},{"code_sha256_prefix":"3ac1bf718190ec47","entry":"KGReasoning","repo":"bys0318/qto","repo_kind":"official","path":"model.py","file_url":"https://github.com/bys0318/qto/blob/HEAD/model.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"3ac1bf718190ec47"}},{"code_sha256_prefix":"fd46dfa1fc42947a","entry":"kge_forward","repo":"bys0318/qto","repo_kind":"official","path":"model.py","file_url":"https://github.com/bys0318/qto/blob/HEAD/model.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"fd46dfa1fc42947a"}},{"code_sha256_prefix":"643f1ce69806d271","entry":"load_kbc","repo":"bys0318/qto","repo_kind":"official","path":"model.py","file_url":"https://github.com/bys0318/qto/blob/HEAD/model.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"643f1ce69806d271"}},{"code_sha256_prefix":"3cc181fa0356350a","entry":"neural_adj_matrix","repo":"bys0318/qto","repo_kind":"official","path":"model.py","file_url":"https://github.com/bys0318/qto/blob/HEAD/model.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"3cc181fa0356350a"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}