archiki / ADaPT

Official code for the paper "ADaPT: As-Needed Decomposition and Planning with Language Models"
https://allenai.github.io/adaptllm/
MIT License
72 stars 9 forks source link

ADaPT: As-Needed Decomposition and Planning with Language Models

teaser image

Dependencies

This code uses the OpenAI API, please put your access key in KEY.txt. To run experiments on ALFWorld, and WebShop please install and set up the environments from the source repositories alfworld, webshop respectively. Our code base adds extra functionality on top of ALFWorld, please replace the alfworld/agents/environment/alfred_tw_env.py with the provided in our repository. To run the TextCraft environment, please download the crafting recipes and store them in TextCraft/recipes/.

Installation

The simplest way to run our code is to build separate conda environments.

conda create --name adaptllm --file requirements.txt python=3.7
conda activate adaptllm
cd ADaPT
teaser image

Running ADaPT

To run experiments on specific environments using ADaPT (Sec 5 of our paper) please run the environment specific files with the default parameters. The decomposition depth 'd' can be set using max_depth variable in all files. See examples below.

python run_alfworld.py
python run_textcraft.py
python run_webshop.py

Acknowledgements

We thank the authors and contributors of ReAct for their public code release.

Reference

Please cite our paper if you use our code in your works:


@article{prasad2023adapt,
      author    = "Prasad, Archiki and Koller, Alexander and Hartmann, Mareike and Clark, Peter and Sabharwal, Ashish and Bansal, Mohit and Khot, Tushar",
      title     = "ADaPT: As-Needed Decomposition and Planning with Language Models",
      journal   = "arXiv",
      year      = "2023",}
}