Empowering Large Language Model Agents through Action Learning

Haiteng Zhao, Chang Ma, Guoyin Wang, Jing Su, Lingpeng Kong, Jingjing Xu, Zhi-Hong Deng, Hongxia Yang

TL;DR

Current Large Language Model (LLM) agents are often hamstrung by fixed, predefined action spaces that don't evolve with experience. LearnAct is a new framework that allows agents to autonomously expand their capabilities by creating and iteratively refining new actions as Python functions, leading to a 32% performance boost in complex environments like AlfWorld.

What Problem Does This Paper Address?

While LLMs are excellent at high-level reasoning and planning, they often struggle when interacting with specific environments. Most existing agent frameworks (like ReAct or Reflexion) operate within a fixed action space—a set of basic commands that never changes. This creates a "bottleneck": the agent might have a brilliant plan but lacks the sophisticated "skills" (composite actions) to execute it reliably.

Humans don't just think better to solve harder problems; we develop new skills and tools. The authors argue that for LLM agents to become truly intelligent, they need the ability to learn from trial and error to expand their own action sets. Without this, agents frequently run into execution errors due to unmet prerequisites or ineffective strategies that high-level reasoning alone can't fix.

Methods

The authors introduce LearnAct, a framework that treats the action space as an open, learnable set. Instead of just natural language commands, LearnAct defines actions as Python functions. This allows the agent to use programming constructs like loops, conditionals (if-else), and error handling (try-except) to create robust skills.

The LearnAct pipeline consists of two main stages:

  1. Action Creation: Given a task description, the LLM generates a set of high-level Python functions (APIs) that wrap around basic environment actions.
  2. Iterative Learning (The Feedback Loop): This is the core innovation. The agent attempts training tasks using its new actions. When it fails, an "Action Learner" analyzes the error logs and chooses one of two paths to improve:
  3. Function Updating: The LLM rewrites the Python code to fix logic errors (e.g., adding a check to see if a cabinet is open before trying to grab an item).
  4. Note Writing: The LLM adds a "usage note" to the action's documentation to help the agent avoid future misuse (e.g., "Note: this action only works on clean containers").
Figure 1: Illustration of the training and test stage of LearnAct: Left: During the training stage, LearnAct expands the action space by first creating actions and then optimizing them based on the execution feedback. Right: The test stage uses learned action space to facilitate sequential decision-making. The prompting format follows the Act (Yao et al., 2023a) agent.

To ensure stability, LearnAct uses a sampling strategy: it generates multiple versions of a refined action and selects the one that performs best on training instances based on success rate and execution efficiency.

Datasets

The researchers evaluated LearnAct on two challenging benchmarks:

  • Robotic Planning: Four tasks (Gripper, Blockworld, Barman, and Tyreworld) that require long-horizon planning, such as moving objects between rooms or preparing complex cocktail orders.
  • AlfWorld: A synthetic household environment where agents must explore rooms to find, clean, heat, or place objects. This environment is particularly difficult because the full state is not visible to the agent at once.

Key Insights and Ideas

  • Action Learning vs. Policy Learning: Most prior work (like Reflexion) focuses on "verbal policy learning"—giving the agent text-based hints about what to do next. LearnAct shows that learning within the action space (improving the tools themselves) is significantly more effective for grounding the agent in the environment.
  • The Power of Code: By using Python functions, the agent can encapsulate complex logic that is difficult to express in simple command strings. For example, a carry_to function can handle the sub-steps of picking up, moving, and dropping an object, including handling potential failures at each step.
  • Preference for Code Fixes: Interestingly, the authors found that the LLM chose to update the function code 90% of the time rather than just writing a note. This suggests that fixing the underlying logic is a more natural and powerful way for the model to resolve execution errors.
Figure 2: Left: During the learning stage, action usage by agent and action optimization are repeatedly executed. The improved action is evaluated on the training instances, identifying the failed case for the subsequent learning step. Actions are improved through either updat- ing the functions or writing notes. Multiple samples are produced during the learning, and upon evaluation against training instances, the optimal one is selected for the next iteration. Right: Case example of action updating and note writing. The action update addresses previous shortcomings by refining functions for improved issue resolution. Conversely, note writing advises agents on proper action usage. LLMs have the freedom to select from two learning options.

Key Results

LearnAct demonstrated substantial improvements over state-of-the-art baselines:

  • AlfWorld: LearnAct improved performance by 32% compared to the ReAct+Reflexion baseline when using GPT-4.
  • Robotic Planning: On the average of four tasks, LearnAct achieved an 82.8% success rate, outperforming the basic Act agent (60.7%) and even Voyager (72.1%), which also uses code-based actions but lacks LearnAct's iterative refinement loop.
  • Transferability: A crucial finding was that LearnAct could learn general skills from just three training instances and successfully apply them to a wide variety of unseen test cases.

Limitations and Future Work

  • Overfitting: The authors noted that "prolonged learning" (too many iterations) can actually hurt performance. The agent may start to over-optimize for specific quirks of the training cases, leading to a misunderstanding of the general task rules.
  • Computational Cost: The iterative nature of the framework requires multiple passes of training and evaluation, which can be expensive in terms of LLM API calls and time.
  • Future Directions: The authors suggest exploring ways to prevent overfitting and scaling the framework to even more diverse and open-ended environments where the "correct" action space isn't known beforehand.

Summary updated

BibTeX
@inproceedings{zhao2024empowering,
  author = {Haiteng Zhao and Chang Ma and Guoyin Wang and Jing Su and Lingpeng Kong and Jingjing Xu and Zhi-Hong Deng and Hongxia Yang},
  title = {{Empowering Large Language Model Agents through Action Learning}},
  booktitle = {COLM},
  year = {2024},
  url = {https://openreview.net/forum?id=KqK5XcgEhR},
}
Figure