SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2305.10601 · NeurIPS · 2023

Tree of Thoughts: Deliberate Problem Solving with Large Language Models

Karthik Narasimhan, Yuan Cao, Shunyu Yao, Jeffrey Zhao, Dian Yu, Izhak Shafran, Thomas L. Griffiths

arXiv · PDF · Open in the Atlas

Code that ran

19 of 24 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (6 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 17 have no contract verdict; 2 failures of our instrument; 5 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/2305.10601.json · badge: /api/ran/2305.10601.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
appl-team/appl canonical (classifier label)
classifier basis: census
7 ran · 0 no recorded run
princeton-nlp/tree-of-thought-llm canonical (classifier label)
classifier basis: census
2 ran · 0 no recorded run
huiwy/reflection-on-trees community
Papers with Code archive
3 ran · 5 no recorded run
codelion/optillm community
Papers with Code archive
3 ran · 0 no recorded run
katamb/tree-of-thought-llm-ca community (classifier label)
classifier basis not recorded on the link
3 ran · 0 no recorded run
kyegomez/tree-of-thoughts reimplementation (classifier label)
classifier basis: classifier_2025
1 ran · 0 no recorded run
FunctionStatusWhere it lives
DialogueState Ran
ran on a synthesized input · constructed an object; no result was computed
codelion/optillm/optillm/mcts.py
code served (permissive licence) · get_code("4a6a2716cd1ecfd3")
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 an instance of its own class, DialogueState: the run constructed the object and did not call it, so no result was computed. 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 numpy as np
from typing import List, Dict

# Construct valid arguments for DialogueState

system_prompt = "You are a helpful assistant designed to answer questions accurately and concisely."

conversation_history = [
    {"role": "user", "content": "What is machine learning?"},
    {"role": "assistant", "content": "Machine learning is a subset of artificial intelligence."},
    {"role": "user", "content": "Can you explain neural networks?"},
    {"role": "assistant", "content": "Neural networks are computational models inspired by biological neurons."}
]

current_query = "How do transformers work?"

ARGS = {
    "system_prompt": system_prompt,
    "conversation_history": conversation_history,
    "current_query": current_query
}
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 DialogueState — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a DialogueState 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
MCTS Ran
ran on a synthesized input · constructed an object; no result was computed
codelion/optillm/optillm/mcts.py
code served (permissive licence) · get_code("c919c70de90b021d")
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 an instance of its own class, MCTS: the run constructed the object and did not call it, so no result was computed. 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 random
import logging
import numpy as np
import networkx as nx
from typing import List, Dict

# Set up logging
logging.basicConfig(level=logging.DEBUG)

# Define DialogueState and MCTSNode as they appear in the function
class DialogueState:
    def __init__(self, system_prompt: str, conversation_history: List[Dict[str, str]], current_query: str):
        self.system_prompt = system_prompt
        self.conversation_history = conversation_history
        self.current_query = current_query

    def __str__(self):
        return f'System: {self.system_prompt}\nHistory: {self.conversation_history}\nCurrent Query: {self.current_query}'

class MCTSNode:
    def __init__(self, state: DialogueState, parent=None):
        self.state = state
        self.parent = parent
        self.children = []
        self.visits = 0
        self.value = 0

# Create a minimal stand-in client class
class MockClient:
    def __init__(self):
        pass
    
    def call_api(self, prompt, max_tokens):
        return "Mock response from API"

# Create a minimal stand-in model class
class MockModel:
    def __init__(self):
        self.name = "mock-model"
    
    def generate(self, prompt):
        return "Generated text"

# Create request_config dict
request_config = {
    'max_tokens': 2048,
    'temperature': 0.7
}

# Create arguments for MCTS constructor
ARGS = {
    'simulation_depth': 3,
    'exploration_weight': 1.414,
    'client': MockClient(),
    'model': MockModel(),
    'request_config': request_config,
    'request_id': 'test_request_001'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
networkx, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type MCTS — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a MCTS 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
MCTSAggregation Ran
ran on a synthesized input · constructed an object; no result was computed
huiwy/reflection-on-trees/reasoners/algorithm/mcts.py
code served (permissive licence) · get_code("6445e3fedf96a2dd")
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 an instance of its own class, MCTSAggregation: the run constructed the object and did not call it, so no result was computed. 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 numpy as np
from typing import Hashable

# Define a simple State type - just a string identifier
class SimpleState:
    def __init__(self, value: str):
        self.value = value

# Define a simple Action type - just a string
SimpleAction = str

# Create a retrieve_answer function that extracts an answer from a state
def retrieve_answer(state: SimpleState) -> Hashable:
    return state.value

# Build a small MCTS tree to test the aggregation
# We need to create MCTSNode instances manually
from typing import Optional, List, Callable

Action = type('Action', (), {})
State = type('State', (), {})

class MCTSNode:
    id_iter = iter(range(100))
    
    def __init__(self, state: Optional[SimpleState], action: Optional[SimpleAction], 
                 parent: 'Optional[MCTSNode]' = None, fast_reward: float = 0.0, 
                 fast_reward_details=None, is_terminal: bool = False, 
                 calc_q: Callable[[List[float]], float] = np.mean):
        self.id = next(MCTSNode.id_iter)
        if fast_reward_details is None:
            fast_reward_details = {}
        self.cum_rewards: List[float] = []
        self.fast_reward = self.reward = fast_reward
        self.fast_reward_details = fast_reward_details
        self.is_terminal = is_terminal
        self.action = action
        self.state = state
        self.parent = parent
        self.children: Optional[List['MCTSNode']] = None
        self.calc_q = calc_q
        if parent is None:
            self.depth = 0
        else:
            self.depth = parent.depth + 1
    
    @property
    def Q(self) -> float:
        if self.state is None:
            return self.fast_reward
        else:
            return self.calc_q(self.cum_rewards)

# Create a simple tree structure
root = MCTSNode(state=None, action=None, parent=None, fast_reward=0.0, is_terminal=False)

# Add terminal children with states and rewards
child1 = MCTSNode(state=SimpleState("answer_A"), action="action1", parent=root, 
                  fast_reward=0.5, is_terminal=True)
child2 = MCTSNode(state=SimpleState("answer_B"), action="action2", parent=root, 
                  fast_reward=0.7, is_terminal=True)

root.children = [child1, child2]

# Create the ARGS dictionary with all required parameters for MCTSAggregation.__init__
ARGS = {
    'retrieve_answer': retrieve_answer,
    'weight_policy': 'edge'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type MCTSAggregation — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a MCTSAggregation 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
MCTSNode Ran
ran on a synthesized input · constructed an object; no result was computed
codelion/optillm/optillm/mcts.py
code served (permissive licence) · get_code("778fb657e40c2423")
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 an instance of its own class, MCTSNode: the run constructed the object and did not call it, so no result was computed. 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
from typing import List, Dict

# Define DialogueState class
class DialogueState:
    def __init__(self, system_prompt: str, conversation_history: List[Dict[str, str]], current_query: str):
        self.system_prompt = system_prompt
        self.conversation_history = conversation_history
        self.current_query = current_query

    def __str__(self):
        return f'System: {self.system_prompt}\nHistory: {self.conversation_history}\nCurrent Query: {self.current_query}'

# Define MCTSNode class
class MCTSNode:
    def __init__(self, state: DialogueState, parent=None):
        self.state = state
        self.parent = parent
        self.children = []
        self.visits = 0
        self.value = 0

# Create valid arguments for MCTSNode
system_prompt = "You are a helpful assistant."
conversation_history = [
    {"role": "user", "content": "Hello"},
    {"role": "assistant", "content": "Hi there!"}
]
current_query = "How are you?"

dialogue_state = DialogueState(
    system_prompt=system_prompt,
    conversation_history=conversation_history,
    current_query=current_query
)

parent_node = None

ARGS = {
    "state": dialogue_state,
    "parent": parent_node
}
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 MCTSNode — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a MCTSNode 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
MCTSNode Ran
ran on a synthesized input · constructed an object; no result was computed
huiwy/reflection-on-trees/reasoners/algorithm/mcts.py
code served (permissive licence) · get_code("e508098731faf687")
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 an instance of its own class, MCTSNode: the run constructed the object and did not call it, so no result was computed. 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 itertools
import numpy as np
from typing import List, Callable, Optional, TypeVar, Generic

Action = TypeVar('Action')
State = TypeVar('State')

class MCTSNode(Generic[State, Action]):
    id_iter = itertools.count()

    @classmethod
    def reset_id(cls):
        cls.id_iter = itertools.count()

    def __init__(self, state: Optional[State], action: Optional[Action], parent: 'Optional[MCTSNode]'=None, fast_reward: float=0.0, fast_reward_details=None, is_terminal: bool=False, calc_q: Callable[[List[float]], float]=np.mean):
        """
        A node in the MCTS search tree

        :param state: the current state
        :param action: the action of the last step, i.e., the action from parent node to current node
        :param parent: the parent node, None if root of the tree
        :param fast_reward: an estimation of the reward of the last step
        :param is_terminal: whether the current state is a terminal state
        :param calc_q: the way to calculate the Q value from histories. Defaults: np.mean
        """
        self.id = next(MCTSNode.id_iter)
        if fast_reward_details is None:
            fast_reward_details = {}
        self.cum_rewards: List[float] = []
        self.fast_reward = self.reward = fast_reward
        self.fast_reward_details = fast_reward_details
        self.is_terminal = is_terminal
        self.action = action
        self.state = state
        self.parent = parent
        self.children: 'Optional[List[MCTSNode]]' = None
        self.calc_q = calc_q
        if parent is None:
            self.depth = 0
        else:
            self.depth = parent.depth + 1

    @property
    def Q(self) -> float:
        if self.state is None:
            return self.fast_reward
        else:
            return self.calc_q(self.cum_rewards)


MCTSNode.reset_id()

ARGS = {
    'state': {'position': [1, 2, 3], 'valid': True},
    'action': 'move_forward',
    'parent': None,
    'fast_reward': 1.5,
    'fast_reward_details': {'source': 'heuristic', 'confidence': 0.95},
    'is_terminal': False,
    'calc_q': np.mean
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type MCTSNode — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a MCTSNode 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
MCTSResult Ran
ran on a synthesized input · constructed an object; no result was computed
huiwy/reflection-on-trees/reasoners/algorithm/mcts.py
code served (permissive licence) · get_code("583801f0a2465d0c")
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 an instance of its own class, MCTSResult: the run constructed the object and did not call it, so no result was computed. 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 numpy as np
from typing import List, NamedTuple, Callable, Optional, Hashable

Action = str
State = str

Trace = tuple

class MCTSNode:
    id_iter = iter(range(1000))
    
    @classmethod
    def reset_id(cls):
        cls.id_iter = iter(range(1000))
    
    def __init__(self, state: Optional[State], action: Optional[Action], parent: 'Optional[MCTSNode]' = None, fast_reward: float = 0.0, fast_reward_details=None, is_terminal: bool = False, calc_q: Callable[[List[float]], float] = np.mean):
        self.id = next(MCTSNode.id_iter)
        if fast_reward_details is None:
            fast_reward_details = {}
        self.cum_rewards: List[float] = []
        self.fast_reward = self.reward = fast_reward
        self.fast_reward_details = fast_reward_details
        self.is_terminal = is_terminal
        self.action = action
        self.state = state
        self.parent = parent
        self.children: Optional[List[MCTSNode]] = None
        self.calc_q = calc_q
        if parent is None:
            self.depth = 0
        else:
            self.depth = parent.depth + 1

class MCTSResult(NamedTuple):
    terminal_state: State
    cum_reward: float
    trace: Trace
    trace_of_nodes: List[MCTSNode]
    tree_state: MCTSNode
    trace_in_each_iter: List[List[MCTSNode]] = None
    tree_state_after_each_iter: List[MCTSNode] = None
    aggregated_result: Optional[Hashable] = None

MCTSNode.reset_id()

root_node = MCTSNode(state="root_state", action=None, parent=None, fast_reward=0.0, is_terminal=False)
child_node = MCTSNode(state="child_state", action="move_left", parent=root_node, fast_reward=1.5, is_terminal=False)

trace_states = ["root_state", "child_state", "terminal_state"]
trace_actions = ["move_left", "move_right"]
trace = (trace_states, trace_actions)

trace_of_nodes = [root_node, child_node]
tree_state = root_node
trace_in_each_iter = [[root_node], [child_node]]
tree_state_after_each_iter = [root_node, child_node]

ARGS = {
    "terminal_state": "terminal_state",
    "cum_reward": 2.5,
    "trace": trace,
    "trace_of_nodes": trace_of_nodes,
    "tree_state": tree_state,
    "trace_in_each_iter": trace_in_each_iter,
    "tree_state_after_each_iter": tree_state_after_each_iter,
    "aggregated_result": "final_result"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type MCTSResult — the run constructed an instance of its own class and did not call it; no shape 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
appl_dedent Ran
ran on a synthesized input
appl-team/appl/src/appl/core/compile.py
code served (permissive licence) · get_code("7eb3fea92922729c")
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 ast
import re
import textwrap
from loguru import logger

# Test case 1: Simple well-formed Python code
source_valid = """
def hello():
    return 42
"""

# Test case 2: Code with indentation that needs dedenting
source_indented = """
    def foo():
        x = 1
        return x
"""

# Test case 3: Code with multiline string (edge case)
source_multiline = """
    def bar():
        s = '''
        hello
        world
        '''
        return s
"""

ARGS = {
    "source": source_indented
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
loguru — 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_result Ran
ran on a synthesized input
katamb/tree-of-thought-llm-ca/src/tot/tasks/codeanalysis.py
code served (permissive licence) · get_code("aee70aa81e74fa9a")
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 clean_result(text):
    pattern = '\\b(?:cwe-|CWE-|cwe|CWE)(\\d+)\\b'
    matches = re.findall(pattern, text, re.IGNORECASE)
    unique_matches = set(matches)
    formatted_matches = [f'CWE-{match}' for match in unique_matches]
    return ' '.join(formatted_matches)

ARGS = {
    'text': 'This code has CWE-123 and cwe-456 vulnerabilities. Also mentions CWE-123 again and CWE-789.'
}
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
dict_to_pydantic Ran
ran on a synthesized input
appl-team/appl/src/appl/caching/utils.py
code served (permissive licence) · get_code("9b3aebc249c853c6")
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 Person. 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.

from typing import Any, Dict, Type
from pydantic import BaseModel

# Define a simple Pydantic model for testing
class Person(BaseModel):
    name: str
    age: int
    email: str

# Create a dictionary with data matching the Pydantic model
data = {
    "name": "Alice",
    "age": 30,
    "email": "alice@example.com"
}

# Set up ARGS with the function parameters
ARGS = {
    "data": data,
    "cls": Person
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pydantic — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Person — a Person output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Person 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
encode_to_uuid_v5 Ran
ran on a synthesized input
appl-team/appl/src/appl/caching/utils.py
code served (permissive licence) · get_code("64959a06bee3598c")
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 uuid

# Construct valid arguments for encode_to_uuid_v5
ARGS = {
    "value": "test_string_to_encode",
    "namespace": uuid.NAMESPACE_DNS
}
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
find_dotenv Ran
ran on a synthesized input
appl-team/appl/src/appl/utils.py
code served (permissive licence) · get_code("c4e580b088833502")
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 os
import sys
import tempfile

# Create a temporary directory to work with
temp_dir = tempfile.mkdtemp()

# Create a dummy .env file in the temp directory
env_file_path = os.path.join(temp_dir, '.env')
with open(env_file_path, 'w') as f:
    f.write('TEST_VAR=test_value\n')

ARGS = {
    'filename': '.env',
    'raise_error_if_not_found': False,
    'current_folder': temp_dir,
    'usecwd': False,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
dotenv — 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
find_files Ran
ran on a synthesized input
appl-team/appl/src/appl/utils.py
code served (permissive licence) · get_code("06226fb0ae82092a")
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
import shutil

# Create a temporary directory structure for testing
temp_root = tempfile.mkdtemp()
parent_dir = os.path.dirname(temp_root)
test_dir = temp_root

# Create some test files in the hierarchy
os.makedirs(test_dir, exist_ok=True)
with open(os.path.join(test_dir, ".env"), "w") as f:
    f.write("TEST=1")
with open(os.path.join(parent_dir, "config.ini"), "w") as f:
    f.write("config")

ARGS = {
    "folder": test_dir,
    "filenames": [".env", "config.ini", "nonexistent.txt"]
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
dotenv — 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_current_numbers Ran
ran on a synthesized input
princeton-nlp/tree-of-thought-llm/src/tot/tasks/game24.py
code served (permissive licence) · get_code("e453ebba492daf39")
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 = {
    "y": "Some output\nAnother line\nleft: 42)"
}
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_cwes Ran
ran on a synthesized input
katamb/tree-of-thought-llm-ca/src/tot/tasks/codeanalysis.py
code served (permissive licence) · get_code("1b66502a5e6457a6")
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 clean_result(text):
    pattern = '\\b(?:cwe-|CWE-|cwe|CWE)(\\d+)\\b'
    matches = re.findall(pattern, text, re.IGNORECASE)
    unique_matches = set(matches)
    formatted_matches = [f'CWE-{match}' for match in unique_matches]
    return ' '.join(formatted_matches)

def get_cwes(input_text):
    vulnerabilities = ''
    if '\n' in input_text:
        for line in input_text.split('\n'):
            if ': YES |' in line.strip():
                vulnerabilities += clean_result(line.strip()) + ' '
    elif ': YES |' in input_text.strip():
        vulnerabilities += clean_result(input_text.strip()) + ' '
    return vulnerabilities.strip()

# Setup code
input_text_single = "Buffer Overflow: YES | CWE-120 found"
input_text_multi = "SQL Injection: YES | cwe-89 detected\nCross-site Scripting: YES | CWE-79 present"

ARGS = {
    'input_text': input_text_multi
}
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_folder Ran
ran on a synthesized input
appl-team/appl/src/appl/utils.py
code served (permissive licence) · get_code("70d9d6c9c2ec99d8")
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 os
import sys

# The function get_folder takes two optional parameters:
# - current_folder: Optional[str]
# - usecwd: bool

# Reading the function body:
# - current_folder is used in a conditional check (if usecwd or _is_interactive() or getattr(sys, 'frozen', False))
# - It's compared with `is not None`
# - usecwd is a boolean flag that controls logic flow

# For testing purposes, we'll provide:
# - current_folder: a valid directory path (or None)
# - usecwd: a boolean value

ARGS = {
    "current_folder": None,
    "usecwd": False,
}
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
gpt_usage Ran
ran; our contract draft was wrong, not the code
princeton-nlp/tree-of-thought-llm/src/tot/models.py
pointer only (licence: MIT); the stored copy get_code serves, from iamhankai/Forest-of-Thought, is pointer only (licence: NONE) · get_code("1506be9f936c7be7")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from iamhankai/Forest-of-Thought, and GitHub detected no licence in that repository 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.

gpt_usage Ran
ran on a synthesized input
katamb/tree-of-thought-llm-ca/src/tot/models.py
code served (permissive licence) · get_code("605644c3d7369622")
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.

import torch
import numpy as np

# Set random seed for reproducibility
torch.manual_seed(0)

# Initialize global variables that the function uses
global completion_tokens, prompt_tokens
completion_tokens = 150
prompt_tokens = 300

# Define ARGS dictionary with valid arguments for gpt_usage function
ARGS = {
    'backend': 'gpt-4'
}
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 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
pydantic_to_dict Ran
ran on a synthesized input
appl-team/appl/src/appl/caching/utils.py
code served (permissive licence) · get_code("71622f179ee00cfd")
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.

from pydantic import BaseModel

class SampleModel(BaseModel):
    name: str
    value: int
    data: list

obj = SampleModel(name="test", value=42, data=[1, 2, 3])

ARGS = {
    "obj": obj
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pydantic — 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
string_to_dict Ran
ran; our contract draft was wrong, not the code
kyegomez/tree-of-thoughts/tree_of_thoughts/agent.py
code served (permissive licence) · get_code("f55d3d712d45739b")
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 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.

import torch
import numpy as np

torch.manual_seed(0)

# The function takes a thought_string parameter and calls eval() on it
# So we need to provide a string that represents valid Python code
# that can be evaluated to produce a dictionary

thought_string = "{'key1': 'value1', 'key2': 42, 'key3': [1, 2, 3]}"

ARGS = {
    'thought_string': thought_string
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, torch — 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
AlgorithmOutput Not yet run
unverified (harvested, no recorded run)
huiwy/reflection-on-trees/reasoners/algorithm/mcts.py
code served (permissive licence) · get_code("455bf868afcd3f83")
How it ran

no invocation recorded.

MCTS Not yet run
unverified (harvested, no recorded run)
huiwy/reflection-on-trees/reasoners/algorithm/mcts.py
code served (permissive licence) · get_code("a60a888f98f637a1")
How it ran

no invocation recorded.

SearchAlgorithm Not yet run
unverified (harvested, no recorded run)
huiwy/reflection-on-trees/reasoners/algorithm/mcts.py
code served (permissive licence) · get_code("11e46ccab8c4b6b1")
How it ran

no invocation recorded.

SearchConfig Not yet run
unverified (harvested, no recorded run)
huiwy/reflection-on-trees/reasoners/algorithm/mcts.py
code served (permissive licence) · get_code("4b65b29a47508556")
How it ran

no invocation recorded.

WorldModel Not yet run
unverified (harvested, no recorded run)
huiwy/reflection-on-trees/reasoners/algorithm/mcts.py
code served (permissive licence) · get_code("a843c8ac332d4291")
How it ran

no invocation recorded.

Also present in other papers' code

Of 24 samples lifted from this paper's linked repositories, 24 carry a function identity and 0 do not. Of the 24 distinct functions with an identity, 4 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 4 later) and 20 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
AlgorithmOutput
brick of this paper's assembly: helper
1 other paper
1 later
2501.18922 (2025-01)
KBQA-o1: Agentic Knowledge Base Question Answering with Monte Carlo Tree Search
SearchAlgorithm
brick of this paper's assembly: helper
1 other paper
1 later
2501.18922 (2025-01)
KBQA-o1: Agentic Knowledge Base Question Answering with Monte Carlo Tree Search
WorldModel
brick of this paper's assembly: helper
1 other paper
1 later
2501.18922 (2025-01)
KBQA-o1: Agentic Knowledge Base Question Answering with Monte Carlo Tree Search
gpt_usage 1 other paper
1 later
2412.09078 (2024-12)
Forest-of-Thought: Scaling Test-Time Compute for Enhancing LLM Reasoning

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

Language models are increasingly being deployed for general problem solving across a wide range of tasks, but are still confined to token-level, left-to-right decision-making processes during inference. This means they can fall short in tasks that require exploration, strategic lookahead, or where initial decisions play a pivotal role. To surmount these challenges, we introduce a new framework for language model inference, "Tree of Thoughts" (ToT), which generalizes over the popular "Chain of Thought" approach to prompting language models, and enables exploration over coherent units of text ("thoughts") that serve as intermediate steps toward problem solving. ToT allows LMs to perform deliberate decision making by considering multiple different reasoning paths and self-evaluating choices to decide the next course of action, as well as looking ahead or backtracking when necessary to make global choices. Our experiments show that ToT significantly enhances language models' problem-solving abilities on three novel tasks requiring non-trivial planning or search: Game of 24, Creative Writing, and Mini Crosswords. For instance, in Game of 24, while GPT-4 with chain-of-thought prompting only solved 4% of tasks, our method achieved a success rate of 74%. Code repo with all prompts: https://github.com/princeton-nlp/tree-of-thought-llm.

For agents

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

get_harvested_code_for_paper("2305.10601")
get_code_for_paper("2305.10601")
have("2305.10601")

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

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

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

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

Connect an agent — have() is free.