Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Heuristic:Iamhankai Forest of Thought Early Stop Majority Vote

From Leeroopedia
Knowledge Sources
Domains Optimization, LLMs, Ensemble
Last Updated 2026-02-14 03:30 GMT

Overview

Resource-saving early termination strategy that stops forest evaluation when any answer achieves a strict majority (more than half) of tree votes.

Description

The Forest-of-Thought framework runs multiple reasoning trees in sequence. After each tree completes (starting from tree index 1), the system checks whether any extracted answer has received a strict majority — i.e., its count exceeds `tree_nums / 2`. If so, the forest evaluation terminates immediately using that answer, skipping all remaining trees.

This is a consensus-guided optimization: when enough independent reasoning paths converge on the same answer, additional trees are unlikely to change the outcome, so the computation can be safely terminated early.

Usage

This heuristic is automatically applied in all three base modes (MCTS, CoT, ToT) within the Monte_Carlo_Forest orchestrator. It activates after the second tree (index >= 1) completes. The stopping condition is `max_count > self.tree_nums / 2` — a strict majority, not a plurality. For a 5-tree forest, this means 3+ trees must agree; for a 2-tree forest, both must agree.

The Insight (Rule of Thumb)

  • Action: After each tree completes, count answer frequencies using `Counter`. If any answer's count exceeds `tree_nums / 2`, stop immediately and use that answer.
  • Value: Threshold is `tree_nums / 2` (strict majority). For `tree_nums=5`, threshold is 2.5 (need 3+).
  • Trade-off: Saves computation by skipping remaining trees when consensus is reached. Risk: early trees may converge on the same wrong answer. Mitigated by the progressive iteration scaling (first tree is quick, later trees are deeper).
  • Fallback: If no majority is reached after all trees, falls back to the CGDM strategy (majority vote + LLM judge).

Reasoning

In multi-tree ensemble reasoning, answer diversity decreases as more trees agree. Once a strict majority is reached, the probability that remaining trees will overturn the consensus is low, especially given that each tree uses different reasoning strategies (input diversity via shuffling, progressive iteration depth). The strict majority threshold (> N/2, not >= N/2) ensures a genuine consensus rather than a tie.

The Chinese code comments explicitly note this optimization: `self.fot_early_stop_signal = True # 节省资源` ("save resources"), confirming the intent is computational efficiency.

Code Evidence

Early stop check in MCTS mode from `run_with_mcf_stop_noearly.py:L371-381`:

if t >= 1:
    fot_ans_lst = [x for tree_id, x in enumerate(self.trees_ans)
                   if x is not None and self.activate_signal[tree_id]]
    try:
        counter = Counter(fot_ans_lst)
        max_count = max(counter.values())
        if max_count > self.tree_nums / 2:
            self.fot_early_stop_signal = True
            fot_ans = max(counter, key=counter.get)
            break
    except:
        pass

Same pattern repeated in ToT mode (`run_with_mcf_stop_noearly.py:L443-453`) and CoT mode (`run_with_mcf_stop_noearly.py:L513-523`).

Fallback when no early stop from `run_with_mcf_stop_noearly.py:L383-384`:

if not self.fot_early_stop_signal:
    fot_ans = self.get_fot_final_answer(query, self.trees_ans, ...)

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment