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.

Principle:Princeton nlp Tree of thought llm Thought Generation

From Leeroopedia
Knowledge Sources
Domains LLM_Reasoning, Search_Algorithms, NLP
Last Updated 2026-02-14 03:30 GMT

Overview

The mechanism by which an LLM generates candidate next-step thoughts from a partial solution, either by structured proposal or by independent sampling.

Description

Thought Generation is the first phase of each BFS iteration in the Tree of Thoughts framework. Given a partial solution (the current state of reasoning), the LLM produces one or more candidate continuations—intermediate reasoning steps or "thoughts." The framework supports two distinct generation strategies:

  • Propose: The LLM generates multiple possible next steps in a single call using a structured propose prompt. The response is split by newlines into individual candidates. This is suited for tasks where steps are constrained and enumerable (e.g., arithmetic operations in Game of 24).
  • Sample: The LLM generates n independent completions via the n parameter of the API call, each using a standard or chain-of-thought prompt. This is suited for open-ended generation tasks (e.g., creative writing).

Usage

Use the propose strategy when the problem has a well-defined set of possible next actions at each step. Use the sample strategy when the problem is open-ended and diversity of completions is more important than structured enumeration.

Theoretical Basis

Let x be the input and y be the current partial solution. Thought generation produces a set of candidates {z1,...,zk}:

Propose mode:

# Single LLM call returns structured list
prompt = task.propose_prompt_wrap(x, y)
response = llm(prompt, n=1)
candidates = [y + step + '\n' for step in response.split('\n')]

Sample mode:

# Multiple independent completions
prompt = task.standard_prompt_wrap(x, y)  # or cot_prompt_wrap
responses = llm(prompt, n=k)
candidates = [y + response for response in responses]

The choice between propose and sample is task-dependent: propose leverages the LLM's ability to enumerate possible moves within a single context, while sample uses the stochastic nature of LLM decoding to explore diverse continuations.

Related Pages

Implemented By

Page Connections

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