StrategyLLM: Large Language Models as Strategy Generators, Executors, Optimizers, and Evaluators for Problem Solving

Chang Gao, Haiyun Jiang, Deng Cai, Shuming Shi, Wai Lam · OpenReview

Abstract

Most existing prompting methods suffer from the issues of generalizability and consistency, as they often rely on instance-specific solutions that may not be applicable to other instances and lack task-level consistency across the selected few-shot examples. To address these limitations, we propose a comprehensive framework, StrategyLLM, allowing LLMs to perform inductive reasoning, deriving general strategies from specific task instances, and deductive reasoning, applying these general strategies to particular task examples, for constructing generalizable and consistent few-shot prompts. It employs four LLM-based agents: strategy generator, executor, optimizer, and evaluator, working together to generate, evaluate, and select promising strategies for a given task. Experimental results demonstrate that StrategyLLM outperforms the competitive baseline CoT-SC that requires human-annotated solutions on 13 datasets across 4 challenging tasks without human involvement, including math reasoning (34.2% → 38.8%), commonsense reasoning (70.3% → 72.5%), algorithmic reasoning (73.7% → 85.0%), and symbolic reasoning (30.0% → 79.2%). Further analysis reveals that StrategyLLM is applicable to various LLMs and demonstrates advantages across numerous scenarios.

Introduction

Chain-of-Thought (CoT) prompting has significantly advanced the reasoning capabilities of Large Language Models (LLMs). However, standard CoT approaches often fall into the trap of "instance-specific" reasoning. By providing examples of specific solutions to specific problems, models may fail to generalize when the complexity or parameters of the task change. This "Generalizability Gap" is particularly evident in symbolic and mathematical reasoning, where a solution for a simple case does not inherently teach the model the underlying rule for complex cases.

Furthermore, few-shot prompts often suffer from inconsistency. Different examples in a prompt might use varying methods to solve similar problems, providing a noisy signal to the model. StrategyLLM addresses these issues by shifting the focus from specific steps to systematic strategies, mimicking the human process of induction (learning a rule) and deduction (applying it).

The StrategyLLM Framework

StrategyLLM is a multi-agent collaboration framework designed to automate the creation of high-quality, strategy-based prompts. It consists of four specialized agents that manage the lifecycle of a strategy:

  1. Strategy Generator: This agent analyzes the task definition and a set of examples to induce a pool of general, high-level strategies. Instead of specific arithmetic, it produces procedural rules (e.g., "Identify the given information," "Determine the mathematical operation").
  2. Strategy Executor: To validate these strategies, the Executor applies them to specific task examples. It generates step-by-step solutions based on the strategy's subtasks and calculates an "execution accuracy."
  3. Strategy Optimizer: When a strategy fails to produce the correct answer, the Optimizer analyzes the failure and iteratively refines the strategy to improve its robustness and clarity.
  4. Strategy Evaluator: Finally, the Evaluator ranks the refined strategies based on their performance on a validation set, selecting the top-performing "playbooks" for the final prompt.
The StrategyLLM framework architecture, illustrating the flow from strategy generation to optimization and evaluation.

Strategy-Based Prompting

The output of this framework is a "Strategy-based Prompt." Unlike standard CoT, which moves directly from a question to a solution, a strategy-based prompt explicitly states the general strategy before providing examples of that strategy being executed. This structure ensures task-level consistency across all few-shot examples, providing the model with a clear, unified reasoning path.

Comparison of Standard, CoT, and Strategy-based prompting formats, highlighting the inclusion of a general strategy in the latter.

Experimental Evaluation

The framework was rigorously tested on 13 datasets across four domains: Math Reasoning (MATH benchmark), Commonsense Reasoning (StrategyQA, Date Understanding), Algorithmic Reasoning (Word Sorting, Multi-step Arithmetic), and Symbolic Reasoning (Last Letter Concatenation).

Key Results

StrategyLLM consistently outperformed the CoT-Self-Consistency (CoT-SC) baseline, which typically requires human-annotated solutions. Notable improvements include:

  • Symbolic Reasoning: Accuracy surged from 30.0% to 79.2%. This was particularly evident in out-of-distribution (OOD) tests where the model had to handle sequences much longer than those in the few-shot examples.
  • Algorithmic Reasoning: Performance increased from 73.7% to 85.0%.
  • Math Reasoning: Average accuracy improved from 34.2% to 38.8%.

Discussion and Insights

The success of StrategyLLM stems from its ability to enforce Task-Level Consistency. By using the same high-level strategy for every example in a prompt, the model receives a much stronger signal on the required logic.

Moreover, the framework is highly cost-effective. Since strategies are generated once per task rather than per instance, the overhead is minimal. High-performing prompts were developed for less than $0.24 using models like GPT-3.5-Turbo. The approach is also model-agnostic, showing gains across GPT-4, Claude-3, Llama-3, and Mixtral.

Conclusion

StrategyLLM represents a shift from teaching models what to think (specific steps) to how to think (general strategies). By automating the induction of general rules and their deductive application, the framework provides a scalable, consistent, and highly effective method for solving complex reasoning tasks without human intervention in prompt engineering.

Summary updated

BibTeX
@inproceedings{gao2024strategyllm,
  author = {Chang Gao and Haiyun Jiang and Deng Cai and Shuming Shi and Wai Lam},
  title = {{StrategyLLM: Large Language Models as Strategy Generators, Executors, Optimizers, and Evaluators for Problem Solving}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=UkxJd64mki},
}
Figure