• Stars
    star
    224
  • Rank 176,765 (Top 4 %)
  • Language
    Python
  • License
    MIT License
  • Created about 1 year ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

MLAgentBench: Benchmarking Large Language Models As AI Research Agents

MLAgentBench is a suite of end-to-end Machine Learning (ML) research tasks for benchmarking AI research agents, where the agent aims to take a given dataset and a machine learning task description and autonomously develop or improve an ML model. Paper: https://arxiv.org/abs/2310.03302

Each task is an interactive environment that directly resembles what human researchers see, where an agent can read available files, run multiple experiments on a compute cluster, and analyze results to achieve the specified research goal. Specifically, we include 15 diverse ML engineering tasks, achievable by trying different machine learning methods, data processing, architectures, training processes, etc:

Setup

The MLAgentBench package can be installed with

pip install -e .

Install dependencies with python 3.10 by running

bash install.sh

or use our docker image. Since agent will modify and execute files, we recommend running experiments within sandboxes such as docker container. For docker, use the following instructions:

  1. Pull the docker image:
docker pull qhwang123/researchassistant:latest
  1. Run the docker container from the image, mounting the current directory to /MLAgentBench inside the container with root user permissions to install other packages:
  • On Windows PowerShell
docker run -it --user root -v ${PWD}:/MLAgentBench -w /MLAgentBench qhwang123/researchassistant:latest
  • On Mac or Linux
docker run -it --user root -v "$(pwd)":/MLAgentBench -w /MLAgentBench qhwang123/researchassistant:latest

Each dataset will be prepared when it is run the first time. You can also prepare them beforehand with

python -u -m MLAgentBench.prepare_task <task_name> $(which python)

For Kaggle datasets, you need to set up Kaggle API and authentication (~/.kaggle/kaggle.json) as described here. You may also need to provide manual consent to the rules of specific competitions by following the prompts. For docker, use the following instructions:

  1. Ensure that you have ".kaggle/kaggle.json" with your API credentials in the MLAgentBench root folder.
  2. Once your container is mounted (instructions above), run
export KAGGLE_CONFIG_DIR=/MLAgentBench/.kaggle
pip install kaggle
sudo apt-get install unzip

Finally, put API keys under the root directory of this repo (or wherever you run scripts from). Currently, we support OpenAI (openai_api_key.txt in the format of organization:APIkey), Claude (claude_api_key.txt), and CRFM API (crfm_api_key.txt). To use an AutoGPT agent, setup the directory as described here.

Quick Start

To run our research agent on cifar10 task with openai API using gpt-4 and gpt-3.5-turbo:

python -u -m MLAgentBench.runner --python $(which python) --task cifar10 --device 0 --log-dir first_test  --work-dir workspace --llm-name gpt-4 --edit-script-llm-name gpt-4 --fast-llm-name gpt-3.5-turbo

This will produce logs in first_test directory with the following structure

first_test/
    agent_log/
        main_log # main log showing agent's research process
        agent_*.json # saved agent states
        ...
    env_log/
        tool_logs/ 
        traces/ # snap shots of the agent workspace
        trace.json # interaction trace of the agent
        overall_time.txt # overall time
        error.txt # will be generated if there is a system error

If llm names are not specified in the args, we use claude-v1 model by default for all LLM calls. See example logs with GPT-4 over cifar10 here.

Evaluation

To run evaluation:

python -m MLAgentBench.eval --log-folder <log_folder>  --task <task_name> --output-file <output_name>

This will evaluate all runs under <log_folder> as a json.

To run baseline, run the trivial policy of directly running train.py then submit with --agent_type Agent as in baseline.sh:

Run Experiments

To run parallel experiments over different tasks and different agents, you can use run_experiments.sh

Tasks

Each task is a folder in MLAgentBench/benchmarks/, under which the env/ folder contains files that the research agent will see at the beginning, and script/ folder contains additional hidden files such as prepare.py for downloading data and eval.py for evaluation.

Agents

We currently support variants of our research agent along with langchain and autogpt agents. See run_experiments.sh for their commands.

Results

Success Rate, i.e. the percentages of runs that achieve more than 10% improvement at the last step over the average performance of the baseline in starter code:

Average Improvement over the baseline in starter code among the runs that made a valid submission at the last step:

Interactive Mode (Under construction)

You can also specify tasks interactively to the research agent by running research_agent_interactive.sh, or ideally as a vscode extension.

More Repositories

1

snap

Stanford Network Analysis Platform (SNAP) is a general purpose network analysis and graph mining library.
C++
2,167
star
2

ogb

Benchmark datasets, data loaders, and evaluators for graph machine learning
Python
1,906
star
3

GraphGym

Platform for designing and evaluating Graph Neural Networks (GNN)
Python
1,669
star
4

pretrain-gnns

Strategies for Pre-training Graph Neural Networks
Python
955
star
5

