SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2601.11047 · 2026

CoG: Controllable Graph Reasoning via Relational Blueprints and Failure-Aware Refinement over Knowledge Graphs

Wen Zhang, Songze Li, Huajun Chen, Italy Spain, Zhaoyan Gong, Xiaoke Guo, Yuanxiang Liu, Qifei Zhang, Germany Belgium, Paris Versailles, Strasbourg Le Mans

arXiv · PDF · Open in the Atlas

Code that ran

12 of 13 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; 0 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 11 failures of our instrument; 1 no recorded run), measured 2026-11-22; 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/2601.11047.json · badge: /api/ran/2601.11047.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
zjukg/CoG canonical (classifier label)
classifier basis: census
12 ran · 1 no recorded run
FunctionStatusWhere it lives
abandon_rels Ran
ran, violated the contract we drafted
zjukg/CoG/CoG/freebase_func.py
code served (permissive licence) · get_code("8efd8b00e5ee004a")
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

def abandon_rels(relation):
    if relation == 'type.object.type' or relation == 'type.object.name' or relation.startswith('common.') or relation.startswith('freebase.') or ('sameAs' in relation):
        return True

ARGS = {
    'relation': 'type.object.type'
}
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
extract_skeleton Ran
ran; our contract draft was wrong, not the code
zjukg/CoG/CoG/build_skeleton.py
code served (permissive licence) · get_code("331ce3b42178a0dc")
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 re

def extract_skeleton(sparql):
    """
    从 SPARQL 中提取纯关系链 (通用逻辑 - 增强版)
    兼容: ns:relation, <http://.../relation>, 以及 GrailQA 的 :relation
    """
    if not sparql:
        return None
    sparql_str = str(sparql)
    pattern = '(?:ns:|kb:|http://rdf\\.freebase\\.com/ns/|:)([a-zA-Z0-9_.]+)'
    rels = re.findall(pattern, sparql_str)
    clean_rels = [r for r in rels if not r.startswith('m.') and 'type.object' not in r and ('common.' not in r) and ('rdfs' not in r) and ('rdf' not in r) and (not r[0].isdigit())]
    if not clean_rels:
        return None
    return ' -> '.join(clean_rels)


ARGS = {
    "sparql": "SELECT ?x WHERE { ?x ns:film_actor_filmography_actor ns:m_012345 ; ns:film_character_name ?c . }"
}
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 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_one_data Ran
ran; our contract draft was wrong, not the code
zjukg/CoG/CoG/main_freebase.py
code served (permissive licence) · get_code("c6edd0c4b397a6d4")
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 minimal valid arguments for get_one_data
# The function iterates over datas and checks if data[question_string] == question
# It returns a list containing the matching data dict

# Create sample data - list of dicts with a question_string key
datas = [
    {"query": "what is 2+2?", "answer": 4},
    {"query": "what is the capital of France?", "answer": "Paris"},
    {"query": "what is the color of the sky?", "answer": "blue"},
]

question_string = "query"
question = "what is 2+2?"

ARGS = {
    "datas": datas,
    "question_string": question_string,
    "question": question,
}
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
get_openai_client Ran
ran; our contract draft was wrong, not the code
zjukg/CoG/CoG/utils.py
code served (permissive licence) · get_code("eb6db827175b28c6")
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 OpenAI. 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 os
import openai
import httpx

# Set up environment variables for testing
os.environ['OPENAI_API_KEY'] = 'test-api-key-12345'
os.environ['OPENAI_BASE_URL'] = 'https://api.openai.com/v1'
os.environ['OPENAI_TRUST_ENV'] = '0'

# Define arguments for get_openai_client
ARGS = {
    'api_key': None,  # Will use OPENAI_API_KEY from environment
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
httpx, openai — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type OpenAI — a OpenAI output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a OpenAI 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
parse_grailqa_item Ran
ran; our contract draft was wrong, not the code
zjukg/CoG/CoG/build_skeleton.py
code served (permissive licence) · get_code("9fe92725c88ed577")
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 tuple, 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)

# The function parse_grailqa_item takes a single parameter 'item'
# It expects item to be a dict with keys like 'question', 'sparql_query', and optionally 'graph_query'
# The function uses: item.get('question'), item.get('sparql_query'), item.get('graph_query')
# and if graph_query exists, it accesses graph_query.get('sparql')

