Meta-Brain is an experimental framework for using the male Drosophila melanogaster central nervous system connectome as a sparse recurrent computational substrate for embodied learning.
The project maps visual game observations into sensory neurons, propagates activity through a connectome-derived network, and decodes motor activity into discrete actions. The current demonstration uses Super Mario Bros. and reinforcement learning.
This project does not claim to reproduce the human brain, consciousness, or general intelligence. It tests a narrower and measurable question:
Can a digitally instantiated biological connectome support task-specific adaptive behavior?
The project has two experimental tracks:
-
Corridor control
- Sensorimotor connectome subgraph.
- 40,000 neurons.
- 1,199,959 synaptic edges.
- Closed-loop reinforcement learning.
- Reward improved from
-2.08before training to7.13after training. - Post-training success rate:
25%.
-
Full-connectome Mario control
- MaleCNS metadata loaded with
211,577neurons. - Full-scale sparse recurrent execution on CUDA.
- Visual input from game frames.
- Motor readout trained with policy-gradient reinforcement learning.
- Some training episodes reached approximately
x=1,800in World 1-1. - Final deterministic evaluation reached approximately
x=314on average. - Final evaluation did not yet reach the flag:
success_rate=0,flag_get=false, and all five evaluation episodes ended in death.
- MaleCNS metadata loaded with
The Mario result should therefore be described as successful partial behavioral learning, not yet as robust level completion.
The repository can include the following experiment artifacts:
- Pre-training Mario video
- Post-training Mario video
- Training curves
- Training history
- Evaluation results
- Motor readout checkpoint
- Self-contained Colab notebook
The videos show the best recorded evaluation episode, selected by:
- successful completion without death;
- greatest horizontal progress;
- highest reward.
+---------------------------+
| Super Mario Bros. |
| RGB game frames |
+-------------+-------------+
|
v
+---------------------------+
| Visual encoding |
| 16x16 grayscale image |
| + frame difference |
| 512-dimensional code |
+-------------+-------------+
|
v
+---------------------------+
| Connectome input mapping |
| Fixed projection into |
| identified sensory cells |
+-------------+-------------+
|
v
+---------------------------+
| Sparse recurrent brain |
| Connectome-derived graph |
| Leaky nonlinear dynamics |
| CUDA sparse propagation |
+-------------+-------------+
|
v
+---------------------------+
| Motor readout |
| Descending / motor cells |
| Trainable policy logits |
+-------------+-------------+
|
v
+---------------------------+
| Discrete Mario actions |
| RIGHT_ONLY action space |
+---------------------------+
The MaleCNS data is represented as:
- neuron metadata;
- presynaptic neuron indices;
- postsynaptic neuron indices;
- weighted synaptic connections;
- sensory neuron index set;
- motor neuron index set.
The model keeps the connectome sparse. It does not create a dense matrix with shape N x N.
For each decision step:
sensory drive -> sparse recurrent propagation -> motor activity -> action logits
Synaptic weights are log-transformed and normalized by incoming connection energy to keep the full graph numerically stable.
The connectome structure and sensory projection are frozen during the Mario experiment. The trainable component is the motor readout.
The Mario experiment uses episodic policy-gradient reinforcement learning.
For each episode:
- Reset the game.
- Encode the current frame and frame difference.
- Propagate activity through the sparse connectome.
- Sample an action from the motor readout policy.
- Receive the game reward.
- Compute discounted returns.
- Update the motor readout using policy gradients.
The current experiment is therefore best described as:
Frozen connectome reservoir + trainable motor readout + visual reinforcement learning.
It is not yet a full MAML experiment. The repository contains MAML and related metalearning components, but the Mario result reported here is driven primarily by policy-gradient optimization of the readout.
Open:
notebooks/colab_full_brain_mario_v2.ipynb
The notebook:
- Installs the required packages.
- Downloads the MaleCNS v1.0 files.
- Verifies the loaded graph scale.
- Loads the full sparse network.
- Creates the Gym-style Mario environment.
- Runs pre-training evaluation.
- Trains the motor readout with reinforcement learning.
- Runs post-training evaluation.
- Generates videos, plots, CSV metrics, JSON results and a checkpoint.
The experiment requires:
- CUDA-enabled GPU;
- sufficient GPU memory;
- MaleCNS v1.0 data;
gym-super-mario-bros;- the required game ROM/environment assets;
- several gigabytes of storage for the connectome files.
git clone https://github.com/Matheussoranco/Meta-Brain.git
cd Meta-Brain
python -m venv .venvWindows:
.venv\Scripts\activateLinux/macOS:
source .venv/bin/activateInstall dependencies:
pip install -r requirements.txt
pip install -e .Meta-Brain/
├── config/
│ └── config.yaml
├── connectome/
│ └── loader.py
├── simulator/
│ └── snn.py
├── environment/
│ └── mario_env.py
├── metalearning/
│ └── algorithms.py
├── training/
│ └── train.py
├── notebooks/
│ ├── colab_sizable_brain_test.ipynb
│ └── colab_full_brain_mario_v2.ipynb
├── scripts/
│ ├── download_data.py
│ └── full_brain_mario_v2.py
├── data/
│ └── connectome/
├── tests/
├── requirements.txt
├── setup.py
└── README.md
Meta-Brain is intended as an experimental platform for studying:
- whether connectome topology constrains learnable behavior;
- how biological graph structure compares with shuffled or artificial graphs;
- whether sensorimotor pathways support visual control;
- how neuromodulatory plasticity can be incorporated into connectome-based models;
- whether full-connectome execution provides measurable benefits over sensorimotor subgraphs;
- how biologically inspired architectures compare with conventional neural networks.
The current Mario result is promising but not conclusive. The next validation steps are:
- fix and verify the reported retained edge count;
- run multiple random seeds;
- compare against a random-readout baseline;
- compare against a shuffled-connectome control;
- compare full-connectome and sensorimotor-subgraph variants;
- evaluate on held-out levels;
- report confidence intervals over episode success;
- train until stable flag completion;
- publish all configuration files and checkpoints.
This project should not be interpreted as:
- a simulation of the human brain;
- a complete biological simulation of every neuron and synapse;
- evidence of consciousness;
- evidence of human-level general intelligence;
- proof that biological and digital intelligence are identical.
The scientific claim is narrower:
A large biological connectome can be represented digitally as a sparse recurrent network and can support measurable task-specific adaptive behavior.
If you use this project or its experiments, please cite the repository and the underlying connectome work.
@software{metabrain2026,
title = {Meta-Brain: Full-connectome-inspired reinforcement learning with the Drosophila connectome},
author = {Soranço, Matheus},
year = {2026},
url = {https://github.com/Matheussoranco/Meta-Brain}
}@article{berg2026malecns,
title = {Sexual dimorphism in the complete Drosophila male central nervous system connectome},
journal = {Cell},
year = {2026},
doi = {10.1016/j.cell.2026.08.015}
}MIT License.
- Janelia FlyEM Team
- MaleCNS connectome project
- neuPrint and FlyWire communities
- Researchers developing Gym, reinforcement learning and spiking neural network tooling
Built with I.S.A.A.C. — Intelligent Synthetic Autonomous Agent Companion.