dexhunter commited on
Commit
4e0c8c5
·
verified ·
1 Parent(s): b6b9ed5

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +271 -3
README.md CHANGED
@@ -1,3 +1,271 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <h1 align="center">AIDE: The Machine Learning Engineer Agent</h1>
2
+
3
+ <p align="center">
4
+ 📑 <a href="https://arxiv.org/abs/2502.13138">Paper</a>&nbsp&nbsp | &nbsp&nbsp📝 <a href="https://www.weco.ai/blog/technical-report">Blog</a>&nbsp&nbsp | &nbsp&nbsp🌐 <a href="https://www.aide.ml">Project</a>
5
+ </p>
6
+
7
+ <p align="center">
8
+ <a href="https://www.python.org/downloads/release/python-3100/"><img src="https://img.shields.io/badge/python-3.10+-blue.svg" alt="Python 3.10+"></a>
9
+ <a href="https://pypi.org/project/aideml/"><img src="https://img.shields.io/pypi/v/aideml?color=blue" alt="PyPI"></a>&ensp;
10
+ <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-green.svg" alt="License: MIT"></a>&ensp;
11
+ <a href="https://discord.gg/Rq7t8wnsuA"><img src="https://dcbadge.vercel.app/api/server/Rq7t8wnsuA?compact=true&style=flat" alt="Discord"></a>&ensp;
12
+ <a href="https://twitter.com/WecoAI"><img src="https://img.shields.io/twitter/follow/WecoAI?style=social" alt="Twitter Follow"></a>&ensp;
13
+ </p>
14
+
15
+ AIDE is an LLM agent that generates solutions for machine learning tasks just from natural language descriptions of the task.
16
+
17
+ In our own benchmark composed of over 60 Kaggle data science competitions, AIDE demonstrated impressive performance, surpassing 50% of Kaggle participants on average.
18
+
19
+ OpenAI's [MLE-bench](https://arxiv.org/pdf/2410.07095), a benchmark composed of 75 Kaggle machine learning tasks, shows that AIDE achieved four times more medals compared to the runner-up agent architecture.
20
+
21
+ METR's [RE-Bench](https://arxiv.org/pdf/2411.15114) shows that AIDE is not only capable at machine learning tasks but generalizes to the AI R&D tasks such as optimizing low level Triton kernels and finetuning GPT-2 for QA, even surpassing the performance of human experts.
22
+
23
+ More specifically, AIDE has the following features:
24
+
25
+ 1. **Instruct with Natural Language**: Describe your problem or additional requirements and expert insights, all in natural language.
26
+ 2. **Deliver Solution in Source Code**: AIDE will generate Python scripts for the **tested** machine learning pipeline. Enjoy full transparency, reproducibility, and the freedom to further improve the source code!
27
+ 3. **Iterative Optimization**: AIDE iteratively runs, debugs, evaluates, and improves the ML code, all by itself.
28
+ 4. **Visualization**: We also provide tools to visualize the solution tree produced by AIDE for a better understanding of its experimentation process. This gives you insights not only about what works but also what doesn't.
29
+
30
+ # How to Use AIDE?
31
+
32
+ ## Running AIDE via the Web UI
33
+
34
+
35
+ https://github.com/user-attachments/assets/1da42853-fe36-45e1-b6a2-852f88470af6
36
+
37
+
38
+ We have developed a user-friendly Web UI using Streamlit to make it even easier to interact with AIDE.
39
+
40
+ ### Prerequisites
41
+
42
+ Ensure you have installed the development version of AIDE and its dependencies as described in the [Development](#development) section.
43
+
44
+ ### Running the Web UI
45
+
46
+ Navigate to the `aide/webui` directory and run the Streamlit application:
47
+
48
+ ```bash
49
+ cd aide/webui
50
+ streamlit run app.py
51
+ ```
52
+
53
+ Alternatively, you can run it from the root directory:
54
+
55
+ ```bash
56
+ streamlit run aide/webui/app.py
57
+ ```
58
+
59
+ ### Using the Web UI
60
+
61
+ 1. **API Key Configuration**: In the sidebar, input your OpenAI API key or Anthropic API key and click "Save API Keys".
62
+
63
+ 2. **Input Data**:
64
+ - You can either **upload your dataset files** (`.csv`, `.txt`, `.json`, `.md`) using the "Upload Data Files" feature.
65
+ - Or click on "Load Example Experiment" to use the example house prices dataset.
66
+
67
+ 3. **Define Goal and Evaluation Criteria**:
68
+ - In the "Goal" text area, describe what you want the model to achieve (e.g., "Predict the sales price for each house").
69
+ - In the "Evaluation Criteria" text area, specify the evaluation metric (e.g., "Use the RMSE metric between the logarithm of the predicted and observed values.").
70
+
71
+ 4. **Configure Steps**:
72
+ - Use the slider to set the number of steps (iterations) for the experiment.
73
+
74
+ 5. **Run the Experiment**:
75
+ - Click on "Run AIDE" to start the experiment.
76
+ - Progress and status updates will be displayed in the "Results" section.
77
+
78
+ 6. **View Results**:
79
+ - **Tree Visualization**: Explore the solution tree to understand how AIDE experimented and optimized the models.
80
+ - **Best Solution**: View the Python code of the best solution found.
81
+ - **Config**: Review the configuration used for the experiment.
82
+ - **Journal**: Examine the detailed journal entries for each step.
83
+
84
+
85
+ ## Running AIDE via the Command Line
86
+
87
+ ### Setup
88
+
89
+ Make sure you have `Python>=3.10` installed and run:
90
+
91
+ ```bash
92
+ pip install -U aideml
93
+ ```
94
+
95
+ Also install `unzip` to allow the agent to autonomously extract your data.
96
+
97
+ Set up your OpenAI (or Anthropic) API key:
98
+
99
+ ```bash
100
+ export OPENAI_API_KEY=<your API key>
101
+ # or
102
+ export ANTHROPIC_API_KEY=<your API key>
103
+ ```
104
+
105
+ To run AIDE:
106
+
107
+ ```bash
108
+ aide data_dir="<path to your data directory>" goal="<describe the agent's goal for your task>" eval="<(optional) describe the evaluation metric the agent should use>"
109
+ ```
110
+
111
+ For example, to run AIDE on the example [house price prediction task](https://www.kaggle.com/competitions/house-prices-advanced-regression-techniques/data):
112
+
113
+ ```bash
114
+ aide data_dir="example_tasks/house_prices" goal="Predict the sales price for each house" eval="Use the RMSE metric between the logarithm of the predicted and observed values."
115
+ ```
116
+
117
+ Options:
118
+
119
+ - `data_dir` (required): A directory containing all the data relevant for your task (`.csv` files, images, etc.).
120
+ - `goal`: Describe what you want the models to predict in your task, for example, "Build a time series forecasting model for bitcoin close price" or "Predict sales price for houses".
121
+ - `eval`: The evaluation metric used to evaluate the ML models for the task (e.g., accuracy, F1, Root-Mean-Squared-Error, etc.).
122
+
123
+ Alternatively, you can provide the entire task description as a `desc_str` string, or write it in a plaintext file and pass its path as `desc_file` ([example file](aide/example_tasks/house_prices.md)).
124
+
125
+ ```bash
126
+ aide data_dir="my_data_dir" desc_file="my_task_description.txt"
127
+ ```
128
+
129
+ The result of the run will be stored in the `logs` directory.
130
+
131
+ - `logs/<experiment-id>/best_solution.py`: Python code of the _best solution_ according to the validation metric.
132
+ - `logs/<experiment-id>/journal.json`: A JSON file containing the metadata of the experiment runs, including all the code generated in intermediate steps, plan, evaluation results, etc.
133
+ - `logs/<experiment-id>/tree_plot.html`: You can open it in your browser. It contains a visualization of the solution tree, which details the experimentation process of finding and optimizing ML code. You can explore and interact with the tree visualization to view what plan and code AIDE comes up with in each step.
134
+
135
+ The `workspaces` directory will contain all the files and data that the agent generated.
136
+
137
+ ### Advanced Usage
138
+
139
+ To further customize the behavior of AIDE, some useful options might be:
140
+
141
+ - `agent.code.model=...` to configure which model the agent should use for coding (default is `gpt-4-turbo`).
142
+ - `agent.steps=...` to configure how many improvement iterations the agent should run (default is 20).
143
+ - `agent.search.num_drafts=...` to configure the number of initial drafts the agent should generate (default is 5).
144
+
145
+ You can check the [`config.yaml`](aide/utils/config.yaml) file for more options.
146
+
147
+ ### Using Local LLMs
148
+
149
+ AIDE supports using local LLMs through OpenAI-compatible APIs. Here's how to set it up:
150
+
151
+ 1. Set up a local LLM server with an OpenAI-compatible API endpoint. You can use:
152
+ - [Ollama](https://github.com/ollama/ollama)
153
+ - or similar solutions.
154
+
155
+ 2. Configure your environment to use the local endpoint:
156
+
157
+ ```bash
158
+ export OPENAI_BASE_URL="http://localhost:11434/v1" # For Ollama
159
+ export OPENAI_API_KEY="local-llm" # Can be any string if your local server doesn't require authentication
160
+ ```
161
+
162
+ 3. Update the model configuration in your AIDE command or config. For example, with Ollama:
163
+
164
+ ```bash
165
+ # Example with house prices dataset
166
+ aide agent.code.model="qwen2.5" agent.feedback.model="qwen2.5" report.model="qwen2.5" \
167
+ data_dir="example_tasks/house_prices" \
168
+ goal="Predict the sales price for each house" \
169
+ eval="Use the RMSE metric between the logarithm of the predicted and observed values."
170
+ ```
171
+
172
+ ## Using AIDE in Python
173
+
174
+ Using AIDE within your Python script/project is easy. Follow the setup steps above, and then create an AIDE experiment like below and start running:
175
+
176
+ ```python
177
+ import aide
178
+ exp = aide.Experiment(
179
+ data_dir="example_tasks/bitcoin_price", # replace this with your own directory
180
+ goal="Build a time series forecasting model for bitcoin close price.", # replace with your own goal description
181
+ eval="RMSLE" # replace with your own evaluation metric
182
+ )
183
+
184
+ best_solution = exp.run(steps=10)
185
+
186
+ print(f"Best solution has validation metric: {best_solution.valid_metric}")
187
+ print(f"Best solution code: {best_solution.code}")
188
+ ```
189
+
190
+ ## Development
191
+
192
+ To install AIDE for development, clone this repository and install it locally:
193
+
194
+ ```bash
195
+ git clone https://github.com/WecoAI/aideml.git
196
+ cd aideml
197
+ pip install -e .
198
+ ```
199
+
200
+ ### Running the Web UI in Development Mode
201
+
202
+ Ensure that you have all the required development dependencies installed. Then, you can run the Web UI as follows:
203
+
204
+ ```bash
205
+ cd aide/webui
206
+ streamlit run app.py
207
+ ```
208
+
209
+ ## Using AIDE with Docker
210
+
211
+ You can also run AIDE using Docker:
212
+
213
+ 1. **Build the Docker Image**:
214
+
215
+ ```bash
216
+ docker build -t aide .
217
+ ```
218
+
219
+ 2. **Run AIDE with Docker** (example with house prices task):
220
+
221
+ ```bash
222
+ # Set custom workspace and logs location (optional)
223
+ export WORKSPACE_BASE=$(pwd)/workspaces
224
+ export LOGS_DIR=$(pwd)/logs
225
+
226
+ docker run -it --rm \
227
+ -v "${LOGS_DIR:-$(pwd)/logs}:/app/logs" \
228
+ -v "${WORKSPACE_BASE:-$(pwd)/workspaces}:/app/workspaces" \
229
+ -v "$(pwd)/aide/example_tasks:/app/data" \
230
+ -e OPENAI_API_KEY="your-actual-api-key" \
231
+ aide \
232
+ data_dir=/app/data/house_prices \
233
+ goal="Predict the sales price for each house" \
234
+ eval="Use the RMSE metric between the logarithm of the predicted and observed values."
235
+ ```
236
+
237
+ You can customize the location of workspaces and logs by setting environment variables before running the container:
238
+
239
+ - `WORKSPACE_BASE`: Sets the base directory for AIDE workspaces (default: `$(pwd)/workspaces`)
240
+ - `LOGS_DIR`: Sets the directory for AIDE logs (default: `$(pwd)/logs`)
241
+
242
+ Contribution guide will be available soon.
243
+
244
+ ## Algorithm Description
245
+
246
+ AIDE's problem-solving approach is inspired by how human data scientists tackle challenges. It starts by generating a set of initial solution drafts and then iteratively refines and improves them based on performance feedback. This process is driven by a technique we call Solution Space Tree Search.
247
+
248
+ At its core, Solution Space Tree Search consists of three main components:
249
+
250
+ - **Solution Generator**: This component proposes new solutions by either creating novel drafts or making changes to existing solutions, such as fixing bugs or introducing improvements.
251
+ - **Evaluator**: The evaluator assesses the quality of each proposed solution by running it and comparing its performance against the objective. This is implemented by instructing the LLM to include statements that print the evaluation metric and by having another LLM parse the printed logs to extract the evaluation metric.
252
+ - **Base Solution Selector**: The solution selector picks the most promising solution from the explored options to serve as the starting point for the next iteration of refinement.
253
+
254
+ By repeatedly applying these steps, AIDE navigates the vast space of possible solutions, progressively refining its approach until it converges on the optimal solution for the given data science problem.
255
+
256
+ ![Tree Search Visualization](https://github.com/WecoAI/aideml/assets/8918572/2401529c-b97e-4029-aed2-c3f376f54c3c)
257
+
258
+ # Citation
259
+
260
+ If you use AIDE in your work, please cite the following paper:
261
+ ```bibtex
262
+ @article{aide2025,
263
+ title={AIDE: AI-Driven Exploration in the Space of Code},
264
+ author={Zhengyao Jiang and Dominik Schmidt and Dhruv Srikanth and Dixing Xu and Ian Kaplan and Deniss Jacenko and Yuxiang Wu},
265
+ year={2025},
266
+ eprint={2502.13138},
267
+ archivePrefix={arXiv},
268
+ primaryClass={cs.AI},
269
+ url={https://arxiv.org/abs/2502.13138},
270
+ }
271
+ ```