Skip to content

amazon-science/DiversityOfThoughts

Repository files navigation

Shield: CC BY 4.0

[ICLR 2025] Enhancing Language Model Agents using Diversity of Thoughts

Official implementation for ICLR 2025 paper Enhancing Language Model Agents using Diversity of Thoughts.

Code adapted from Reflexion

Setup

  1. Install required dependencies into your environment:
pip install -r requirements.txt
  1. Set OPENAI_API_KEY environment key to your OpenAI API Key:
export OPENAI_API_KEY=<your key>

(optional) Setup for running LeetCodeHardGym experiments:

  1. Follow these instructions to prepare the dataset: https://github.com/GammaTauAI/leetcode-hard-gym
  2. 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>
  1. Replace csrf_token in line::40 of executors/leetcode_env/environment.py

Available Agents

  • dot - Diversity of Thoughts Agent
  • dot_bank -- Diversity of Thoughts Agent that uses a Task Agnostic Memory Bank
  • reflexion -- Reflexion Agent
  • simple -- Standard prompting. Set max_iters=1.

Usage

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

Trajectories

We include the trajectories from our paper's experiments in Experiments_logs/

Cite

@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.

CC BY 4.0

About

No description, website, or topics provided.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published