Thought of Search: Planning with Language Models Through The Lens of Efficiency

Michael Katz, Harsha Kokel, Kavitha Srinivas, Shirin Sohrabi

TL;DR

This paper argues that current approaches to planning with Large Language Models (LLMs) sacrifice soundness, completeness, and efficiency for the sake of using LLMs at every step. The authors propose a novel method, "Thought of Search," where LLMs are used to generate the code for search components (like successor functions and goal tests), which are then executed efficiently without further LLM calls. This approach achieves 100% accuracy on several benchmarks with significantly fewer LLM interactions, advocating for a more responsible and efficient use of LLMs in AI planning.

What Problem Does This Paper Address?

The paper tackles a critical issue in the rapidly evolving field of AI planning, specifically concerning the use of Large Language Models (LLMs). While LLMs have shown impressive capabilities in natural language tasks, their application to complex problems like planning has led to a trend where existing methods often abandon fundamental algorithmic properties such as soundness (guaranteeing valid solutions) and completeness (guaranteeing a solution if one exists) in favor of what the authors term "inefficiency." This often manifests as making expensive LLM calls for every step of the planning process, leading to prohibitive computational costs, environmental impact, and a lack of guaranteed correctness. The authors aim to bridge this gap by demonstrating a way to leverage LLMs for planning that upholds these crucial properties while drastically improving efficiency.

Methods

The core of the proposed method, "Thought of Search," lies in a paradigm shift: instead of using LLMs during the search process for every decision, the authors propose using LLMs to generate the code for the search components themselves. Specifically, they focus on generating Python implementations for two key components:

  • Successor Generator: This function defines how to transition from one state to the next.
  • Goal Test: This function determines if a given state satisfies the desired goal.

The LLM is prompted with a textual description of the planning problem and asked to produce Python code for these components. This generated code is then used by standard, efficient search algorithms (like Breadth-First Search or Depth-First Search) to solve the planning problem. The authors emphasize that this approach allows for the search algorithm's inherent soundness and completeness guarantees to be maintained, as the LLM's role is limited to code generation and validation, not runtime decision-making.

Datasets

The paper evaluates their proposed approach on four representative search problems:

  • 24 Game: A mathematical puzzle where the goal is to reach 24 using four integers and basic arithmetic operations.
  • Mini Crosswords: A 5x5 crossword puzzle dataset.
  • Blocks World: A classic AI planning domain involving manipulating blocks to achieve a goal configuration.
  • ProntoQA: A dataset for logical reasoning and question answering.

The authors do not introduce new datasets but rather use existing benchmarks from prior work in LLM-based planning to demonstrate the effectiveness of their approach in comparison.

Key Insights and Ideas

  • LLMs as Code Generators, Not Planners: The most significant insight is the reframing of LLMs' role in planning. Instead of treating them as black-box planners that make decisions at each step, the paper positions them as powerful tools for generating reliable, executable code for planning components.
  • Efficiency Through Separation: By separating the LLM's code generation task from the actual search execution, the authors achieve substantial efficiency gains. The computationally expensive LLM is called only a few times to generate the code, while the subsequent search is performed by efficient, traditional algorithms.
  • Restoring Soundness and Completeness: The paper highlights how current LLM-based planning methods often compromise soundness and completeness. Their approach, by generating verifiable code, allows these fundamental properties to be preserved.
  • Responsible AI Use: The authors advocate for a more responsible use of computational resources, arguing that inefficient LLM usage is not only costly but also environmentally detrimental.

Key Results

The paper demonstrates the effectiveness of their "Thought of Search" approach across several benchmarks:

  • 100% Accuracy: On all four tested datasets (24 Game, Mini Crosswords, Blocks World, ProntoQA), their method achieved 100% accuracy in solving the problems.
  • Significantly Fewer LLM Calls: Compared to existing LLM-based planning methods that might make hundreds or thousands of LLM calls per problem, their approach requires only a few calls to generate the necessary code. For instance, in the 24 Game, they achieved 100% accuracy with an average of 1.2 interactions for the successor function and 1 for the goal test, whereas a prior method reported ~100 calls for a 75% success rate.
  • Efficiency Gains: The total time to solve problems was significantly reduced, often comparable to a single LLM evaluation, showcasing the efficiency of executing generated Python code.

Limitations and Future Work

  • Human Feedback for Code Validation: Currently, the proposed approach assumes that the generated code is validated by a human capable of understanding and checking it. Automating this validation process is a key area for future work.
  • Search Guidance and Pruning: The authors suggest exploring the use of LLMs to generate code for search guidance or pruning techniques, further enhancing the efficiency of the search process.
  • Heuristic Function Generation: While the paper focuses on successor functions and goal tests, future work could extend to LLM-generated heuristic functions for more complex search problems.

Summary updated

Abstract

Among the most important properties of algorithms investigated in computer science are soundness, completeness, and complexity. These properties, however, are rarely analyzed for the vast collection of recently proposed methods for planning with large language models. In this work, we alleviate this gap. We analyse these properties of using LLMs for planning and highlight that recent trends abandon both soundness and completeness for the sake of inefficiency. We propose a significantly more efficient approach that can, at the same time, maintain both soundness and completeness. We exemplify on four representative search problems, comparing to the LLM-based solutions from the literature that attempt to solve these problems. We show that by using LLMs to produce the code for the search components we can solve the entire datasets with 100% accuracy with only a few calls to the LLM. We argue for a responsible use of compute resources; urging research community to investigate sound and complete LLM-based approaches that uphold efficiency.
BibTeX
@inproceedings{katz2024thought,
  author = {Michael Katz and Harsha Kokel and Kavitha Srinivas and Shirin Sohrabi},
  title = {{Thought of Search: Planning with Language Models Through The Lens of Efficiency}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=lNCsyA5uS1},
}
Figure