The KISS
The KISS - Klimt-Inspired Self-organizing System - is a university project developed for the Deep Learning and Applied Artificial Intelligence course, taught by Prof. Emanuele Rodolà, during the first year of my Master’s degree in Applied Mathematics at Sapienza University of Rome.
The project asks whether a learned local rule can reconstruct and maintain a visually complex artwork. Instead of generating an image in one forward pass, a Neural Cellular Automaton repeatedly updates a grid of cells. Each cell sees only its immediate neighborhood, yet their shared dynamics produce a recognizable global image inspired by Gustav Klimt’s The Kiss.
From one cell to an image
The automaton operates on a 64 x 64 grid with 16 channels per cell. The first four channels represent premultiplied RGBA values; the other twelve act as hidden memory that cells use to communicate and coordinate.
The initial state contains no image. Every value is zero except for one central living cell, whose alpha and hidden channels are activated. From this minimal seed, the system must learn the entire growth process.
At every step, each cell:
- perceives its current state and local horizontal and vertical gradients through identity and Sobel filters;
- passes the resulting features through a shared
1 x 1neural update network with a 128-unit hidden layer; - adds the predicted state change only when selected by a stochastic update mask;
- remains active only when supported by the alpha-based living mask.
The default fire rate is 0.5, so only a random subset of cells updates at each iteration. This asynchronous behavior makes the learned dynamics less dependent on a perfectly synchronized grid.
The three-stage pipeline
The final system separates growth, refinement, and transformation into three specialized models:
single seed
-> Model 1: Grow
-> Model 2: Improve and Persist
-> Model 3: Transition and Zoom
Model 1: Grow
The first model learns to reconstruct the full Klimt-inspired target from the seed. Training uses a pattern pool of 1024 intermediate states and batches of 8. Half of each batch is reset to the original seed while the remaining samples are drawn from the pool, so the same model must learn both initial growth and persistence.
Rollouts are sampled between 64 and 256 steps. The objective combines an intermediate loss and a final loss, weighted 0.2 and 0.8. RGB reconstruction receives more weight than alpha reconstruction (2.5 versus 0.5), while a gradient-matching detail term with weight 0.15 discourages overly smooth results.
This stage exposed the project’s central failure mode: a checkpoint can become good at maintaining already developed states while forgetting how to grow from the original seed. For this reason, seed rollouts were monitored separately and training stopped around the last checkpoint that retained reliable growth, near step 1200.
Model 2: Improve and Persist
The second stage fine-tunes the selected grow model for sharper texture and longer stability. A frozen copy of Model 1 acts as a teacher, producing input states after 64 to 256 steps. The student then evolves those states for 128 to 512 additional steps.
The refinement objective increases the RGB weight to 3.0, reduces alpha to 0.35, and raises the detail term to 0.20. Standard L2 regularization (1e-6) controls parameter size, while anchor regularization (1e-5) keeps the student close to the original grow model. Teacher-generated inputs avoid filling a self-managed pool with unstable states and help preserve the original morphogenetic behavior.
Model 3: Transition and Zoom
The third model is trained from scratch to transform the complete image state into a second target focused on the faces. Its initial pool is generated by Model 2 after 48 to 256 steps, and fresh Model 2 states can replace part of each batch during training. The transition automaton runs for 64 to 512 steps and uses RGB, alpha, detail, and L2 losses.
This makes the final output a state-to-state transformation rather than a separate image generator: the zoom model receives the living internal state of the previous automaton and reorganizes it toward the close-up target.
What the experiments showed
The strongest result is methodological. Reconstruction loss alone is not a sufficient measure of success for a self-organizing model. Lower pool loss can hide the loss of seed-growth ability, so visual seed rollouts and long-horizon behavior must be evaluated alongside the numerical objective.
The experiments also showed that:
- higher RGB weighting preserves the target’s chromatic structure;
- gradient-based detail loss reduces blur and improves local transitions;
- longer rollouts improve persistence but can encourage growth forgetting;
- teacher-generated states stabilize the improvement phase;
- a separate NCA can learn a meaningful transition between two living image states.
Browser simulation
The trained models are available through a static browser application. The original Keras .weights.h5 checkpoints are converted into compact JSON files containing the two 1 x 1 convolution kernels and their biases. The browser runtime reconstructs the update network with JavaScript typed arrays, performs Sobel perception and alpha-based life masking, and advances the automaton with requestAnimationFrame.
The interface provides:
- weak and improved growth checkpoints;
- play, pause, and restart controls;
- configurable steps per frame;
- fire-rate selection, including the training default of
0.5; - a live step counter;
- the learned transition that zooms toward the faces.
Because the simulation is implemented as a static site, it runs entirely in the browser without a backend.
Reproducibility and development
The repository contains a Colab notebook for each training stage, target images, loss logs, intermediate pool visualizations, exported Keras checkpoints, the H5-to-JSON conversion utility, and the complete static web application.
AI-assisted tools supported bibliography discovery, code refactoring, experiment ideation, paper summarization, report editing, and development of the web interface. The experiments, code, results, and final claims were reviewed by the author.
References
- Mordvintsev, A., Randazzo, E., Niklasson, E., and Levin, M. Growing Neural Cellular Automata. Distill, 5(2):e23, 2020. DOI: 10.23915/distill.00023.
- Mordvintsev, A., Randazzo, E., Niklasson, E., Levin, M., and Greydanus, S. Differentiable Self-organizing Systems. Distill, 2020.
- Niklasson, E., Mordvintsev, A., Randazzo, E., and Levin, M. Self-Organising Textures. Distill, 2021. DOI: 10.23915/distill.00027.003.
- Magrini, M. The KISS: source code, training notebooks, checkpoints, and project report. GitHub, 2026.