SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2407.10805 · 2024

Think-on-Graph 2.0: Deep and Faithful Large Language Model Reasoning with Knowledge-guided Retrieval Augmented Generation

arXiv · PDF · Open in the Atlas

Code that ran

13 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; 4 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 8 failures of our instrument; 3 no recorded run), measured 2026-11-23; 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/2407.10805.json · badge: /api/ran/2407.10805.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-2 canonical (classifier label)
classifier basis: census
13 ran · 3 no recorded run
FunctionStatusWhere it lives
align Ran
ran; our contract draft was wrong, not the code
idea-finai/tog-2/eval/utils.py
code served (permissive licence) · get_code("d858076ab384807e")
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, through the batch API) and returned list, ndim 1, dtype family float; 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 torch

torch.manual_seed(0)

# Based on the function body, we need:
# - dataset_name: string (one of the supported datasets)
# - question_string: string (key to match questions)
# - data: dict with a key matching data_question_string
# - ground_truth_datas: list of dicts with question and answer data
# - origin_data: optional dict (if None, will be found from ground_truth_datas)
# - data_question_string: string (default 'question')

# Create sample data for 'grailqa' dataset
question_text = "What is the capital of France?"

data = {
    "question": question_text,
    "some_field": "some_value"
}

ground_truth_datas = [
    {
        "question": question_text,
        "answer": [
            {"entity_name": "Paris"},
            {"entity_name": "Île-de-France"}
        ]
    },
    {
        "question": "What is the capital of Germany?",
        "answer": [
            {"entity_name": "Berlin"}
        ]
    }
]

origin_data = {
    "question": question_text,
    "answer": [
        {"entity_name": "Paris"},
        {"entity_name": "Île-de-France"}
    ]
}

