SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2602.09574 · ICML · 2026

Aligning Tree-Search Policies with Fixed Token Budgets in Test-Time Scaling of LLMs

M Lewis, C Kim, H Wang, L Van Der Maaten, De Oliveira, M Hassan, K Li, M Singh, C Wang, Naoaki Okazaki, Daisuke Oba, Sora Miyamoto

arXiv · PDF · Open in the Atlas

Code that ran

4 of 6 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (3 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 3 have no contract verdict; 1 failure of our instrument; 2 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/2602.09574.json · badge: /api/ran/2602.09574.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
Sora-Miyamoto/bg-mcts community
Papers with Code archive
4 ran · 2 no recorded run
FunctionStatusWhere it lives
BGMCTS_state Ran
ran on a synthesized input · constructed an object; no result was computed
Sora-Miyamoto/bg-mcts/treesearch/src/treesearch/algos/bg_mcts.py
code served (permissive licence) · get_code("19afe23fd43d683f")
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, BGMCTS_state: 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 dataclasses import dataclass, field
from typing import Dict, Generic, List, Optional, Tuple, TypeVar

# Set seed for reproducibility
torch.manual_seed(0)

NodeStateT = TypeVar('NodeStateT')
StateT = TypeVar('StateT')

# Define a simple state type
@dataclass
class SimpleState:
    value: int
    data: torch.Tensor

# Create a minimal Tree instance
from dataclasses import dataclass as dc, field as dcfield

@dc
class Node(Generic[StateT]):
    state: Optional[StateT] = None
    score: float = -1.0
    scores: list = dcfield(default_factory=list)
    cost: float = 0
    total_cost: float = 0
    output_cost: float = 0
    total_output_cost: float = 0
    input_cost: float = 0
    total_input_cost: float = 0
    prm_output_cost: float = 0
    prm_total_output_cost: float = 0
    prm_input_cost: float = 0
    prm_total_input_cost: float = 0
    expand_idx: int = -1
    parent: Optional['Node[StateT]'] = None
    children: List['Node[StateT]'] = dcfield(default_factory=list)

    def is_root(self) -> bool:
        return self.parent is None

    def get_subtree_nodes(self) -> List['Node[StateT]']:
        nodes: List['Node[StateT]'] = []
        stack: List['Node[StateT]'] = [self]
        while stack:
            current = stack.pop()
            nodes.append(current)
            stack.extend(current.children)
        return nodes

    @property
    def depth(self) -> int:
        depth = 0
        current_node = self
        while current_node.parent is not None:
            current_node = current_node.parent
            depth += 1
        return depth

@dc
class Tree(Generic[StateT]):
    root: Node[StateT]
    size: int

    def __init__(self):
        self.root = Node[StateT]()
        self.size = 1

    def get_nodes(self) -> List[Node[StateT]]:
        nodes = self.root.get_subtree_nodes()
        nodes.sort(key=lambda x: x.expand_idx)
        return nodes

    def get_node(self, expand_idx: int) -> Node[StateT]:
        return self.get_nodes()[expand_idx + 1]

    def add_node(self, state_score_cost: Tuple, parent: Node[StateT]) -> Node[StateT]:
        state, score, scores, cost, total_cost, output_cost, total_output_cost, input_cost, total_input_cost, prm_output_cost, prm_total_output_cost, prm_input_cost, prm_total_input_cost = state_score_cost
        node = Node(state=state, score=score, scores=scores, cost=cost, total_cost=total_cost, output_cost=output_cost, total_output_cost=total_output_cost, input_cost=input_cost, total_input_cost=total_input_cost, prm_output_cost=prm_output_cost, prm_total_output_cost=prm_total_output_cost, prm_input_cost=prm_input_cost, prm_total_input_cost=prm_total_input_cost, parent=parent, expand_idx=self.size - 1)
        parent.children.append(node)
        self.size += 1
        return node

# Create a tree with some nodes
tree = Tree[SimpleState]()

# Add a few nodes to the tree
state1 = SimpleState(value=1, data=torch.randn(2, 4))
parent = tree.root
node1 = tree.add_node(
    (state1, 0.5, [0.5], 1.0, 1.0, 0.2, 0.2, 0.1, 0.1, 0.05, 0.05, 0.03, 0.03),
    parent
)

state2 = SimpleState(value=2, data=torch.randn(2, 4))
node2 = tree.add_node(
    (state2, 0.7, [0.7], 0.8, 1.8, 0.15, 0.35, 0.08, 0.18, 0.04, 0.09, 0.02, 0.05),
    parent
)

# Construct BGMCTS_state arguments
ARGS = {
    "tree": tree,
    "visit_counts": {0: 1, 1: 2, 2: 3},
    "value_sums": {0: 0.5, 1: 1.4, 2: 2.1},
    "priors": {0: 0.3, 1: 0.5, 2: 0.2},
    "next_nodes": [(node1, "expand"), (node2, "backprop")],
    "subtree_node": {0: [1, 2], 1: [3, 4]},
    "depth_node": {0: 2, 1: 3, 2: 4},
    "cost_used": 5.5,
    "ans_depth_list": [1, 2, 3],
    "ans_depth": 2.33,
}
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 BGMCTS_state — 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 BGMCTS_state 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
Node Ran
ran on a synthesized input · constructed an object; no result was computed
Sora-Miyamoto/bg-mcts/treesearch/src/treesearch/algos/bg_mcts.py
code served (permissive licence) · get_code("c75dbc1227c763cf")
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, Node: 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 dataclasses
from typing import Dict, Generic, List, Optional, Tuple, TypeVar

StateT = TypeVar('StateT')

@dataclasses.dataclass
class Node(Generic[StateT]):
    state: Optional[StateT] = None
    score: float = -1.0
    scores: list = dataclasses.field(default_factory=list)
    cost: float = 0
    total_cost: float = 0
    output_cost: float = 0
    total_output_cost: float = 0
    input_cost: float = 0
    total_input_cost: float = 0
    prm_output_cost: float = 0
    prm_total_output_cost: float = 0
    prm_input_cost: float = 0
    prm_total_input_cost: float = 0
    expand_idx: int = -1
    parent: Optional['Node[StateT]'] = None
    children: List['Node[StateT]'] = dataclasses.field(default_factory=list)

    def __post_init__(self) -> None:
        if not self.is_root():
            if not (self.score <= 1.0 and self.score >= 0.0):
                raise RuntimeError(f'The score value should be between 0 and 1, while {self.score} is set.')
            if self.state is None:
                raise RuntimeError('The node state for non-root node should not be None.')

    def get_subtree_nodes(self) -> List['Node[StateT]']:
        """
        Get all the nodes of the subtree starting from self, including self itself.
        """
        nodes: List['Node[StateT]'] = []
        stack: List['Node[StateT]'] = [self]
        while stack:
            current = stack.pop()
            nodes.append(current)
            stack.extend(current.children)
        return nodes

    def is_root(self) -> bool:
        return self.parent is None

    @property
    def depth(self) -> int:
        depth = 0
        current_node = self
        while current_node.parent is not None:
            current_node = current_node.parent
            depth += 1
        return depth


# Create a valid root node (no parent, state can be None for root)
root_node = Node(
    state=None,
    score=-1.0,
    scores=[0.1, 0.2, 0.3],
    cost=0.0,
    total_cost=0.0,
    output_cost=0.0,
    total_output_cost=0.0,
    input_cost=0.0,
    total_input_cost=0.0,
    prm_output_cost=0.0,
    prm_total_output_cost=0.0,
    prm_input_cost=0.0,
    prm_total_input_cost=0.0,
    expand_idx=-1,
    parent=None,
    children=[]
)

# Create a valid child node (has parent, must have valid score between 0-1, must have state)
child_node = Node(
    state="child_state_1",
    score=0.75,
    scores=[0.5, 0.75],
    cost=1.5,
    total_cost=1.5,
    output_cost=0.5,
    total_output_cost=0.5,
    input_cost=1.0,
    total_input_cost=1.0,
    prm_output_cost=0.3,
    prm_total_output_cost=0.3,
    prm_input_cost=0.7,
    prm_total_input_cost=0.7,
    expand_idx=0,
    parent=root_node,
    children=[]
)

# Add child to parent
root_node.children.append(child_node)

ARGS = {
    'state': "example_state",
    'score': 0.85,
    'scores': [0.1, 0.2, 0.85],
    'cost': 2.0,
    'total_cost': 2.0,
    'output_cost': 1.0,
    'total_output_cost': 1.0,
    'input_cost': 1.0,
    'total_input_cost': 1.0,
    'prm_output_cost': 0.6,
    'prm_total_output_cost': 0.6,
    'prm_input_cost': 0.4,
    'prm_total_input_cost': 0.4,
    'expand_idx': 1,
    'parent': root_node,
    'children': []
}
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 Node — 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 Node 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
Tree Ran
ran on a synthesized input · constructed an object; no result was computed
Sora-Miyamoto/bg-mcts/treesearch/src/treesearch/algos/bg_mcts.py
code served (permissive licence) · get_code("a21665ea9499d759")
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, Tree: 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 dataclasses
from typing import Dict, Generic, List, Optional, Tuple, TypeVar

torch = None
numpy = None
scipy = None

NodeStateT = TypeVar('NodeStateT')
StateT = TypeVar('StateT')

StateScoreCostType = Tuple[NodeStateT, float, list, float, float, float, float, float, float, float, float, float, float]
StateScoreType = Tuple[NodeStateT, float]

@dataclasses.dataclass
class Node(Generic[StateT]):
    state: Optional[StateT] = None
    score: float = -1.0
    scores: list = dataclasses.field(default_factory=list)
    cost: float = 0
    total_cost: float = 0
    output_cost: float = 0
    total_output_cost: float = 0
    input_cost: float = 0
    total_input_cost: float = 0
    prm_output_cost: float = 0
    prm_total_output_cost: float = 0
    prm_input_cost: float = 0
    prm_total_input_cost: float = 0
    expand_idx: int = -1
    parent: Optional['Node[StateT]'] = None
    children: List['Node[StateT]'] = dataclasses.field(default_factory=list)

    def __post_init__(self) -> None:
        if not self.is_root():
            if not (self.score <= 1.0 and self.score >= 0.0):
                raise RuntimeError(f'The score value should be between 0 and 1, while {self.score} is set.')
            if self.state is None:
                raise RuntimeError('The node state for non-root node should not be None.')

    def get_subtree_nodes(self) -> List['Node[StateT]']:
        """
        Get all the nodes of the subtree starting from self, including self itself.
        """
        nodes: List['Node[StateT]'] = []
        stack: List['Node[StateT]'] = [self]
        while stack:
            current = stack.pop()
            nodes.append(current)
            stack.extend(current.children)
        return nodes

    def is_root(self) -> bool:
        return self.parent is None

    @property
    def depth(self) -> int:
        depth = 0
        current_node = self
        while current_node.parent is not None:
            current_node = current_node.parent
            depth += 1
        return depth

@dataclasses.dataclass
class Tree(Generic[StateT]):
    """
    Utility data structure for handling tree.
    """
    root: Node[StateT]
    size: int

    def __init__(self):
        self.root = Node[StateT]()
        self.size = 1

    @classmethod
    def with_root_node(cls) -> 'Tree[StateT]':
        """
        Create a new tree with a properly initialized root node.

        The root node follows the convention of having:
        - state: None
        - score: -1.0
        - expand_idx: -1

        Returns:
            A new Tree instance with the root node initialized
        """
        return cls()

    def __len__(self) -> int:
        return self.size

    def get_nodes(self) -> List[Node[StateT]]:
        """
        Returns the node in ascending order of their expand_idx.
        """
        nodes = self.root.get_subtree_nodes()
        nodes.sort(key=lambda x: x.expand_idx)
        return nodes

    def get_node(self, expand_idx: int) -> Node[StateT]:
        """
        Returns the node with the given expand_idx.
        """
        return self.get_nodes()[expand_idx + 1]

    def get_state_score_pairs(self) -> List[StateScoreType[StateT]]:
        return [(node.state, node.score) for node in self.get_nodes() if not node.is_root() and node.state is not None]

    def add_node(self, state_score_cost: StateScoreCostType[StateT], parent: Node[StateT]) -> Node[StateT]:
        state, score, scores, cost, total_cost, output_cost, total_output_cost, input_cost, total_input_cost, prm_output_cost, prm_total_output_cost, prm_input_cost, prm_total_input_cost = state_score_cost
        node = Node(state=state, score=score, scores=scores, cost=cost, total_cost=total_cost, output_cost=output_cost, total_output_cost=total_output_cost, input_cost=input_cost, total_input_cost=total_input_cost, prm_output_cost=prm_output_cost, prm_total_output_cost=prm_total_output_cost, prm_input_cost=prm_input_cost, prm_total_input_cost=prm_total_input_cost, parent=parent, expand_idx=self.size - 1)
        parent.children.append(node)
        self.size += 1
        return node


# Create ARGS dict for Tree initialization
ARGS = {}
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 Tree — 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 Tree 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
softmax Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
Sora-Miyamoto/bg-mcts/treesearch/src/treesearch/algos/bg_mcts.py
code served (permissive licence) · get_code("b36903455b4e0393")
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.

from math import exp, log, sqrt

# The softmax function takes a list of floats and computes softmax probabilities
# It uses: max(values), iteration over values, sum, and division
# No complex objects needed - just a simple list of floats

ARGS = {
    "values": [1.0, 2.0, 3.0, 4.0]
}
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
Algorithm Not yet run
unverified (harvested, no recorded run)
Sora-Miyamoto/bg-mcts/treesearch/src/treesearch/algos/bg_mcts.py
code served (permissive licence) · get_code("f00978caea326175")
How it ran

no invocation recorded.

BGMCTS Not yet run
unverified (harvested, no recorded run)
Sora-Miyamoto/bg-mcts/treesearch/src/treesearch/algos/bg_mcts.py
code served (permissive licence) · get_code("3264d0b68d801bb2")
How it ran

no invocation recorded.

Also present in other papers' code

Of 6 samples lifted from this paper's linked repositories, 6 carry a function identity and 0 do not. Of the 6 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 0 later) and 5 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
softmax
brick of this paper's assembly: helper
1 other paper
1 dated earlier
2503.04412 (2025-03)
Wider or Deeper? Scaling LLM Inference-Time Compute with Adaptive Branching Tree Search

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

Tree-search decoding is an effective form of testtime scaling for large language models (LLMs), but real-world deployment often imposes a fixed per-query token budget that varies across settings. Existing tree-search policies are largely budget-agnostic, treating the budget merely as a termination condition, thereby risking late-stage over-branching or premature termination. We propose Budget-Guided MCTS (BG-MCTS), a treesearch decoding algorithm that aligns its search policy with the remaining token budget: it starts with broad exploration, then prioritizes refinement and answer completion as the remaining budget decreases while reducing late-stage branching from shallow nodes. BG-MCTS consistently outperforms budget-agnostic tree-search baselines across inference budgets on mathematical reasoning benchmarks and an additional physics reasoning benchmark with open-weight LLMs. github.com/Sora-Miyamoto/bg-mcts

For agents

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

get_harvested_code_for_paper("2602.09574")
get_code_for_paper("2602.09574")
have("2602.09574")

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

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

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

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

Connect an agent — have() is free.