MLAgentBench: Evaluating Language Agents on Machine Learning Experimentation

Qian Huang, Jian Vora, Percy Liang, Jure Leskovec · DOI

Abstract

A central aspect of machine learning research is experimentation, the process of designing and running experiments, analyzing the results, and iterating towards some positive outcome (e.g., improving accuracy). Could agents driven by powerful language models perform machine learning experimentation effectively? To answer this question, we introduce MLAgentBench, a suite of 13 tasks ranging from improving model performance on CIFAR-10 to recent research problems like BabyLM. For each task, an agent can perform actions like reading/writing files, executing code, and inspecting outputs. We then construct an agent that can perform ML experimentation based on ReAct framework. We benchmark agents based on Claude v1.0, Claude v2.1, Claude v3 Opus, GPT-4, GPT-4-turbo, Gemini-Pro, and Mixtral and find that a Claude v3 Opus agent is the best in terms of success rate. It can build compelling ML models over many tasks in MLAgentBench with 37.5% average success rate. Our agents also display highly interpretable plans and actions. However, the success rates vary considerably; they span from 100% on well-established older datasets to as low as 0% on recent Kaggle challenges created potentially after the underlying LM was trained. Finally, we identify several key challenges for LM-based agents such as long-term planning and reducing hallucination.

Introduction

Machine learning (ML) research is a highly iterative and labor-intensive process. Researchers must design architectures, implement code, execute experiments, analyze logs, and refine their methods based on empirical feedback. While progress in AutoML has automated specific sub-tasks like hyperparameter tuning, the broader challenge of end-to-end autonomous ML experimentation remains largely unexplored. This paper introduces MLAgentBench, a benchmark designed to evaluate whether Large Language Model (LLM) agents can function as autonomous ML researchers within a sandboxed environment.

The MLAgentBench Framework

The core of MLAgentBench is a standardized environment where an agent is tasked with improving a model's performance on a specific dataset. As shown in Figure 1, each task provides the agent with a description, a set of starter files (including training scripts and data descriptions), and a defined evaluation metric (e.g., Test Accuracy).

Overview of the MLAgentBench task environment, including task descriptions, starter files, and evaluation metrics.

The benchmark includes 13 diverse tasks categorized into:

  • Canonical Tasks: Standard datasets like CIFAR-10 and IMDB.
  • Classic Kaggle: Introductory challenges like house-price.
  • Recent Kaggle Challenges: Competitions launched after the LLMs' training cutoffs to test true generalization.
  • Recent Research: Active problems like BabyLM and CLRS algorithmic reasoning.
  • Code Improvement: Tasks focused on execution speed optimization.

Agent Design and Methodology

To navigate these tasks, the authors developed a custom agent based on the ReAct (Reasoning + Acting) framework. A critical component of this agent is its structured prompting strategy, which requires the model to "think" before executing any action. At each step, the agent generates a response containing a Reflection on previous outcomes, a Research Plan and Status update, and a Fact Check to verify that its claims are supported by actual code outputs.

The structured prompt and interaction loop for the LLM agent, featuring reflection, planning, and fact-checking steps.

This structured approach (Figure 4) helps mitigate common failure modes, such as "hallucinating success," where an agent might claim performance improvements without actually running the necessary experiments.

Experimental Results

The benchmarking of various state-of-the-art LLMs revealed significant performance disparities:

  • Claude 3 Opus emerged as the most capable model, achieving a 37.5% average success rate. It demonstrated perfect performance (100%) on classic tasks but struggled with newer, out-of-distribution research problems (0% on BabyLM).
  • GPT-4-turbo achieved a 26.0% success rate but was notably more efficient, completing tasks with significantly fewer tokens.
  • Memorization vs. Generalization: A clear "pre-training memorization" effect was observed. Agents excelled on older datasets likely present in their training data but failed on recent Kaggle challenges, highlighting a lack of true research-level extrapolation.

Discussion and Future Work

Despite the promise of LLM agents, several hurdles remain. Agents often fall into unproductive debugging loops or fail due to poor long-term planning; an early strategic error often leads to irreversible failure. Furthermore, the high cost of running these agents—averaging $60 per benchmark run for GPT-4-turbo—remains a barrier.

Future research should focus on improving long-term horizon management and reducing hallucinations. Additionally, the authors suggest that these interpretable agents could serve as powerful research assistants in human-AI collaborative settings, allowing human experts to guide the experimentation process.

Summary updated

BibTeX
@inproceedings{huang2024mlagentbench,
  author = {Qian Huang and Jian Vora and Percy Liang and Jure Leskovec},
  title = {{MLAgentBench: Evaluating Language Agents on Machine Learning Experimentation}},
  booktitle = {International Conference on Machine Learning},
  year = {2024},
  url = {https://openreview.net/forum?id=1Fs1LvjYQW},
}
Figure