ARGS = {
    "dataset_name": "grailqa",
    "question_string": "question",
    "data": data,
    "ground_truth_datas": ground_truth_datas,
    "origin_data": origin_data,
    "data_question_string": "question"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list 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
biencoder_similarity Ran
ran, honoured the contract we drafted
idea-finai/tog-2/ToG-2/search.py
code served (permissive licence) · get_code("9ceaedf109fba536")
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, through the batch API) and returned Tensor, ndim 1, dtype family float, shape (3,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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 torch
import torch.nn as nn

torch.manual_seed(0)

class MockBiEncoderModel(nn.Module):
    def __init__(self, embedding_dim=4):
        super().__init__()
        self.embedding_dim = embedding_dim
    
    def encode_queries(self, queries):
        """Returns query embeddings of shape (num_queries, embedding_dim)"""
        return torch.randn(len(queries), self.embedding_dim)
    
    def encode(self, passages):
        """Returns passage embeddings of shape (num_passages, embedding_dim)"""
        return torch.randn(len(passages), self.embedding_dim)

class MockArgs:
    def __init__(self):
        self.embedding_model_name = 'bge-bi'

# Set up the arguments
question = "What is the capital of France?"
passages = [
    "Paris is the capital of France.",
    "London is the capital of England.",
    "Berlin is the capital of Germany."
]
args = MockArgs()
emb_model = MockBiEncoderModel(embedding_dim=4)

ARGS = {
    'question': question,
    'passages': passages,
    'args': args,
    'emb_model': emb_model
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 1, dtype family float, shape (3,) — shape (3,) as a later run recorded it
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
check_string Ran
ran, violated the contract we drafted
idea-finai/tog-2/eval/utils.py
code served (permissive licence) · get_code("d7a01348958713cb")
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, through the batch API) and returned bool, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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 torch

torch.manual_seed(0)

ARGS = {
    'string': 'hello {world}'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, ndim 0, dtype family float, shape () — shape () as a later run recorded it
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
compute_bm25_similarity Ran
ran, honoured the contract we drafted
idea-finai/tog-2/ToG-2/utils.py
code served (permissive licence) · get_code("1d7cb1f72b14a5d4")
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, through the batch API) and returned ndarray, ndim 1, dtype family float, shape (4,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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.

from rank_bm25 import BM25Okapi

# Simple test setup for compute_bm25_similarity
query = "machine learning algorithms"
corpus = [
    "machine learning is a subset of artificial intelligence",
    "deep learning uses neural networks for pattern recognition",
    "algorithms and data structures are fundamental to computer science",
    "machine learning algorithms can be supervised or unsupervised"
]

ARGS = {
    "query": query,
    "corpus": corpus
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
rank_bm25 — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family float, shape (4,) — shape (4,) as a later run recorded it
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
crossencoder_similarity Ran
ran, honoured the contract we drafted
idea-finai/tog-2/ToG-2/search.py
code served (permissive licence) · get_code("6e4a42e284551029")
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, through the batch API) and returned list, ndim 1, dtype family float; 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 torch
import torch.nn as nn

torch.manual_seed(0)

class MockCrossEncoderMinilm(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 1)
    
    def predict(self, text_pairs):
        # text_pairs is a list of [question, text] pairs
        # Return a list of scores
        return [float(self.linear(torch.randn(1, 4)).item()) for _ in text_pairs]

class MockCrossEncoderBGE(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 1)
    
    def compute_score(self, text_pairs):
        # text_pairs is a list of [question, text] pairs
        # Return a list of scores
        return [float(self.linear(torch.randn(1, 4)).item()) for _ in text_pairs]

class MockArgs:
    def __init__(self, model_name='minilm'):
        self.embedding_model_name = model_name

# Test with minilm model
question = "What is machine learning?"
texts = ["ML is a field of AI", "Deep learning is a subset of ML"]
args = MockArgs(model_name='minilm')
emb_model = MockCrossEncoderMinilm()

ARGS = {
    'question': question,
    'texts': texts,
    'args': args,
    'emb_model': emb_model
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list 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
entity_linking_azure_cache Ran
ran; our contract draft was wrong, not the code
idea-finai/tog-2/ToG-2/ner.py
code served (permissive licence) · get_code("1fba9a1516cbfeed")
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, through the batch API) and returned list, ndim 1, dtype family float; 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 os
import sys
import json
import tempfile

# Create a temporary directory and cache file for testing
temp_dir = tempfile.mkdtemp()
data_dir = os.path.join(temp_dir, 'data')
os.makedirs(data_dir, exist_ok=True)

# Create a sample entity cache JSON file
sample_entities = [
    {
        "question": "What is the capital of France?",
        "entities": ["France", "Paris", "capital"]
    },
    {
        "question": "Who wrote Romeo and Juliet?",
        "entities": ["Shakespeare", "Romeo", "Juliet", "play"]
    }
]

cache_file = os.path.join(data_dir, 'test_entities_azure.json')
with open(cache_file, 'w') as f:
    json.dump(sample_entities, f)

# Create a mock args object
class MockArgs:
    def __init__(self, entity_cache, dataset):
        self.entity_cache = entity_cache
        self.dataset = dataset

ARGS = {
    'question': 'What is the capital of France?',
    'args': MockArgs(entity_cache=cache_file, dataset='test')
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
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 list, ndim 1, dtype family float — a list 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
entity_linking_azure_search Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
idea-finai/tog-2/ToG-2/ner.py
code served (permissive licence) · get_code("56587c771bc3250d")
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, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type 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.

# Setup code for entity_linking_azure_search

# Mock the Azure client and related dependencies
class MockAzureKeyCredential:
    def __init__(self, key):
        self.key = key

class MockEntity:
    def __init__(self, name):
        self.name = name

class MockLinkedEntitiesResult:
    def __init__(self, entities):
        self.entities = entities

class MockTextAnalyticsClient:
    def __init__(self, endpoint, credential):
        self.endpoint = endpoint
        self.credential = credential
    
    def recognize_linked_entities(self, documents):
        # Return mock results for any input
        entities = [
            MockEntity("Python programming"),
            MockEntity("Machine Learning")
        ]
        return [MockLinkedEntitiesResult(entities)]

# Patch the Azure imports
import sys
from unittest.mock import MagicMock

azure_mock = MagicMock()
azure_mock.ai.textanalytics.TextAnalyticsClient = MockTextAnalyticsClient
azure_mock.core.credentials.AzureKeyCredential = MockAzureKeyCredential

sys.modules['azure'] = azure_mock
sys.modules['azure.ai'] = azure_mock.ai
sys.modules['azure.ai.textanalytics'] = azure_mock.ai.textanalytics
sys.modules['azure.core'] = azure_mock.core
sys.modules['azure.core.credentials'] = azure_mock.core.credentials

# Mock requests and BeautifulSoup to avoid network calls
class MockTag:
    def __init__(self, string_val=None):
        self.string = string_val
    
    def findChildren(self, name, class_=None):
        if name == 'tr':
            # Return mock table rows
            td1 = MockTag()
            td1.string = 'Wikidata item ID'
            td2 = MockTag('Q123')
            return [MagicMock(findChildren=lambda n, **kw: [td1, td2])]
        elif name == 'td':
            return []
        return []

class MockBeautifulSoup:
    def __init__(self, html, parser):
        pass
    
    def findChildren(self, name, class_=None):
        if name == 'table' and class_ == 'wikitable mw-page-info':
            table = MockTag()
            return [table]
        return []

class MockResponse:
    def __init__(self):
        self.text = '<html></html>'

def mock_requests_get(url):
    return MockResponse()

requests_mock = MagicMock()
requests_mock.get = mock_requests_get

sys.modules['requests'] = requests_mock
sys.modules['bs4'] = MagicMock()
sys.modules['bs4.BeautifulSoup'] = MockBeautifulSoup

# Patch BeautifulSoup directly
import bs4
bs4.BeautifulSoup = MockBeautifulSoup

# Reset global client
import __main__
__main__.AZURE_CLIENT = None

# Define arguments
ARGS = {
    'question': 'What is Python and machine learning?'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
__main__, azure, bs4, requests — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
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
format_entity_name_for_wikipedia Ran
ran; our contract draft was wrong, not the code
idea-finai/tog-2/ToG-2/client.py
code served (permissive licence) · get_code("3d56eaa0b0bfd370")
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, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type 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 torch

ARGS = {
    'entity_name': 'Albert Einstein'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
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
get_batch_files Ran
ran; our contract draft was wrong, not the code
idea-finai/tog-2/Wikidata/simple_wikidata_db/utils.py
code served (permissive licence) · get_code("54c796e1cf61d9f9")
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, through the batch API) and returned list, ndim 1, dtype family float; 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 os
import tempfile

# Create a temporary directory with some test files
temp_dir = tempfile.mkdtemp()
test_files = ['file1.txt', 'file2.txt', 'file3.dat']
for fname in test_files:
    fpath = os.path.join(temp_dir, fname)
    with open(fpath, 'w') as f:
        f.write('test')

ARGS = {
    'fdir': temp_dir
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
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 list, ndim 1, dtype family float — a list 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
if_all_zero Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
idea-finai/tog-2/ToG-2/utils.py
code served (permissive licence) · get_code("d29ad9e91ad3ef23")
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, through the batch API) and returned bool, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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 torch
import numpy as np

torch.manual_seed(0)

# The function checks if all scores in topn_scores are equal to 0
# topn_scores should be an iterable of numeric values that can be compared to 0

# Test case 1: all zeros
topn_scores_all_zero = [0, 0, 0, 0]

# Test case 2: mixed values (for verification that function works correctly)
topn_scores_mixed = [0, 1, 0, 0]

# Test case 3: with tensor values
topn_scores_tensor = torch.tensor([0, 0, 0, 0], dtype=torch.float32)

# Test case 4: with numpy values
topn_scores_numpy = np.array([0, 0, 0, 0], dtype=np.float32)

# Use the all-zeros case as the primary argument
ARGS = {
    "topn_scores": [0, 0, 0, 0]
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, ndim 0, dtype family float, shape () — shape () as a later run recorded it
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
scores_rank Ran
ran; our contract draft was wrong, not the code
idea-finai/tog-2/ToG-2/search.py
code served (permissive licence) · get_code("989b2db8e3d1abc0")
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, through the batch API) and returned list, ndim 1, dtype family float; 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 torch
import numpy as np

torch.manual_seed(0)

# Construct arguments for scores_rank
scores = torch.tensor([0.95, 0.42, 0.87, 0.61], dtype=torch.float32)
texts = ["excellent result", "poor performance", "good outcome", "fair score"]

ARGS = {
    "scores": scores,
    "texts": texts
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list 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
sliding_window_type Ran
ran, honoured the contract we drafted
idea-finai/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-2/ToG-2/wiki_func.py
code served (permissive licence) · get_code("d1a2d46886246d95")
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, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type 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 torch

ARGS = {
    'wiki_relation': 'wiki.relation.located_in'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
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
clean_relation_all_e Not yet run
unverified (harvested, no recorded run)
idea-finai/tog-2/ToG-2/wiki_func.py
code served (permissive licence) · get_code("962af27b3c6f4838")
How it ran

no invocation recorded.

clean_relations Not yet run
unverified (harvested, no recorded run)
idea-finai/tog-2/ToG-2/wiki_func.py
code served (permissive licence) · get_code("b93bb663c55da34d")
How it ran

no invocation recorded.

prepare_dataset_for_eval Not yet run
unverified (harvested, no recorded run)
idea-finai/tog-2/eval/utils.py
code served (permissive licence) · get_code("f0c6d1dc03117242")
How it ran

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, 3 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 0 the same month, 0 later) and 13 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
check_string 1 other paper
1 dated earlier
2307.07697 (2023-07)
Think-on-Graph: Deep and Responsible Reasoning of Large Language Model on Knowledge Graph
get_batch_files 1 other paper
1 dated earlier
2404.07677 (2024-04)
ODA: Observation-Driven Agent for integrating LLMs and Knowledge Graphs
sliding_window_type 1 other paper
1 dated earlier
2307.07697 (2023-07)
Think-on-Graph: Deep and Responsible Reasoning of Large Language Model on Knowledge Graph

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-23.

Repositories linked to this paper

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

Abstract

Retrieval-augmented generation (RAG) has improved large language models (LLMs) by using knowledge retrieval to overcome knowledge deficiencies. However, current RAG methods often fall short of ensuring the depth and completeness of retrieved information, which is necessary for complex reasoning tasks. In this work, we introduce Think-on-Graph 2.0 (ToG-2), a hybrid RAG framework that iteratively retrieves information from both unstructured and structured knowledge sources in a tight-coupling manner. Specifically, ToG-2 leverages knowledge graphs (KGs) to link documents via entities, facilitating deep and knowledge-guided context retrieval. Simultaneously, it utilizes documents as entity contexts to achieve precise and efficient graph retrieval. ToG-2 alternates between graph retrieval and context retrieval to search for in-depth clues relevant to the question, enabling LLMs to generate answers. We conduct a series of well-designed experiments to highlight the following advantages of ToG-2: 1) ToG-2 tightly couples the processes of context retrieval and graph retrieval, deepening context retrieval via the KG while enabling reliable graph retrieval based on contexts; 2) it achieves deep and faithful reasoning in LLMs through an iterative knowledge retrieval process of collaboration between contexts and the KG; and 3) ToG-2 is training-free and plug-and-play compatible with various LLMs. Extensive experiments demonstrate that ToG-2 achieves overall state-of-the-art (SOTA) performance on 6 out of 7 knowledge-intensive datasets with GPT-3.5, and can elevate the performance of smaller models (e.g., LLAMA-2-13B) to the level of GPT-3.5's direct reasoning. The source code is available on https://github.com/IDEA-FinAI/ToG-2.

For agents

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

get_harvested_code_for_paper("2407.10805")
get_code_for_paper("2407.10805")
have("2407.10805")

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

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

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

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

Connect an agent — have() is free.