# Create a valid item dict
item = {
    'question': 'What is the capital of France?',
    'sparql_query': 'SELECT ?x WHERE { ?x rdf:type dbo:City . }',
    'graph_query': {
        'sparql': 'SELECT ?capital WHERE { dbr:France dbo:capital ?capital . }'
    }
}

ARGS = {
    'item': item
}
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 tuple, ndim 1, dtype family float — 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
parse_webqsp_item Ran
ran; our contract draft was wrong, not the code
zjukg/CoG/CoG/build_skeleton.py
code served (permissive licence) · get_code("c4a97fee7894319c")
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 tuple, 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

# Construct a valid item dict that mimics WebQSP format
item = {
    'RawQuestion': 'What is the capital of France?',
    'Parses': [
        {
            'Sparql': 'SELECT ?x WHERE { ?x dbo:country dbr:France . ?x dbo:capital ?capital . }'
        }
    ]
}

ARGS = {
    'item': item
}
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 tuple, ndim 1, dtype family float — 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
prepare_dataset_for_eval Ran
ran; our contract draft was wrong, not the code
zjukg/CoG/eval/utils.py
code served (permissive licence) · get_code("6e60fdf7e6601fc1")
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 tuple. 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 json
import tempfile
import os

# Create temporary directory and files for testing
temp_dir = tempfile.mkdtemp()

# Create a mock cwq.json file
cwq_data = [
    {"question": "Who is the president?", "answer": "Biden"},
    {"question": "What is the capital?", "answer": "Washington"}
]
cwq_path = os.path.join(temp_dir, "cwq.json")
with open(cwq_path, 'w', encoding='utf-8') as f:
    json.dump(cwq_data, f)

# Create a mock output jsonl file
output_jsonl_path = os.path.join(temp_dir, "output")
with open(output_jsonl_path + ".jsonl", 'w', encoding='utf-8') as f:
    f.write(json.dumps({"question": "Who is the president?", "predicted_answer": "Biden"}) + "\n")
    f.write(json.dumps({"question": "What is the capital?", "predicted_answer": "Washington"}) + "\n")

# Patch the file paths in the function by modifying the module
import sys
from unittest.mock import patch

# Create the arguments
ARGS = {
    "dataset_name": "cwq",
    "output_file": output_jsonl_path
}

# Patch the data directory references
original_builtins_open = open

def patched_open(file_path, *args, **kwargs):
    if '../data/cwq.json' in file_path:
        return original_builtins_open(cwq_path, *args, **kwargs)
    return original_builtins_open(file_path, *args, **kwargs)

import builtins
builtins.open = patched_open

ARGS = {
    "dataset_name": "cwq",
    "output_file": output_jsonl_path
}
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 tuple — a tuple output has no array shape of its own; none is 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
process_question Ran
ran; our contract draft was wrong, not the code
zjukg/CoG/CoG/main_freebase.py
code served (permissive licence) · get_code("d1f04ebb317abd0e")
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 Counter. 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
import torch.nn as nn
import numpy as np
from collections import Counter
from threading import Lock
import os
import tempfile

torch.manual_seed(0)

