Skip to main content

NCALab

NCALab is a framework designed to facilitate the creation and analysis of Neural Cellular Automata (NCA) implementations. NCAs are a new type of Artificial Neural Network model that operates on a grid of cells in multiple iterations. With NCALab, users can effortlessly explore various applications of NCA, including image segmentation, classification, and synthesis. The models are documented, unit-tested and type-checked and can be modified in a streamlined fashion.

For more information on NCAs, check out our curated Awesome List and our NCA Tutorial.

docs python-package manuscript status coverage

Python 3.10 Python 3.11 Python 3.12 Python 3.13 Python 3.14

Animation of a growing lizard emoji Animation of gastro-intestinal polyp segmentation using NCA Animation of a prediction on CIFAR-10 in feature space Animation of a prediction on DermaMNIST in feature space Animation of a prediction on DermaMNIST in feature space Animation of a prediction on PathMNIST in feature space

Neural Cellular Automata

NCA are a new type of neural architecture, fusing Cellular Automata and Artificial Neural Networks to create memory-efficient, robust models. By replacing the transition function of a Cellular Automaton with a neural network model (a Multi-Layer Perceptron), they can learn from labelled input data to achieve tasks like image classification or segmentation.

Generalized NCA Architecture

Akin to a traditional cellular automaton, a neural cellular automaton operates in multiple time steps (typically up to 100 steps until a prediction is considered finished). In each time step, the cells of an image are stochastically updated by a multilayer perceptron. Instead of a manual neighborhood aggregation (e.g. Moore or von Neumann neighborhood), neighboring cell states are determined by applying 2D depth-wise convolutions to the input image.

For a better overview on the basic NCA architecture, we recommend you to read the original 2020 NCA Paper by Mordvintsev et al.

Features

Features of NCALab include:

  • Easy training and evaluation of NCA models
  • Cascaded multi-scale training
  • Tensorboard integration with default presets
  • Training with k-fold cross-validation
  • Convenience features: Fixing random seeds, selecting compute devices, data processing
  • Animation and visualization of NCA predictions

Roadmap

The following features are planned for future releases of NCALab:

  • Implementation of more approaches presented in research that extend or tweak NCA models
  • Simplifyed saving and loading of trained NCA models
  • Evaluation of federated and continual learning with NCAs
  • NCAs that operate on 3D voxel data

Getting started

This project makes use of uv for package and dependency management. Please read the installation instructions of uv before proceeding or simply install it to your Python workspace by running:

pip install -U uv

Perhaps the best way of getting started with NCALab is to take a look at the provided usage example tasks, starting with the Growing Emoji task.

You may want to download pre-trained weights for all examples by issuing the following script:

uv run scripts/download_example_weights.py

Usage Example Tasks

So far, the following example tasks are implemented in NCALab:

  • Image Generation:
    • Growing NCA for emoji generation
      • Training and evaluation
      • Fine-tuning of a pre-trained emoji generator
      • Hyperparameter search
  • Image Classification:
    • Self-classifying MNIST digits
    • MedMNIST image classification (PathMNIST, BloodMNIST, DermaMNIST)
  • Image Segmentation:
    • Endoscopic polyp binary segmentation (Kvasir-SEG, public)

You can find those example tasks inside the tasks/ directory and its subfolders.

Growing Lizard Example

A good starting point to get started with NCAs is the famous Growing Lizard emoji example.

uv run tasks/growing_emoji/train_growing_emoji.py

Run this script to generate a GIF of the trained model's prediction:

uv run tasks/growing_emoji/eval_growing_emoji.py

Installation

Run

pip install ncalab

to install the latest release through pip or

pip install git+https://github.com/MECLabTUDA/NCALab

for the most recent commit of NCALab. We recommend to install NCALab in a virtual environment.

Tensorboard integration

We recommend you to monitor your training progress in Tensorboard. To launch tensorboard, run

uv run tensorboard --logdir=runs

in a separate terminal. Once it is running, it should show you the URL the tensorboard server is running on, which is localhost:6006 by default. Alternatively, you may use the tensorboard integration of your IDE.

For Developers

The NCALab project comes with scripts and workflows to maintain software quality.

uv sync --group dev --group docs

Dry Training

To dry-train all example task models, run:

./scripts/dry_train_examples.sh

This script will run the training script of all models, but only for two epochs each. Checkpoints will not be saved.

Distribution

./scripts/train_examples.sh
uv run ./scripts/pack_example_weights.py
./scripts/save_animations.sh

Type Safety

To inspect the code base for type errors, run:

uv run mypy ncalab

Unit Tests and Code Analysis

Static code analysis:

uv run ruff check ncalab

Testing:

uv run pytest tests

View test coverage:

uv run coverage run --source ncalab -m pytest tests
uv run coverage report

Check for outdated dependencies:

uv tree --outdated

How to Cite

Coming soon.

Metadata

Release files for ncalab 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ncalab 0.5.1
File Size Uploaded
ncalab-0.5.1.tar.gz 18.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ncalab 0.5.1
File Interpreter ABI Platform
ncalab-0.5.1-py3-none-any.whl Python 3 none any Details

Total release size: 30.3 kB

Release files / ncalab-0.5.1.tar.gz

Download URL ncalab-0.5.1.tar.gz
Size 18.2 kB
Tags Source
SHA-256 checksum
How to use checksums
174cbea4c73aff220c5656dad022375a2f3ff21e895197e738e2c40c57a86d8e
BLAKE2b-256 checksum
How to use checksums
5de9ff3b37f8b9511cfde881c7c82feec6f7222810be6b467de2a06e9dbfed6f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 30, 2026.

Transparency log

Release files / ncalab-0.5.1-py3-none-any.whl

Download URL ncalab-0.5.1-py3-none-any.whl
Size 12.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
49f3d2e3e1362fb68d0f93f351bae0968029801663174a3be2db41d0ea659349
BLAKE2b-256 checksum
How to use checksums
d9acb6cf6ebb96476b5ad593d65020f9a2b12291573c6b4a09c7922e34c47f0c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 30, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.5.1 This release

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page