petri-dish-nca: When Neural Cellular Automata Start Competing for Space
Sakana AI's PD-NCA turns growth into an ecosystem, where multiple learners fight, adapt, and survive inside one shared dish.
- PD-NCA treats neural cellular automata as a population, so the real subject is the ecosystem they build together.
- Grouped convolutions let the repo update many competing agents in one GPU pass while keeping their weights separate.
- The pool, feature hooks, and survivor replacement logic keep the simulation from collapsing into a one-off animation.
- Compression and entropy give the project a way to ask whether a pattern is structured, not just pretty.
Most NCA demos are about making one thing grow. This repo is about what happens when many growing systems have to share the same territory. That shift sounds small, but it changes the whole question from what shape does one model make? to what kind of world emerges when the models have to fight over the same pixels?
The invention is simple. The consequences are not.
Sakana AI's petri-dish-nca comes from the same family as classic neural cellular automata, but it swaps the lonely growth loop for a shared substrate. The authors frame PD-NCA as a differentiable multi-agent system, trained continuously inside an artificial life simulation, which means the model is not just developing. It is adapting while the episode is still running.
We introduce Petri Dish Neural Cellular Automata (PD-NCA): a differentiable multi-agent substrate consisting of a competitive population of neural cellular automata (NCA), trained continuously as an artificial life simulation.
One GPU pass, many species
The technical trick is clean. In src/model.py, the repo uses grouped convolutions so each NCA species keeps its own parameters while still being updated in parallel. That matters because the interesting part of the experiment is not the math of one agent. It is the interaction between many agents sharing the same substrate, the same resource signal, and the same hard limits.
# Conceptual shape logic used by the engine
# Each species keeps its own channel group.
state = rearrange(state, 'b n c h w -> b (n c) h w')
updated = nn.Conv2d(in_channels=n * c, out_channels=n * c, kernel_size=1, groups=n)(state)
updated = rearrange(updated, 'b (n c) h w -> b n c h w', n=n)
The repository is built like an experiment harness
src/world.pymanages the pool of grids, the feature hooks, and the replacement logic that keeps dead runs from dominating the dataset.src/config.pyturns the experiment into typed, reproducible settings, including derived dimensions and hardware-aware seeding.src/viz.pydoes more than render pretty frames. It also measures structure with entropy and compression ratios.configs/holds different experiment scales, whilenotebooks/gives the team a place to watch the battle unfold.
What PD-NCA changes
| Dimension | Conventional NCA | PD-NCA |
|---|---|---|
| Core object | One model grows one pattern. | Many independent models compete in one dish. |
| Learning loop | Train, then usually freeze. | Keep updating during the simulation. |
| World model | A single grid with a target outcome. | A shared substrate with pressure, replacement, and resource signals. |
| What success looks like | A shape that matches the goal. | Open-ended structure that keeps surviving and changing. |
We introduce Petri Dish Neural Cellular Automata (PD-NCA): a differentiable multi-agent substrate consisting of a competitive population of neural cellular automata (NCA), trained continuously as an artificial life simulation.
Measuring whether the dish is becoming more than noise
The repo does not stop at visuals. In src/viz.py, it reaches for higher_order_entropy and compression ratios as a proxy for complexity, which is exactly the kind of move this project needs. If a colony looks busy but compresses like static, that is not the same thing as emergence. The point is to distinguish structure from decorative chaos.