{"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/graph-constrained-reasoning-faithful","title":"Graph-constrained Reasoning: Faithful Reasoning on Knowledge Graphs with Large Language Models","arxiv_id":"2410.13080","date":"2024-10-16","proceeding":null,"authors":["Linhao Luo","Zicheng Zhao","Chen Gong","Gholamreza Haffari","Shirui Pan"],"abstract":"Large language models (LLMs) have demonstrated impressive reasoning abilities, but they still struggle with faithful reasoning due to knowledge gaps and hallucinations. To address these issues, knowledge graphs (KGs) have been utilized to enhance LLM reasoning through their structured knowledge. However, existing KG-enhanced methods, either retrieval-based or agent-based, encounter difficulties in accurately retrieving knowledge and efficiently traversing KGs at scale. In this work, we introduce graph-constrained reasoning (GCR), a novel framework that bridges structured knowledge in KGs with unstructured reasoning in LLMs. To eliminate hallucinations, GCR ensures faithful KG-grounded reasoning by integrating KG structure into the LLM decoding process through KG-Trie, a trie-based index that encodes KG reasoning paths. KG-Trie constrains the decoding process, allowing LLMs to directly reason on graphs and generate faithful reasoning paths grounded in KGs. Additionally, GCR leverages a lightweight KG-specialized LLM for graph-constrained reasoning alongside a powerful general LLM for inductive reasoning over multiple reasoning paths, resulting in accurate reasoning with zero reasoning hallucination. Extensive experiments on several KGQA benchmarks demonstrate that GCR achieves state-of-the-art performance and exhibits strong zero-shot generalizability to unseen KGs without additional training.","url_abs":"https://arxiv.org/abs/2410.13080v1","url_pdf":"https://arxiv.org/pdf/2410.13080v1.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":"graph-constrained-reasoning-faithful","repo_url":"https://github.com/RManLuo/graph-constrained-reasoning","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":null}],"tasks":[{"task_slug":"hallucination","task_name":"Hallucination"},{"task_slug":"knowledge-graphs","task_name":"Knowledge Graphs"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2410.13080","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2410.13080"}},"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/RManLuo/graph-constrained-reasoning","reach":null}],"summary":{"ran":1,"ran_draft_wrong":2,"unverified":1},"by_repo_kind":{"official":{"samples":4,"ran":3,"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":"5738da564dd54ca1","entry":"GraphConstrainedDecoding","repo":"RManLuo/graph-constrained-reasoning","repo_kind":"official","path":"src/graph_constrained_decoding.py","file_url":"https://github.com/RManLuo/graph-constrained-reasoning/blob/HEAD/src/graph_constrained_decoding.py","link_basis":"first_harvest_node","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":"5738da564dd54ca1"}},{"code_sha256_prefix":"d57e3db685df5d73","entry":"get_output_file","repo":"rmanluo/graph-constrained-reasoning","repo_kind":"official","path":"workflow/predict_paths_and_answers.py","file_url":"https://github.com/rmanluo/graph-constrained-reasoning/blob/HEAD/workflow/predict_paths_and_answers.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":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"d57e3db685df5d73"}},{"code_sha256_prefix":"0bcfb6bdefa6b543","entry":"prediction","repo":"rmanluo/graph-constrained-reasoning","repo_kind":"official","path":"workflow/predict_paths_and_answers.py","file_url":"https://github.com/rmanluo/graph-constrained-reasoning/blob/HEAD/workflow/predict_paths_and_answers.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":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"0bcfb6bdefa6b543"}},{"code_sha256_prefix":"a86604eeda8184b9","entry":"merge_rule_result","repo":"rmanluo/graph-constrained-reasoning","repo_kind":"official","path":"workflow/predict_paths_and_answers.py","file_url":"https://github.com/rmanluo/graph-constrained-reasoning/blob/HEAD/workflow/predict_paths_and_answers.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":"a86604eeda8184b9"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}