Large Language Models Can Self-Improve At Web Agent Tasks

Ajay Patel, Markus Hofmarcher, Claudiu Leoveanu-Condrei, Marius-Constantin Dinu, Chris Callison-Burch, Sepp Hochreiter

Abstract

Training models to act as agents that can effectively navigate and perform actions in a complex environment, such as a web browser, has typically been challenging due to lack of training data. Large language models (LLMs) have recently demonstrated some capability to navigate novel environments as agents in a zero-shot or few-shot fashion, purely guided by natural language instructions as prompts. Recent research has also demonstrated LLMs have the capability to exceed their base performance through self-improvement, i.e. fine-tuning on data generated by the model itself. In this work, we explore the extent to which LLMs can self-improve their performance as agents in long-horizon tasks in a complex environment using the WebArena benchmark. In WebArena, an agent must autonomously navigate and perform actions on web pages to achieve a specified objective. We explore fine-tuning on three distinct synthetic training data mixtures and achieve a 31% improvement in task completion rate over the base model on the WebArena benchmark through a self-improvement procedure. We additionally contribute novel evaluation metrics for assessing the performance, robustness, capabilities, and quality of trajectories of our fine-tuned agent models to a greater degree than simple, aggregate-level benchmark scores currently used to measure self-improvement.

Introduction

Building AI agents capable of autonomous web navigation—executing multi-step tasks such as managing a GitLab repository or booking travel—presents a significant challenge. While Large Language Models (LLMs) excel at instruction following, they often struggle with "long-horizon" tasks requiring extensive sequences of actions. The primary obstacle is the scarcity of high-quality training data; collecting human demonstrations is prohibitively slow and expensive. This work investigates whether LLMs can overcome this bottleneck by training on their own generated trajectories, a process known as self-improvement.

Methodology: The Self-Improvement Pipeline

The proposed pipeline transforms an LLM's raw experiences into a refined training set through two primary steps: trajectory collection/filtering and fine-tuning.

The two-step self-improvement pipeline: (1) collecting and filtering trajectories, and (2) fine-tuning on various data mixtures.

Data Collection and Filtering

The base model (Qwen-1.5-72B-Chat) attempts tasks from the WebArena benchmark. Rather than relying solely on successful completions, the authors introduce the concept of "plausible" trajectories. These are runs where the model does not self-detect a failure and the environment remains stable. This unsupervised filtering strategy significantly improves data quality, increasing the success rate (precision) within the training set from approximately 7.1% to 43.1%.

Synthetic Task Generation

To enhance generalization, the model is prompted to generate Out-of-Domain (OOD) synthetic data. By analyzing its own successful "plausible" examples, the model generates novel tasks and solution plans. This prevents the agent from overfitting to the specific structures of the benchmark websites.

Fine-Tuning Mixtures

The researchers evaluated three training mixtures using QLoRA:

  • Mixture A: In-domain "plausible" trajectories only.
  • Mixture B: A combination of in-domain and out-of-domain synthetic data.
  • Mixture C: Out-of-domain synthetic data only.

Experimental Results

The self-improvement procedure yielded substantial performance gains across multiple metrics. Mixture B emerged as the most effective, achieving a 31% relative improvement in task completion rate over the base model.

Performance comparison of baseline and self-improved agents across Functional Correctness, Capability, and VERTEX-DTW metrics.

Key Performance Metrics

  • Functional Correctness: The task completion rate increased from 7.14% (base) to 9.36% (Mixture B).
  • Capability Score: By grouping the 812 benchmark tasks into 136 distinct skills, the authors found that self-improved models acquired roughly 24% more unique capabilities than the base model (increasing from 15.44 to 19.12).
  • Trajectory Quality (VERTEX-DTW): Using Dynamic Time Warping to compare agent paths against GPT-4 "gold" references, the results indicated that self-improvement generally led to more efficient navigation and fewer invalid actions.

Discussion and Insights

The study reveals several critical insights into the nature of LLM self-improvement:

  1. The "Plausible" Signal: Perfect "gold" data is not a prerequisite for improvement. Filtering out obvious failures provides a sufficiently strong signal for learning better navigation patterns.
  2. Generalization vs. Specialization: The success of Mixture B suggests that while practicing known tasks is beneficial, the diversity provided by synthetic OOD tasks is crucial for preventing overfitting.
  3. Capability Churn: Self-improvement is not strictly monotonic. While models gained new skills, they occasionally lost the ability to perform certain tasks they could previously handle.
  4. Diminishing Returns: Iterative self-improvement (training a model on data generated by a previously self-improved model) showed limited success, suggesting a quality ceiling in self-generated data without external grounding.

Conclusion

This research demonstrates that LLMs can significantly enhance their web-agent capabilities through self-improvement. By filtering for plausible trajectories and generating synthetic out-of-domain tasks, models can achieve substantial gains in functional correctness and capability breadth without human-labeled data. Future work should explore the scalability of this approach to smaller models and incorporate more human-verified trajectories to further validate automated metrics.

Summary updated

BibTeX
@misc{patel2024large,
  author = {Ajay Patel and Markus Hofmarcher and Claudiu Leoveanu-Condrei and Marius-Constantin Dinu and Chris Callison-Burch and Sepp Hochreiter},
  title = {{Large Language Models Can Self-Improve At Web Agent Tasks}},
  year = {2024},
  eprint = {2405.20309},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2405.20309},
}
Figure