deepsnap

Python library assists deep learning on graphs
Python
543
star
6

GraphRNN

Python
408
star
7

med-flamingo

Python
375
star
8

neural-subgraph-learning-GNN

Jupyter Notebook
327
star
9

snap-python

SNAP Python code, SWIG related files
C++
294
star
10

cs224w-notes

CS224W Course Notes
CSS
292
star
11

stark

STaRK: Benchmarking LLM Retrieval on Textual and Relational Knowledge Bases (https://stark.stanford.edu/)
Python
276
star
12

KGReasoning

Multi-Hop Logical Reasoning in Knowledge Graphs
Python
274
star
13

GreaseLM

[ICLR 2022 spotlight]GreaseLM: Graph REASoning Enhanced Language Models for Question Answering
Python
229
star
14

GEARS

GEARS is a geometric deep learning model that predicts outcomes of novel multi-gene perturbations
Python
189
star
15

distance-encoding

Distance Encoding for GNN Design
Jupyter Notebook
181
star
16

relbench

RelBench: Relational Deep Learning Benchmark
Python
181
star
17

graphwave

Jupyter Notebook
169
star
18

covid-mobility

Jupyter Notebook
147
star
19

UCE

UCE is a zero-shot foundation model for single-cell gene expression data
Python
135
star
20

GIB

Graph Information Bottleneck (GIB) for learning minimal sufficient structural and feature information using GNNs
Jupyter Notebook
123
star
21

roland

Jupyter Notebook
120
star
22

mars

Discovering novel cell types across heterogenous single-cell experiments
Jupyter Notebook
119
star
23

comet

[ICLR 2021] Concept Learners for Few-Shot Learning
Python
111
star
24

SATURN

Jupyter Notebook
103
star
25

orca

[ICLR 2022] Open-World Semi-Supervised Learning
Python
85
star
26

prodigy

Python
75
star
27

CAW

Python
72
star
28

snapvx

Python
65
star
29

conformalized-gnn

Uncertainty Quantification over Graph with Conformalized Graph Neural Networks (NeurIPS 2023)
Python
64
star
30

multiscale-interactome

Python
62
star
31

plato

Python
61
star
32

miner-data

Python
60
star
33

stellar

Jupyter Notebook
58
star
34

mambo

Jupyter Notebook
37
star
35

lamp

[ICLR23] First deep learning-based surrogate model that jointly learns the evolution model and optimizes computational cost via remeshing
Python
36
star
36

crust

[NeurIPS 2020] Coresets for Robust Training of Neural Networks against Noisy Labels
Python
33
star
37

bc-emb

Python
32
star
38

csr

Python
30
star
39

zeroc

ZeroC is a neuro-symbolic method that trained with elementary visual concepts and relations, can zero-shot recognize and acquire more complex, hierarchical concepts, even across domains
Jupyter Notebook
28
star
40

masa

Motif-Aware State Assignment in Noisy Time Series Data
Python
24
star
41

le_pde

LE-PDE accelerates PDEs' forward simulation and inverse optimization via latent global evolution, achieving significant speedup with SOTA accuracy
Jupyter Notebook
21
star
42

ConE

Python
20
star
43

F-FADE

Python
17
star
44

MetroMaps

MetroMaps Release
Python
16
star
45

MAG

Programs for Microsoft Academic Graph
Python
16
star
46

BioDiscoveryAgent

BioDiscoveryAgent is an LLM-based AI agent for closed-loop design of genetic perturbation experiments
Python
16
star
47

snap-dev

SNAP repository for Ringo
C++
14
star
48

exposure-segregation

Python
13
star
49

ringo

Next generation graph processing platform
Python
12
star
50

planet

PlaNet: Predicting population response to drugs via clinical knowledge graph
Python
12
star
51

covid-mobility-tool

Jupyter Notebook
10
star
52

reddit-processing

preprocessing of Reddit data
Python
7
star
53

news-search

search Internet news archive
Java
7
star
54

snap-python-64

C++
6
star
55

snap-dev-64

64-bit SNAP (in development, not intended for general use)
C++
6
star
56

snapworld

Python
6
star
57

ViRel

ViRel: Unsupervised Visual Relations Discovery with Graph-level Analogy
Python
5
star
58

lego

5
star
59

yperf

Simple performance monitor for Linux
Python
4
star
60

pebble-fit

become less sedentary with pebble
C
4
star
61

dec2vec

Python
3
star
62

caml

Python
3
star
63

snaptime

Python
2
star
64

SnapTimeTF

Python
2
star
65

covid-spillovers

Jupyter Notebook
2
star
66

curis-2012

Summer 2012 Curis Project
JavaScript
2
star
67

GNN-reading-group

1
star
68

supply-chains

Jupyter Notebook
1
star
69

relbench-user-study

Python
1
star
70

AutoTransfer

Python
1
star
71

hash

C++
1
star