ai4co / reevo

[NeurIPS 2024] ReEvo: Large Language Models as Hyper-Heuristics with Reflective Evolution
https://ai4co.github.io/reevo/
MIT License
116 stars 24 forks source link
ant-colony-optimization automatic-algorithm-generation bin-packing-problem electronic-design-automation evolutionary-algorithms genetic-algorithm hyper-heuristics large-language-models llm-agent multiple-knapsack-problem neural-combinatorial-optimization orienteering-problem reinforcement-learning traveling-salesman-problem vehicle-routing-problem

[NeurIPS 2024] ReEvo: Large Language Models as Hyper-Heuristics with Reflective Evolution

logo

πŸ₯³ Welcome! This is a codebase that accompanies the paper ReEvo: Large Language Models as Hyper-Heuristics with Reflective Evolution.

Give ReEvo 5 minutes, and get a state-of-the-art algorithm in return!

Table of Contents

1. News πŸ“°

2. Introduction πŸš€

Diagram of ReEvo

We introduce Language Hyper-Heuristics (LHHs), an emerging variant of Hyper-Heuristics (HHs) that leverages LLMs for heuristic generation, featuring minimal manual intervention and open-ended heuristic spaces.

To empower LHHs, we present Reflective Evolution (ReEvo), a generic searching framework that emulates the reflective design approach of human experts while much surpassing human capabilities with its scalable LLM inference, Internet-scale domain knowledge, and powerful evolutionary search.

3. Exciting Highlights 🌟

We can improve the following types of algorithms:

on the following problems:

with both black-box and white-box settings.

4. Usage πŸ”‘

4.1. Dependency

You may install the dependencies above via pip install -r requirements.txt.

Problem-specific dependencies:

4.2. To run ReEvo

# e.g., for tsp_aco
python main.py \
    problem=tsp_aco \  # problem name
    init_pop_size=4 \  # initial population size
    pop_size=4 \  # population size
    max_fe=20 \  # maximum number of heuristic evaluations
    timeout=20  # allowed evaluation time for one generation

Check out ./cfg/ for more options.

4.3. Available problems

4.4. Simple steps to apply ReEvo to your problem

By default:

4.5. Use Alternative LLMs

Use the cli parameter llm_client to designate an LLM API provider, and llm_client.model to determine the model to use. For example,

$ export LLAMA_API_KEY=xxxxxxxxxxxxxxxxxxxx
$ python main.py llm_client=llama_api llm_client.model=gemma2-9b

Supported LLM API providers and models include (note that only chat models are supported):

5. Citation 🀩

If you encounter any difficulty using our code, please do not hesitate to submit an issue or directly contact us!

We are also on Slack if you have any questions or would like to discuss ReEvo with us. We are open to collaborations and would love to hear from you πŸš€

If you find our work helpful (or if you are so kind as to offer us some encouragement), please consider giving us a star, and citing our paper.

@inproceedings{ye2024reevo,
    title={ReEvo: Large Language Models as Hyper-Heuristics with Reflective Evolution}, 
    author={Haoran Ye and Jiarui Wang and Zhiguang Cao and Federico Berto and Chuanbo Hua and Haeyeon Kim and Jinkyoo Park and Guojie Song},
    booktitle={Advances in Neural Information Processing Systems},
    year={2024},
    note={\url{https://github.com/ai4co/reevo}}
}

6. Acknowledgments 🫑

We are very grateful to Yuan Jiang, Yining Ma, Yifan Yang, and AI4CO community for valuable discussions and feedback.

Also, our work is built upon the following projects, among others: