Neural cellular automata running in your browser at 60fps
WebGPU makes training tiny neural networks that grow patterns possible in real-time, no server required.
Ivan Ludvig built neural cellular automata that train in the browser using WebGPU. The demo runs at 60fps while training a model to regenerate patterns from partial states. Cellular automata are grids where each cell updates based on its neighbours. Conway’s Game of Life is the classic example. Neural CA replaces hand-coded rules with a small neural network that learns the update function. The network sees a cell and its eight neighbours, outputs RGB changes. Train it to regenerate a target image from noise and it learns to grow stable patterns. The WebGPU implementation is the interesting part. Training happens entirely client-side using compute shaders. No Python notebook, no cloud GPU. The compute pipeline runs forward passes, calculates gradients, updates weights, all in parallel on the GPU. Ludvig shows the loss curve dropping in real-time as the automaton learns. This is what WebGPU was designed for. Machine learning demos that used to need TensorFlow.js running on WebGL now have proper compute shader support. The code compiles to WGSL, the shader language for WebGPU, which maps cleanly to GPU hardware. The visual output is mesmerising. Cells flicker as gradients propagate, then stabilise into coherent patterns. Damage a section of the grid and the automaton repairs itself because the network learned regeneration, not just static replication. I care because this moves ML experimentation from Colab notebooks to interactive web pages. The barrier to trying something drops when you can fork a repo, change parameters, see results immediately. No API keys, no quota limits, no waiting for remote kernels to spin up.