turbo-neat

github →

turbo-neat is a hardware-accelerated JAX implementation of NEAT (NeuroEvolution of Augmenting Topologies), the algorithm introduced by Stanley and Miikkulainen in their 2002 paper Evolving Neural Networks through Augmenting Topologies. This project also includes a variety of examples, ranging from classic RL tasks to fun multi-agent environments. Evolve agents to race cars or play volleyball through self-play!

NEAT is an evolutionary algorithm that evolves a population of small neural networks through perturbations of weights and updates to each network's topology. Network weights and topology are encoded as 'genes' within a 'genome', with genes from fit networks passed on to the next generation.

The population starts as minimal networks with no hidden neurons and random weights. Each generation then works as follows:

  1. Evaluation: compute the fitness of each member of the population by running environment rollouts with its network.
  2. Speciation: cluster the population into groups of similar genomes, or 'species'.
  3. Reproduction: build the next generation by crossing over the genomes of high-performing members within each species. Species are allotted offspring according to their average fitness, and new species get a grace period before they can lose their entire allotment due to competition from other species.
  4. Mutation: perturb the new members' weights, and add or remove nodes and connections at random. This is how new structure enters the population.

As this process repeats, useful weights and topological features emerge from mutations and spread through the population. The algorithm converges to sparse, performant networks across a variety of toy tasks.

Given a vectorized environment, turbo-neat runs each generation on the GPU (rollouts, speciation, reproduction and mutation), evaluating the entire population in parallel.

Pick an environment to explore a real training run: watch the population's fitness climb and observe the structure that emerges.

Further reading

Cars drive around a track with lidar, telemetry, and nearby car proximity as inputs, and score based on the distance they cover before the end of the episode without hitting walls or other cars. Over time the population learns to make it around corners, navigate obstacles, and drive faster laps. run it yourself →