+
Skip to content

SakanaAI/natural_niches

Repository files navigation

Competition and Attraction Improve Model Fusion

This repository contains code for our GECCO paper: Competition and Attraction Improve Model Fusion (arxiv).

Using this repository you can reproduce the results in the image below, which shows that M2N2 (Model Merging with Natural Niches) can achieve comparable results to CMA-ES when evolving MNIST classifiers from scratch, and it is the best method to evolve pre-trained models.

evolving classifiers from scratch

Table of Contents

Installation

conda env create -f environment.yml

This will create a new Conda environment named natural_niches with all required packages.

Running experiments

Activate the conda environment

conda activate natural_niches

Running the different methods

You can run different methods by specifying the --method parameter. Replace with one of the following options: natural_niches, map_elites, cma_es, or ga.

python main.py --method <method>

Example: Run the ga without crossover:

python main.py --method ga --no_crossover

Running evolution from pre-trained models

The default is to run evolution from scratch. To start from pre-trained add the --use_pre_trained argument.

Example: Run the map_elites starting from pre-trained models:

python main.py --method map_elites --use_pre_trained

Displaying results

To visualize the results, open the Jupyter notebook plotting.ipynb and run all the cells.

Citation

If you use this code or the ideas from our paper, please cite our work:

@article{sakana2025m2n2,
  title={Competition and Attraction Improve Model Fusion},
  author={Abrantes, Jo\~{a}o and Lange, Robert and Tang, Yujin},
  booktitle={Proceedings of the 2025 genetic and evolutionary computation conference},
  pages={1217--1225},
  year={2025}
}

About

The code repository of the paper: Competition and Attraction Improve Model Fusion

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载