Leniax
A few month ago I started experimenting with a Cellular Automata variation called Lenia. Since that moment, I’ve been chasing a simple goal, trying to make progress on the first of the 5 grand challenges in the study of Lenia
Automated discovery — How to discover Lenia creatures through automated algorithms?
And now, I finally publish all the work I did on this front! It consists of a powerful JAX library named Leniax.
It can simulate not only the Lenia environment but any variation of Cellular automata from the Conway Game of Life to Neural Lenia.
Find the Code on Github
Read the Documentation on readthedoc.io
Go check the associated website
Follow us on Twitter
Leniax showcase!
I don’t want to go in the technical details here. I prefer to show you what you can do with it. To do so, I’ve build a set of examples to highlight the library capacities.
CGOL
Let’s start with a simple example: Conway’s Game Of Life
Lenia
Let’s continue with A Lenia simulation in different colors because science and design are awesome when paired together.
Multiple initialization in parallel
An interesting benefit of Using JAX is easy parallelization. A first use of this capacity is to see how a set of simulation parameters react for different initial conditions
Multiple simulations in parallel
Of course, we can also simulate in parallel completely different simulations with different initialization.
To be efficient, JAX requires some limitations on some of of the simulations parameters (same shape, etc.) but as long as you are looking to simulate only variations of the same world, it’s perfectly fine and fast!
Harnessing parallelization for mutation
Now that we have all this parallelization power, let’s use it!
In those 2 examples (1 for GPU, and 1 for TPU) I show how to mutate a configuration to find a new creature. To give an idea, I can search over more than 8000 simulations in parallel thanks to JAX.
We can start from a nice one which I called Squiggle:
And launch the search to found something else, in this example we found some kind of very stable orbs:
The ultimate goal: Quality-diversity Search
Finally, we reach the end-game!
Using all our tooling we are able to use Quality-Diversity algorithms at their full power and find creatures automatically!
My current algorithm contains some heuristics but QD-search is incredibly efficient and especially suited to Lenia with its notion of parameter/behavior space.
To my knowledge there does not exist a more efficient way than this one in the current Lenia literature.
Some results while searching for more and more complex creatures:
1-layer complexity
2-layer complexity
3-layer complexity
BONUS: Learning an existing simulation parameters
Thanks to JAX, we can have fun with differentiability too! For example, we can try to learn the kernel from an existing Orbium simulation (Same simulation as in our second example).
BONUS: Neural Lenia
Before posting this blog post, I discovered the work done on Neural CA by Alex Mordvintsev which amazed me! So I wanted to replicate that work in the Lenia environment.
Conclusion
That’s it! But before wrapping up I would like to thank the very cool Lenia community on Discord that allows me to do all this work and especially the incredible Ai x ALife researcher Bert Chan who started the work in this awesome line of research!
Without them I wouldn’t have been able to produce that much amount of work and release it in the open.