# Create a minimal model that supports encode() method
class MinimalEncoder(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(10, 4)
    
    def encode(self, text):
        """Return a small embedding vector"""
        if isinstance(text, list):
            return torch.randn(len(text), 4)
        else:
            return torch.randn(1, 4)

# Create a minimal retriever with required methods
class MinimalRetriever:
    def __init__(self):
        pass
    
    def retrieve(self, query, k=5):
        return [f"result_{i}" for i in range(k)]

# Create minimal args object
class Args:
    def __init__(self):
        self.dataset = "test_dataset"
        self.LLM_type = "test_llm"
        self.depth = 2
        self.max_steps = 10

# Create mock data dictionary
data = {
    "question_1": "What is the capital of France?",
    "topic_entity": {
        "Q142": "France",
        "Q90": "Paris"
    }
}

# Create temporary directory for file operations
temp_dir = tempfile.mkdtemp()
os.makedirs(f"{temp_dir}/../mem/test_dataset/test_llm", exist_ok=True)

# Mock the imported functions and modules that are used in the function
import sys
from unittest.mock import MagicMock

# Create mock modules
sys.modules['util'] = MagicMock()
util = sys.modules['util']

# Mock cos_sim to return similarity scores
def mock_cos_sim(a, b):
    scores = torch.randn(1, b.shape[0])
    return scores

util.cos_sim = mock_cos_sim

# Mock the external functions called in process_question
def speculate_skeleton_chain(question, topic_entity_names, retriever, args, model):
    return (
        ["relation_1", "relation_2"],  # skeleton_chain
        {"calls": 1, "input": 10, "output": 20},  # skel_tokens
        "raw skeleton string",  # raw_skeleton_str
        "spec_type_1"  # spec_type
    )

def get_subquestions(q_mem_f_path, question, args):
    return (
        ["sub_q_1", "sub_q_2"],  # sub_questions
        {"calls": 1, "input": 5, "output": 10}  # token_num
    )

def perform_refinement(question, entities, args, all_t):
    return "refined_answer"

def save_2_jsonl(question, question_string, answer, chain, call_num, all_t, start_time, file_name, file_lock):
    pass

def relation_search_prune(entity, sub_questions, entity_name, pre_relations, pre_head, question, args, model=None, predicted_relation=None, global_skeleton_emb=None, speculation_list=None, guard_budget=1):
    return (
        [{"entity": entity, "relations": ["rel1"]}],  # retrieve_relations
        {"calls": 1, "input": 3, "output": 7},  # token_num
        1,  # used_count
        "track_type_1"  # track_type
    )

# Inject mock functions into the module namespace
import __main__
__main__.speculate_skeleton_chain = speculate_skeleton_chain
__main__.get_subquestions = get_subquestions
__main__.perform_refinement = perform_refinement
__main__.save_2_jsonl = save_2_jsonl
__main__.relation_search_prune = relation_search_prune

# Construct ARGS
ARGS = {
    "data": data,
    "args": Args(),
    "question_string": "question_1",
    "model": MinimalEncoder(),
    "file_lock": Lock(),
    "retriever": MinimalRetriever()
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
__main__, numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Counter — a Counter output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Counter 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
read_output Ran
ran; our contract draft was wrong, not the code
zjukg/CoG/eval/utils.py
code served (permissive licence) · get_code("4c28af9eaa960d1c")
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 json
import tempfile
import os

# Create a temporary JSONL file with test data
temp_dir = tempfile.mkdtemp()
temp_file_path = os.path.join(temp_dir, 'test_output')

# Create test data with multiple lines
test_data = [
    {"question_id": "q1", "answer": "answer1", "score": 0.9},
    {"question_id": "q2", "answer": "answer2", "score": 0.8},
    {"question_id": "q3", "answer": "answer3", "score": 0.7},
]

# Write test data to JSONL file
with open(temp_file_path + '.jsonl', 'w', encoding='utf-8') as f:
    for item in test_data:
        f.write(json.dumps(item) + '\n')

ARGS = {
    'file_path': temp_file_path,
    'question_string': 'question_id'
}
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
repeat_unanswer Ran
ran; our contract draft was wrong, not the code
zjukg/CoG/CoG/main_freebase.py
code served (permissive licence) · get_code("7d3759994694a369")
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 json
import tempfile

# Create a temporary directory for test files
temp_dir = tempfile.mkdtemp()
original_dir = os.getcwd()
os.chdir(temp_dir)

# Create a sample JSONL file with some answered questions
file_path = 'PoG_test_dataset_model_v1.jsonl'
with open(file_path, 'w', encoding='utf-8') as f:
    f.write(json.dumps({"question_id": "q1", "answer": "answer1"}) + '\n')
    f.write(json.dumps({"question_id": "q2", "answer": "answer2"}) + '\n')
    f.write(json.dumps({"question_id": "q3", "answer": "answer3"}) + '\n')

# Create sample data with some questions already answered and some not
datas = [
    {"question_id": "q1", "text": "What is 1+1?"},
    {"question_id": "q2", "text": "What is 2+2?"},
    {"question_id": "q4", "text": "What is 3+3?"},
    {"question_id": "q5", "text": "What is 4+4?"},
]

ARGS = {
    "dataset": "test_dataset",
    "datas": datas,
    "question_string": "question_id",
    "model_name": "model_v1",
}
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
replace_relation_prefix Ran
ran; our contract draft was wrong, not the code
zjukg/CoG/CoG/freebase_func.py
code served (permissive licence) · get_code("f7def732c19d62d5")
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

ARGS = {
    'relations': [
        {
            'relation': {
                'value': 'http://rdf.freebase.com/ns/people/person/name'
            }
        },
        {
            'relation': {
                'value': 'http://rdf.freebase.com/ns/film/film/genre'
            }
        }
    ]
}
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
run_llm Ran
ran; our contract draft was wrong, not the code
zjukg/CoG/CoG/utils.py
code served (permissive licence) · get_code("277f66c7640f893d")
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 tuple, 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 openai
from unittest.mock import Mock, MagicMock

# Set up a mock OpenAI API key to avoid actual API calls
os.environ['OPENAI_API_KEY'] = 'sk-test-key-12345'

# Create mock OpenAI client and response
def create_mock_openai_client():
    mock_client = Mock(spec=openai.OpenAI)
    mock_completion = Mock()
    mock_choice = Mock()
    mock_message = Mock()
    mock_usage = Mock()
    
    mock_message.content = "This is a test response from the LLM."
    mock_choice.message = mock_message
    mock_completion.choices = [mock_choice]
    mock_completion.usage = mock_usage
    mock_usage.total_tokens = 50
    mock_usage.prompt_tokens = 20
    mock_usage.completion_tokens = 30
    
    mock_client.chat.completions.create.return_value = mock_completion
    return mock_client

# Monkey-patch get_openai_client to return our mock
def mock_get_openai_client(api_key=None):
    return create_mock_openai_client()

# Patch the module
import sys
current_module = sys.modules[__name__]
if hasattr(current_module, 'get_openai_client'):
    original_get_openai_client = current_module.get_openai_client
else:
    original_get_openai_client = None

def get_openai_client(api_key=None):
    return create_mock_openai_client()

# Define arguments for run_llm function
ARGS = {
    'prompt': 'What is the capital of France?',
    'temperature': 0.7,
    'max_tokens': 100,
    'opeani_api_keys': 'sk-test-key-12345',
    'engine': 'gpt-3.5-turbo',
    'print_in': False,
    'print_out': False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
httpx, openai — 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 float — 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
align Not yet run
unverified (harvested, no recorded run)
zjukg/CoG/eval/utils.py
code served (permissive licence) · get_code("83e832b7a9f97750")
How it ran

no invocation recorded.

Also present in other papers' code

Of 13 samples lifted from this paper's linked repositories, 13 carry a function identity and 0 do not. Of the 13 distinct functions with an identity, 5 are also present in other papers whose code we hold (5 with at least one paper dated earlier, 0 the same month, 0 later) and 8 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 dated earlier
2307.07697 (2023-07)
Think-on-Graph: Deep and Responsible Reasoning of Large Language Model on Knowledge Graph
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
replace_relation_prefix 2 other papers
2 dated earlier
2409.03155 (2024-09)
Debate on Graph: a Flexible and Reliable Reasoning Framework for Large Language Models
2410.23875 (2024-10)
Plan-on-Graph: Self-Correcting Adaptive Planning of Large Language Model on Knowledge Graphs
align 1 other paper
1 dated earlier
2410.23875 (2024-10)
Plan-on-Graph: Self-Correcting Adaptive Planning of Large Language Model on Knowledge Graphs
get_one_data 1 other paper
1 dated earlier
2410.23875 (2024-10)
Plan-on-Graph: Self-Correcting Adaptive Planning of Large Language Model on Knowledge Graphs
prepare_dataset_for_eval 1 other paper
1 dated earlier
2410.23875 (2024-10)
Plan-on-Graph: Self-Correcting Adaptive Planning of Large Language Model on Knowledge Graphs

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

Large Language Models (LLMs) have demonstrated remarkable reasoning capabilities but often grapple with reliability challenges like hallucinations. While Knowledge Graphs (KGs) offer explicit grounding, existing paradigms of KG-augmented LLMs typically exhibit cognitive rigidity-applying homogeneous search strategies that render them vulnerable to instability under neighborhood noise and structural misalignment leading to reasoning stagnation. To address these challenges, we propose CoG, a training-free framework inspired by Dual-Process Theory that mimics the interplay between intuition and deliberation. First, functioning as the fast, intuitive process, the Relational Blueprint Guidance module leverages relational blueprints as interpretable soft structural constraints to rapidly stabilize the search direction against noise. Second, functioning as the prudent, analytical process, the Failure-Aware Refinement module intervenes upon encountering reasoning impasses. It triggers evidence-conditioned reflection and executes controlled backtracking to overcome reasoning stagnation. Experimental results on three benchmarks demonstrate that CoG significantly outperforms state-of-the-art approaches in both accuracy and efficiency.

For agents

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

get_harvested_code_for_paper("2601.11047")
get_code_for_paper("2601.11047")
have("2601.11047")

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

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

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

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

Connect an agent — have() is free.