AgentGym: Evolving Large Language Model-based Agents across Diverse Environments

Zhiheng Xi, Yiwen Ding, Wenxiang Chen, Boyang Hong, Honglin Guo, Junzhe Wang, Dingwen Yang, Chenyang Liao, Xin Guo, Wei He, Songyang Gao, Lu Chen, Rui Zheng, Yicheng Zou, Tao Gui, Qi Zhang, Xipeng Qiu, Xuanjing Huang, Zuxuan Wu, Yu-Gang JiangarXiv 2024 · DOI

TL;DR

This paper introduces AgentGym, a novel framework designed to train and evolve Large Language Model (LLM)-based agents across a diverse range of environments and tasks. By combining a rich set of interactive environments, a curated dataset of expert trajectories, and a new self-evolution method called AgentEvol, the authors demonstrate that LLM agents can achieve generalist capabilities and surpass state-of-the-art models through continuous learning and adaptation.

What Problem Does This Paper Address?

The AI community has long strived to build "generalist agents" – AI systems capable of handling a wide variety of tasks and adapting to new situations, much like humans. Large Language Models (LLMs) show promise for this due to their broad understanding of language and knowledge. However, current approaches to training LLM agents face limitations:

  • Imitation-based methods (Behavioral Cloning): These methods rely on agents mimicking expert-provided examples. While effective, they require significant human supervision, are difficult to scale, and limit the agent's ability to explore novel solutions or environments.
  • Isolated learning: Agents trained in single, isolated environments tend to become "specialists," excelling at a narrow set of tasks but failing to generalize to new ones.

The core challenge is to enable LLM agents to learn and evolve across diverse environments and tasks, developing a more robust and generalizable intelligence without constant human intervention.

Methods

The paper proposes a three-pronged approach to tackle this challenge:

  1. Diverse Environments: A rich collection of environments is crucial for agents to explore and learn broadly.
  2. Trajectory Set: A curated set of expert trajectories provides a foundational understanding and basic capabilities, bootstrapping the learning process.
  3. Scalable Evolution Method: An effective mechanism is needed for agents to adapt and improve over time.

To implement this, the authors introduce:

  • AgentGym Framework: This is a comprehensive platform that includes:
  • Interactive Platform: A unified interface for 14 diverse environments and 89 tasks, supporting real-time interaction, data collection, and concurrent agent exploration.
  • AGENTTRAJ & AGENTTRAJ-L: Datasets of high-quality, expert-annotated trajectories for training base agents and establishing performance benchmarks.
  • AGENTEVAL: A benchmark suite for evaluating LLM-based agents across various tasks.
  • AgentEvol Algorithm: This novel method enables LLM agents to self-evolve. It operates in two steps:
  • Exploration Step: The agent interacts with a wider range of instructions and environments, gathering new experiences.
  • Learning Step: The agent uses these experiences, weighted by their success, to update its policy and improve its performance. This process is inspired by reinforcement learning and probabilistic inference, aiming to optimize the agent's policy towards achieving higher rewards.

Datasets

The paper introduces and utilizes several key datasets:

  • AGENTTRAJ: A curated set of high-quality, expert-annotated trajectories used to train a base, generally-capable LLM agent.
  • AGENTTRAJ-L: A larger trajectory set used to establish the upper performance bound achievable through behavioral cloning.
  • AGENTEVAL: A benchmark suite comprising a diverse and challenging subset of instructions from various environments, designed for comprehensive evaluation of LLM-based agents.

The paper also leverages existing datasets from various environments like WebShop, WebArena, ALFWorld, and others, expanding them through crowdsourcing and AI-based methods like self-instruct.

Key Insights and Ideas

  • The "Trinity" of Generalist Agents: The authors identify that building generalist agents requires a combination of diverse environments for exploration, a foundational knowledge base (trajectories), and an effective evolution mechanism.
  • Self-Evolution is Key: Simply imitating experts or learning in isolation is insufficient. Agents need to actively explore, learn from feedback, and adapt to new challenges to become truly generalist.
  • Bridging Imitation and Exploration: AgentEvol effectively combines the benefits of initial imitation learning (providing a strong starting point) with continuous exploration and learning, leading to more robust agents.
  • Scalability of Evolution: The proposed AgentEvol method is designed to be scalable, allowing agents to evolve across multiple environments and tasks without prohibitive computational costs.
  • LLMs as a Foundation: The work reinforces the idea that LLMs are a powerful foundation for building intelligent agents, capable of complex reasoning and interaction when properly trained and evolved.

Key Results

  • AgentGym Framework: The framework successfully integrates 14 diverse environments and 89 tasks, providing a unified platform for agent development and evaluation.
  • AgentEvol Performance: The AGENTEVOL method demonstrates significant improvements, with evolved agents achieving performance comparable to or even surpassing state-of-the-art (SOTA) models on many tasks.
  • Generalization: The evolved agents show improved generalization capabilities, performing well on tasks and instructions they haven't explicitly seen during the initial training phase.
  • Efficiency: The evolved agents often achieve better performance with fewer interactive rounds, indicating increased efficiency.
  • Model Agnosticism: The AgentEvol method shows effectiveness across different LLM backbone models, suggesting its general applicability.

Limitations and Future Work

  • Computational Efficiency: While the framework is designed for scalability, the authors acknowledge that for computational efficiency, they did not perform multiple samplings in each iteration. Future work aims to increase sampling to explore the upper limits of the method.
  • Model Size: The current validation was performed on models up to 70B parameters. Future work aims to verify the effectiveness on even larger and stronger base models.
  • Safety and Ethics: The authors recognize the importance of safety and ethical considerations when agents self-evolve. Future work will focus on improving the framework's functionality to align agents with human values and strengthen supervision.
  • Exploration Scope: Ablation studies suggest that a more extensive environment is needed for effective evolution, and future work will explore this further.
  • Failed Trajectories: While the current method primarily uses successful trajectories, future work will explore how to effectively utilize failed trajectories for even better evolution.

Summary updated

BibTeX
@misc{xi2024agentgym,
  author = {Zhiheng Xi and Yiwen Ding and Wenxiang Chen and Boyang Hong and Honglin Guo and Junzhe Wang and Dingwen Yang and Chenyang Liao and Xin Guo and Wei He and Songyang Gao and Lu Chen and Rui Zheng and Yicheng Zou and Tao Gui and Qi Zhang and Xipeng Qiu and Xuanjing Huang and Zuxuan Wu and Yu-Gang Jiang},
  title = {{AgentGym: Evolving Large Language Model-based Agents across Diverse Environments}},
  year = {2024},
  eprint = {2406.04151},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2406.04151},
}
Figure