Official implementation for ICLR 2025 paper Enhancing Language Model Agents using Diversity of Thoughts.
Code adapted from Reflexion
- Install required dependencies into your environment:
pip install -r requirements.txt
- Set
OPENAI_API_KEY
environment key to your OpenAI API Key:
export OPENAI_API_KEY=<your key>
- Follow these instructions to prepare the dataset: https://github.com/GammaTauAI/leetcode-hard-gym
- Login to LeetCode on your browser and retrieve 'csrf' and 'LEETCODEHARD_SESSION' from your browser cookies and set environment variable:
export LEETCODEHARD_SESSION=<LEETCODE_SESSION str from your browser session>
- Replace csrf_token in line::40 of
executors/leetcode_env/environment.py
dot
- Diversity of Thoughts Agentdot_bank
-- Diversity of Thoughts Agent that uses a Task Agnostic Memory Bankreflexion
-- Reflexion Agentsimple
-- Standard prompting. Setmax_iters=1
.
We provide a sample script example_run.sh
. Provide the output directory by changing the value for --root_dir
and run:
sh example_run.sh
--max_iters
: maximum depth of search tree
We include the trajectories from our paper's experiments in Experiments_logs/
@inproceedings{
lingam2025enhancing,
title={Enhancing Language Model Agents using Diversity of Thoughts},
author={Vijay Lingam and Behrooz Omidvar Tehrani and Sujay Sanghavi and Gaurav Gupta and Sayan Ghosh and Linbo Liu and Jun Huan and Anoop Deoras},
booktitle={The Thirteenth International Conference on Learning Representations},
year={2025},
url={https://openreview.net/forum?id=ZsP3YbYeE9}
}
This work is licensed under a Creative Commons Attribution 4.0 International License.