{"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/think-on-graph-deep-and-responsible-reasoning","title":"Think-on-Graph: Deep and Responsible Reasoning of Large Language Model on Knowledge Graph","arxiv_id":"2307.07697","date":"2023-07-15","proceeding":null,"authors":["Jiashuo Sun","Chengjin Xu","Lumingyuan Tang","Saizhuo Wang","Chen Lin","Yeyun Gong","Lionel M. Ni","Heung-Yeung Shum","Jian Guo"],"abstract":"Although large language models (LLMs) have achieved significant success in various tasks, they often struggle with hallucination problems, especially in scenarios requiring deep and responsible reasoning. These issues could be partially addressed by introducing external knowledge graphs (KG) in LLM reasoning. In this paper, we propose a new LLM-KG integrating paradigm ``$\\hbox{LLM}\\otimes\\hbox{KG}$'' which treats the LLM as an agent to interactively explore related entities and relations on KGs and perform reasoning based on the retrieved knowledge. We further implement this paradigm by introducing a new approach called Think-on-Graph (ToG), in which the LLM agent iteratively executes beam search on KG, discovers the most promising reasoning paths, and returns the most likely reasoning results. We use a number of well-designed experiments to examine and illustrate the following advantages of ToG: 1) compared with LLMs, ToG has better deep reasoning power; 2) ToG has the ability of knowledge traceability and knowledge correctability by leveraging LLMs reasoning and expert feedback; 3) ToG provides a flexible plug-and-play framework for different LLMs, KGs and prompting strategies without any additional training cost; 4) the performance of ToG with small LLM models could exceed large LLM such as GPT-4 in certain scenarios and this reduces the cost of LLM deployment and application. As a training-free method with lower computational cost and better generality, ToG achieves overall SOTA in 6 out of 9 datasets where most previous SOTAs rely on additional training.","url_abs":"https://arxiv.org/abs/2307.07697v6","url_pdf":"https://arxiv.org/pdf/2307.07697v6.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":"think-on-graph-deep-and-responsible-reasoning","repo_url":"https://github.com/gasolsun36/tog","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok"}},{"paper_slug":"think-on-graph-deep-and-responsible-reasoning","repo_url":"https://github.com/idea-finai/tog","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok"}},{"paper_slug":"think-on-graph-deep-and-responsible-reasoning","repo_url":"https://github.com/IDEA-FinAI/Simple-HHEA","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"gone","observed_at":"2026-09-17","how":"tree_404+repo_404"}}],"tasks":[{"task_slug":"hallucination","task_name":"Hallucination"},{"task_slug":"knowledge-graphs","task_name":"Knowledge Graphs"},{"task_slug":"language-modeling","task_name":"Language Modeling"},{"task_slug":"language-modelling","task_name":"Language Modelling"},{"task_slug":"large-language-model","task_name":"Large Language Model"},{"task_slug":"question-answering","task_name":"Question Answering"}],"methods":[{"method_slug":"absolute-position-encodings","method_name":"Absolute Position Encodings"},{"method_slug":"adam","method_name":"Adam"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"bpe","method_name":"BPE"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"gpt-4","method_name":"GPT-4"},{"method_slug":"label-smoothing","method_name":"Label Smoothing"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"position-wise-feed-forward-layer","method_name":"Position-Wise Feed-Forward Layer"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"transformer","method_name":"Transformer"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":null,"atlas_url":"https://app.syntology.ai/?focus=2307.07697","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2307.07697"}},"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/IDEA-FinAI/ToG","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/gasolsun36/tog","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/idea-finai/tog","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/IDEA-FinAI/Simple-HHEA","reach":{"status":"gone","observed_at":"2026-09-17","how":"tree_404+repo_404"}}],"summary":{"ran":7,"ran_draft_wrong":2,"ran_violates":1,"ran_honours":1,"unverified":5},"by_repo_kind":{"official":{"samples":15,"ran":10,"repositories":2},"community":{"samples":1,"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":15,"samples":[{"code_sha256_prefix":"b6d5027e4acec382","entry":"align","repo":"IDEA-FinAI/ToG","repo_kind":"official","path":"eval/utils.py","file_url":"https://github.com/IDEA-FinAI/ToG/blob/HEAD/eval/utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"b6d5027e4acec382"}},{"code_sha256_prefix":"ffbc2c4b715e9ad2","entry":"check_end_word","repo":"IDEA-FinAI/ToG","repo_kind":"official","path":"ToG/freebase_func.py","file_url":"https://github.com/IDEA-FinAI/ToG/blob/HEAD/ToG/freebase_func.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"ffbc2c4b715e9ad2"}},{"code_sha256_prefix":"d7a01348958713cb","entry":"check_string","repo":"IDEA-FinAI/ToG","repo_kind":"official","path":"eval/utils.py","file_url":"https://github.com/IDEA-FinAI/ToG/blob/HEAD/eval/utils.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"d7a01348958713cb"}},{"code_sha256_prefix":"f792b1312fa4db34","entry":"clean_relations","repo":"IDEA-FinAI/ToG","repo_kind":"official","path":"ToG/utils.py","file_url":"https://github.com/IDEA-FinAI/ToG/blob/HEAD/ToG/utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"f792b1312fa4db34"}},{"code_sha256_prefix":"8e0ef95c49c47311","entry":"clean_relations","repo":"IDEA-FinAI/ToG","repo_kind":"official","path":"ToG/wiki_func.py","file_url":"https://github.com/IDEA-FinAI/ToG/blob/HEAD/ToG/wiki_func.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"8e0ef95c49c47311"}},{"code_sha256_prefix":"f28fd5e14161c66b","entry":"compute_bm25_similarity","repo":"IDEA-FinAI/ToG","repo_kind":"official","path":"ToG/utils.py","file_url":"https://github.com/IDEA-FinAI/ToG/blob/HEAD/ToG/utils.py","link_basis":"plan_row","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"f28fd5e14161c66b"}},{"code_sha256_prefix":"93ab9efdb03f32cb","entry":"extract_answer","repo":"gasolsun36/tog","repo_kind":"official","path":"ToG/wiki_func.py","file_url":"https://github.com/gasolsun36/tog/blob/HEAD/ToG/wiki_func.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"93ab9efdb03f32cb"}},{"code_sha256_prefix":"188177dba46b8b5c","entry":"if_true","repo":"gasolsun36/tog","repo_kind":"official","path":"ToG/wiki_func.py","file_url":"https://github.com/gasolsun36/tog/blob/HEAD/ToG/wiki_func.py","link_basis":"first_harvest_node","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"188177dba46b8b5c"}},{"code_sha256_prefix":"ac726695e1bf1698","entry":"prepare_dataset_for_eval","repo":"IDEA-FinAI/ToG","repo_kind":"official","path":"eval/utils.py","file_url":"https://github.com/IDEA-FinAI/ToG/blob/HEAD/eval/utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"ac726695e1bf1698"}},{"code_sha256_prefix":"db87f61e2e22ab6f","entry":"sliding_window_type","repo":"DataArcTech/ToG-2","repo_kind":"community","path":"ToG-2/main_tog2.py","file_url":"https://github.com/DataArcTech/ToG-2/blob/HEAD/ToG-2/main_tog2.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"db87f61e2e22ab6f"}},{"code_sha256_prefix":"8f682083b0348a0a","entry":"transform_relation","repo":"IDEA-FinAI/ToG","repo_kind":"official","path":"ToG/wiki_func.py","file_url":"https://github.com/IDEA-FinAI/ToG/blob/HEAD/ToG/wiki_func.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"8f682083b0348a0a"}},{"code_sha256_prefix":"8efd8b00e5ee004a","entry":"abandon_rels","repo":"IDEA-FinAI/ToG","repo_kind":"official","path":"ToG/freebase_func.py","file_url":"https://github.com/IDEA-FinAI/ToG/blob/HEAD/ToG/freebase_func.py","link_basis":"harvester_set","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":"8efd8b00e5ee004a"}},{"code_sha256_prefix":"efbf4bfeee892fb3","entry":"construct_relation_prune_prompt","repo":"IDEA-FinAI/ToG","repo_kind":"official","path":"ToG/wiki_func.py","file_url":"https://github.com/IDEA-FinAI/ToG/blob/HEAD/ToG/wiki_func.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":"efbf4bfeee892fb3"}},{"code_sha256_prefix":"00b2e6d240c0d36b","entry":"prepare_dataset","repo":"IDEA-FinAI/ToG","repo_kind":"official","path":"CoT/utils.py","file_url":"https://github.com/IDEA-FinAI/ToG/blob/HEAD/CoT/utils.py","link_basis":"harvester_set","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":"00b2e6d240c0d36b"}},{"code_sha256_prefix":"45fd3b8df27ad036","entry":"reasoning","repo":"gasolsun36/tog","repo_kind":"official","path":"ToG/wiki_func.py","file_url":"https://github.com/gasolsun36/tog/blob/HEAD/ToG/wiki_func.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":"45fd3b8df27ad036"}},{"code_sha256_prefix":"b0aab5b997a57a62","entry":"run_llm","repo":"gasolsun36/tog","repo_kind":"official","path":"ToG/wiki_func.py","file_url":"https://github.com/gasolsun36/tog/blob/HEAD/ToG/wiki_func.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":"b0aab5b997a57a62"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}