Introduction
Large Language Models (LLMs) have demonstrated remarkable capabilities across various linguistic tasks. However, complex planning and combinatorial search remain significant hurdles. In domains like Sokoban or the "24 Game," LLMs frequently "hallucinate" illegal moves or lose track of the internal state, leading to failure in structured reasoning.
To address these limitations, the Thought of Search (ToS) framework was introduced. Instead of asking an LLM to generate a plan directly, ToS prompts the model to generate symbolic Python code representing the search space—specifically a successor function (succ) and a goal test (isgoal). This code is then executed by a traditional, deterministic search algorithm like Breadth-First Search (BFS). While ToS achieved 100% accuracy, it relied on a human expert to iteratively debug and refine the LLM-generated code.
The recent work on Automating Thought of Search (AutoToS) removes this human bottleneck. By integrating automated software testing principles and iterative feedback loops, AutoToS enables LLMs to autonomously converge on sound and complete search models.
The AutoToS Framework
AutoToS replaces the human evaluator with an automated pipeline that uses unit tests to guide the LLM. The framework operates through a four-step iterative process designed to ensure both the correctness of the goal state definition and the reliability of the state transitions.
1. Initial Prompting
The process begins by providing the LLM with a natural language description of the problem domain. The model is tasked with generating the initial Python implementations for succ(s) and isgoal(s).
2. Goal Function Correctness
The generated isgoal function is validated against a small, predefined set of known goal and non-goal states. If the function fails to correctly identify a state, the specific failing case is fed back to the LLM. Using a "Chain of Thought" prompting style, the model is asked to reason through the failure and revise the code.
3. Successor Soundness Testing
This stage ensures that the succ function only produces legal moves. AutoToS executes the search and uses "wrappers" to monitor the code's behavior. These wrappers catch common errors such as infinite loops (via timeouts), state mutation bugs, or domain-specific violations (e.g., ensuring a move in the 24 Game reduces the count of numbers). If a violation is detected, the LLM receives feedback to fix the soundness of its logic.
4. Successor Completeness Testing
If the model is sound but the search algorithm fails to find a solution, the framework performs a completeness check. It compares the LLM's generated transitions against known valid transitions. If moves are missing, the LLM is prompted to expand its logic to include all possible valid successors.
Experimental Evaluation
The authors evaluated AutoToS across five diverse domains: the 24 Game, BlocksWorld, Mini Crossword, PrOntoQA, and Sokoban. These tasks range from simple arithmetic to PSPACE-complete puzzles.
Key Results and Insights
The experiments yielded several critical insights:
- 100% Accuracy: AutoToS achieved perfect scores across all tested domains, matching the performance of human-in-the-loop ToS.
- The Accuracy "Climb": Performance typically starts low with the initial zero-shot prompt but increases significantly as soundness and completeness checks are applied.
- Soundness is Paramount: The researchers observed that search algorithms are highly sensitive to soundness. Even a slightly unsound model (allowing one illegal move) can lead to a total failure, whereas a slightly incomplete model might still find a solution, albeit a sub-optimal one.
- Model Agnostic Success: The framework proved effective across various models, including GPT-4o, Llama 3.1, and DeepSeek-CoderV2. This suggests that the iterative feedback mechanism is a robust strategy for overcoming the inherent unreliability of LLMs.
Conclusion and Future Directions
AutoToS demonstrates that LLMs can be effectively used for complex planning when paired with automated symbolic verification. By shifting the LLM's role from "planner" to "code generator" and providing a rigorous feedback loop, the framework achieves human-level debugging performance.
Future work may focus on automating the creation of the initial unit tests, which currently require human authorship. Additionally, extending AutoToS to non-deterministic or partially observable environments remains a promising frontier for autonomous planning research.
Summary updated