REX: Rapid Exploration and eXploitation for AI Agents

Rithesh Murthy, Shelby Heinecke, Juan Carlos Niebles, Zhiwei Liu, Le Xue, Weiran Yao, Yihao Feng, Zeyuan Chen, Akash Gokul, Devansh Arpit, Ran Xu, Phil Mui, Huan Wang, Caiming Xiong, Silvio Savarese

TL;DR

This paper introduces REX, a novel approach for AI agents that significantly improves their ability to explore and exploit action spaces, leading to more robust and efficient task completion. By integrating Upper Confidence Bound (UCB) scores into the decision-making process, REX enhances performance and drastically reduces execution time compared to existing methods, making AI agents more practical for real-world applications.

What Problem Does This Paper Address?

Modern AI agents, often powered by Large Language Models (LLMs), have shown impressive capabilities in executing tasks. However, a critical challenge remains in how these agents effectively explore the vast space of possible actions to find optimal solutions. Existing methods, like those based on Chain-of-Thought (CoT), often rely on very precise instructions and lack a systematic way to learn from trial-and-error, similar to traditional Reinforcement Learning (RL). This can lead to inefficiencies, slow learning, and difficulties in adapting to new or slightly modified tasks. The paper aims to bridge this gap by providing a more systematic and efficient exploration-exploitation mechanism for LLM-based agents.

Methods

The core of REX lies in its enhanced exploration and exploitation strategy, inspired by Monte Carlo Tree Search (MCTS) and Upper Confidence Bound (UCB) algorithms. Instead of a purely sequential, step-by-step approach, REX compresses the MCTS steps (Selection, Expansion, Simulation, Backpropagation) into a more efficient process.

Two main variants are proposed:

  • REX-UCB: This version integrates UCB scores directly into the prompt. After an action sequence is evaluated, rewards are assigned. These rewards, along with visit counts, are used to calculate UCB scores for each action. These scores are then mapped to "HIGH" or "LOW" and fed back into the LLM prompt to guide future action selection, promoting a balance between exploring new actions and exploiting known good ones.
  • REX-UCL: This variant takes REX-UCB a step further by directly manipulating the LLM's token logits. Instead of just providing UCB scores as feedback, REX-UCL uses these scores to adjust the likelihood of generating specific tokens associated with actions. This provides a more direct influence on the LLM's decision-making, aiming to consistently steer it towards higher-reward actions.

Both REX variants aim to avoid extensive model fine-tuning and can leverage offline logs.

Datasets

The paper evaluates REX on two benchmark datasets:

  • Blocksworld: A planning problem involving arranging blocks with different colors. It's divided into subcategories based on the number of steps required (2, 4, or 6 steps).
  • GSM8K: A dataset of grade-school math word problems, requiring a sequence of arithmetic operations to solve.

Key Insights and Ideas

  • UCB for LLM Exploration: Applying UCB scores, a well-established RL concept, to LLM-based agents provides a principled way to balance exploring novel actions and exploiting those that have yielded good results. This is more systematic than relying solely on explicit prompt instructions.
  • Efficiency through Compression: By compressing MCTS steps and allowing for more holistic solution prediction, REX significantly reduces the computational overhead and time complexity compared to traditional MCTS or step-by-step LLM reasoning.
  • Logit Manipulation for Finer Control: REX-UCL's approach of directly adjusting LLM logits offers a more granular control over action generation, potentially leading to more precise and efficient decision-making than simply providing feedback in the prompt.
  • No Fine-Tuning Required: A major advantage is that REX can be applied to existing foundation models without the need for costly and time-consuming fine-tuning, making it highly practical.

Key Results

  • Comparable to State-of-the-Art: REX-based methods demonstrate comparable, and in some cases superior, performance to existing techniques like CoT and Reflexion on the Blocksworld and GSM8K datasets.
  • Significant Speedup: REX exhibits remarkable reductions in execution time. For instance, Table 1 shows that REX-UCB and REX-UCL have a time complexity of 'n' (where 'n' is the number of passes), which is significantly better than methods like RAP (nmd) or Reflexion (+CoT) which are not explicitly quantified but implied to be slower.
  • Improved Exploration: Table 2 shows that REX-UCB, compared to REX-R, explores a significantly higher average number of unique actions per intermediate step, indicating its effectiveness in discovering diverse solution paths.
  • REX-UCL Solves Difficult Tasks: In a specific Blocksworld example (Figure 6), REX-R failed to solve the task within 10 passes, while REX-UCL successfully solved it by the 7th pass, highlighting the benefit of its more direct control mechanism.

Limitations and Future Work

  • Context Length Dependency: The paper acknowledges that REX's efficacy is tethered to the context length of the LLM, as it relies on In-Context Learning (ICL).
  • Prompt Engineering: Effective utilization of REX requires skillful reconfiguration of prompts, tailored to specific task domains.
  • Hyperparameter Tuning: Parameters like C (in UCB), B, and K (in UCL) require domain-specific adjustments.
  • Future Work: The authors suggest exploring further into context length limitations, intricacies of in-context learning, and generalization capabilities. They also note that harnessing REX-UCL requires nuanced manipulation of LLM logit values.

Summary updated

Abstract

In this paper, we propose an enhanced approach for Rapid Exploration and eXploitation for AI Agents called REX. Existing AutoGPT-style techniques have inherent limitations, such as a heavy reliance on precise descriptions for decision-making, and the lack of a systematic approach to leverage try-and-fail procedures akin to traditional Reinforcement Learning (RL). REX introduces an additional layer of rewards and integrates concepts similar to Upper Confidence Bound (UCB) scores, leading to more robust and efficient AI agent performance. This approach has the advantage of enabling the utilization of offline behaviors from logs and allowing seamless integration with existing foundation models while it does not require any model fine-tuning. Through comparative analysis with existing methods such as Chain-of-Thoughts(CoT) and Reasoning viA Planning(RAP), REX-based methods demonstrate comparable performance and, in certain cases, even surpass the results achieved by these existing techniques. Notably, REX-based methods exhibit remarkable reductions in execution time, enhancing their practical applicability across a diverse set of scenarios.
BibTeX
@misc{murthy2023rex,
  author = {Rithesh Murthy and Shelby Heinecke and Juan Carlos Niebles and Zhiwei Liu and Le Xue and Weiran Yao and Yihao Feng and Zeyuan Chen and Akash Gokul and Devansh Arpit and Ran Xu and Phil Mui and Huan Wang and Caiming Xiong and Silvio Savarese},
  title = {{REX: Rapid Exploration and eXploitation for AI Agents}},
  year = {2023},
  eprint = {2307.08962},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2307.08962},
}
Figure