Elffuss BraidHub

kikocis/auto-code-rover public

main · 3.8 KiBRenderedRawPermalink
1# Replicating results on SWE-bench-lite
2
3## Setup
4
5### Docker
6
7> [!IMPORTANT]
8> There can be minor improvements to the Docker image from time to time. Please pull the latest version of the image.
9
10> [!NOTE]
11> The experiments were conducted on Ubuntu 20.04. Since SWE-bench evaluation may have different behavior
12> under different host systems, it is recommened to run the provided docker on Ubuntu 20.04.
13
14We have built a docker image with all task instances environment in it (it's a large image ~25GB!).
15With this image, you can directly start an experiment run.
16
17```
18docker pull yuntongzhang/auto-code-rover:experiment
19```
20
21## Experiment preparation
22
23Start a container:
24
25```
26docker run -it yuntongzhang/auto-code-rover:experiment
27```
28
29Activate the conda environment in it.
30
31```
32conda activate auto-code-rover
33```
34
35Set some temp git info:
36
37```
38git config --global user.email acr@nus.edu.sg
39git config --global user.name acr
40```
41
42In the container, specify your OpenAI key in the `OPENAI_KEY` environment variable:
43
44```
45export OPENAI_KEY=xx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
46```
47
48## Run!
49
50In the `/opt/auto-code-rover/` directory in the container, issue the following command to start
51the experiment run using `gpt-4-0125-preview` on SWE-bench-lite.
52(From our experience, one run with `gpt-4-0125-preview` on the 300 instances costs <150 USD on OpenAI API.)
53
54```
55python scripts/run.py conf/vanilla-lite.conf
56```
57
58This command runs auto-code-rover on the 300 instances in SWE-bench-lite, and runs the SWE-bench
59evaluation on the generated patches. The final results of the experiment will be at
60`/opt/auto-code-rover/experiment/vanilla-lite/final_report.json`.
61
62
63### Running experiments multiple times
64
65When running multiple experiments (sequentially), we recommend using a different `id` in the conf
66file for each experiment. This is because the outputs for an experiment will be created in a directory
67using `id` as the name.
68
69If you want to use the same `id` for multiple experiments and overwrite the previous experiment results,
70you can use the `-f` option of `scripts/run.py`. This will remove the previous experiment results with
71the same `id`.
72
73
74### Note on running experiments in parallel
75
76We do not recommend creating multiple processes running the script `scripts/run.py`. This is because
77different tasks instances may share the same copy of local code base (e.g. `astropy-6938` and
78`astropy-7746` share the same codebase at `setup_astropy__astropy__1.3`).
79
80Instead, we support parallelism of experiments in `scripts/run.py` itself. Please set the value
81of `num_processes` in the conf file to control how many tasks can be run in parallel. The scripts
82internally handle the parallelism issue mentioned above.
83
84
85### Changing the conf file
86
87You can modify the `conf/vanilla-lite.conf` file to set parameters such as model temperature etc.
88Here are a few useful fields in the conf file:
89
90- id: determines the name of the experiment output folder
91- experiment_dir: where output will be stored
92- setup_result_dir: must point to the directory where SWE-bench setup writes its results
93- eval_log_dir: where the SWE-bench evaluation log is written to
94
95- model: the model to be used by auto-code-rover
96- temperature: model temperature
97- conv_round_limit: rounds limit for the conversation with context retrieval agent
98- selected_tasks_file: a file containing ids of all tasks to be run
99- print: whether to the print more info to console
100- num_processes: number of parallel processes when running auto-code-rover. Should not be too large, otherwise parallelly running multiple task instances can exceed OpenAI token limit and cause the task instance to fail.
101
102### Contacts
103
104> [!NOTE]
105> If you encounter any issue in the replication experiment, you can open an GitHub issue or contact us at {yuntong,hruan,zhiyufan}@comp.nus.edu.sg.