SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2307.07697 · ICLR · 2024

Think-on-Graph: Deep and Responsible Reasoning of Large Language Model on Knowledge Graph

Chen Lin, Yeyun Gong, Jian Guo, Chengjin Xu, Jiashuo Sun, Lumingyuan Tang, Saizhuo Wang, Lionel Ni, Heung-Yeung Shum

arXiv · PDF · Open in the Atlas

Code that ran

12 of 16 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 4 violated it and 0 have no contract verdict; 7 failures of our instrument; 4 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2307.07697.json · badge: /api/ran/2307.07697.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
IDEA-FinAI/ToG canonical (classifier label)
classifier basis: census
9 ran · 2 no recorded run
DataArcTech/ToG-2 canonical (classifier label)
classifier basis: classifier_2025
1 ran · 0 no recorded run
gasolsun36/tog marked official in Papers with Code
Papers with Code archive
2 ran · 2 no recorded run
FunctionStatusWhere it lives
abandon_rels Ran
ran, violated the contract we drafted
IDEA-FinAI/ToG/ToG/freebase_func.py
pointer only (licence: NONE) · get_code("8efd8b00e5ee004a")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, IDEA-FinAI/ToG when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

align Ran
ran; our contract draft was wrong, not the code
IDEA-FinAI/ToG/eval/utils.py
pointer only (licence: NONE) · get_code("b6d5027e4acec382")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, IDEA-FinAI/ToG when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

check_end_word Ran
ran, violated the contract we drafted
IDEA-FinAI/ToG/ToG/freebase_func.py
pointer only (licence: NONE) · get_code("ffbc2c4b715e9ad2")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, IDEA-FinAI/ToG when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

check_string Ran
ran, violated the contract we drafted
IDEA-FinAI/ToG/eval/utils.py
pointer only (licence: NONE) · get_code("d7a01348958713cb")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, IDEA-FinAI/ToG when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

clean_relations Ran
ran; our contract draft was wrong, not the code
IDEA-FinAI/ToG/ToG/utils.py
pointer only (licence: NONE) · get_code("f792b1312fa4db34")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, IDEA-FinAI/ToG when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

clean_relations Ran
ran; our contract draft was wrong, not the code
IDEA-FinAI/ToG/ToG/wiki_func.py
pointer only (licence: NONE) · get_code("8e0ef95c49c47311")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, IDEA-FinAI/ToG when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

compute_bm25_similarity Ran
ran; our contract draft was wrong, not the code
IDEA-FinAI/ToG/ToG/utils.py
pointer only (licence: NONE); the stored copy get_code serves, from yijie-cheng/SLM-ToG, is pointer only (licence: NONE) · get_code("f28fd5e14161c66b")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, IDEA-FinAI/ToG when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

extract_answer Ran
ran; our contract draft was wrong, not the code
gasolsun36/tog/ToG/wiki_func.py
pointer only (licence: NONE) · get_code("93ab9efdb03f32cb")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, gasolsun36/tog when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

if_true Ran
ran, violated the contract we drafted
gasolsun36/tog/ToG/wiki_func.py
pointer only (licence: NONE) · get_code("188177dba46b8b5c")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, gasolsun36/tog when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

prepare_dataset_for_eval Ran
ran; our contract draft was wrong, not the code
IDEA-FinAI/ToG/eval/utils.py
pointer only (licence: NONE) · get_code("ac726695e1bf1698")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, IDEA-FinAI/ToG when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

sliding_window_type Ran
ran, honoured the contract we drafted
DataArcTech/ToG-2/ToG-2/main_tog2.py
code served (permissive licence) · get_code("db87f61e2e22ab6f")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned tuple, ndim 1, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import argparse

def sliding_window_type(s):
    try:
        window_size, step_size = map(int, s.split(','))
        return (window_size, step_size)
    except:
        raise argparse.ArgumentTypeError('Sliding window must be two integers separated by a comma, e.g., 3,2')

ARGS = {
    's': '3,2'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family int — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
transform_relation Ran
ran; our contract draft was wrong, not the code
IDEA-FinAI/ToG/ToG/wiki_func.py
pointer only (licence: NONE) · get_code("8f682083b0348a0a")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, IDEA-FinAI/ToG when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

construct_relation_prune_prompt Not yet run
unverified (harvested, no recorded run)
IDEA-FinAI/ToG/ToG/wiki_func.py
pointer only (licence: NONE) · get_code("efbf4bfeee892fb3")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, IDEA-FinAI/ToG when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

prepare_dataset Not yet run
unverified (harvested, no recorded run)
IDEA-FinAI/ToG/CoT/utils.py
pointer only (licence: NONE); the stored copy get_code serves, from YaooXu/GoG, is pointer only (licence: NONE) · get_code("00b2e6d240c0d36b")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, IDEA-FinAI/ToG when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

reasoning Not yet run
unverified (harvested, no recorded run)
gasolsun36/tog/ToG/wiki_func.py
pointer only (licence: NONE) · get_code("45fd3b8df27ad036")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, gasolsun36/tog when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

run_llm Not yet run
unverified (harvested, no recorded run)
gasolsun36/tog/ToG/wiki_func.py
pointer only (licence: NONE) · get_code("b0aab5b997a57a62")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, gasolsun36/tog when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

Also present in other papers' code

Of 16 samples lifted from this paper's linked repositories, 16 carry a function identity and 0 do not. Of the 16 distinct functions with an identity, 7 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 7 later) and 9 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
abandon_rels 3 other papers
3 later
2410.14211 (2024-10)
Paths-over-Graph: Knowledge Graph Empowered Large Language Model Reasoning
2410.23875 (2024-10)
Plan-on-Graph: Self-Correcting Adaptive Planning of Large Language Model on Knowledge Graphs
2601.11047 (2026-01)
CoG: Controllable Graph Reasoning via Relational Blueprints and Failure-Aware Refinement over Knowledge Graphs
check_end_word 1 other paper
1 later
2410.14211 (2024-10)
Paths-over-Graph: Knowledge Graph Empowered Large Language Model Reasoning
check_string 1 other paper
1 later
2407.10805 (2024-07)
Think-on-Graph 2.0: Deep and Faithful Large Language Model Reasoning with Knowledge-guided Retrieval Augmented Generation
compute_bm25_similarity 1 other paper
1 later
2509.07399 (2025-09)
The Role of Exploration Modules in Small Language Models for Knowledge Graph Question Answering
prepare_dataset 1 other paper
1 later
2404.14741 (2024-04)
Generate-on-Graph: Treat LLM as both Agent and KG for Incomplete Knowledge Graph Question Answering
run_llm
brick of this paper's assembly: helper
1 other paper
1 later
2404.14741 (2024-04)
Generate-on-Graph: Treat LLM as both Agent and KG for Incomplete Knowledge Graph Question Answering
sliding_window_type 1 other paper
1 later
2407.10805 (2024-07)
Think-on-Graph 2.0: Deep and Faithful Large Language Model Reasoning with Knowledge-guided Retrieval Augmented Generation

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

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 "LLM ⊗ 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 plugand-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. Our code is publicly available at https://github.com/IDEA-FinAI/ToG.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2307.07697")
get_code_for_paper("2307.07697")
have("2307.07697")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2307.07697.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2307.07697.svg)](https://syntology.ai/paper/2307.07697)

Connect an agent — have() is free.