Date: April 1-2, 2026 Author: edvatar (toroleapinc) Repo: https://github.com/toroleapinc/encephagen AI-assisted: Code development assisted by Claude (Anthropic). All experimental design, analysis, and interpretation by the author. All code reviewed, validated, and tested.
Encephagen investigates whether human brain macro-connectome topology alone — without region-specific parameters — produces emergent functional organization and supports biologically plausible learning.
Starting from real structural connectivity data (Human Connectome Project, 96 regions including subcortical), we built a spiking neural network brain and progressively tested: does topology create functional differentiation? Can the brain learn? Can it control a body?
| Paper | Year | What they showed | How we relate |
|---|---|---|---|
| Gollo et al. | 2015 | Rich-club nodes develop slower dynamics from identical Stuart-Landau oscillators on primate connectome | We extend with two-level decomposition + spiking neurons |
| Zamora-Lopez & Gilson | 2025 | Wilson-Cowan with identical params on human connectome shows regional variance/timescale diversity (J Neuroscience) | Most direct predecessor — published March 2025. We add degree vs wiring decomposition |
| Murray et al. | 2014 | Empirical timescale hierarchy across primate cortex (Nature Neuroscience) | Our spiking model reproduces this without heterogeneous parameters |
| Chaudhuri et al. | 2015 | Timescale hierarchy requires heterogeneous parameter gradient (Neuron) | We show topology alone produces a hierarchy (though less precise) |
| Cabral et al. | 2011 | FC from identical Kuramoto oscillators on human connectome (NeuroImage) | We add degree/wiring decomposition |
| Deco et al. | 2014 | Optimal SC-FC at bifurcation, homogeneous parameters (J Neuroscience) | We go beyond FC matching to functional identity |
| Honey et al. | 2007 | Neural mass models on macaque connectome vs rewired surrogates (PNAS) | Foundational — our work extends to spiking neurons |
| Váša & Mišić | 2022 | Null models in network neuroscience (Nature Reviews Neuroscience) | Methodological framework for our null model approach |
| Lappalainen et al. | 2024 | Drosophila connectome predicts function (Nature) | Inspiration — we test the same principle at human macro-scale |
| Brunel | 2000 | Balanced spiking network theory (J Comput Neurosci) | Our LIF parameter calibration follows this |
- Source: The Virtual Brain project (tvb-data package)
- URL:
https://raw.githubusercontent.com/the-virtual-brain/tvb-data/master/tvb_data/connectivity/connectivity_76.zip - Contents: 76×76 weights matrix, tract lengths, region labels, 3D coordinates
- Bundled at:
src/encephagen/connectome/bundled/tvb76_*
- Source: Same tvb-data package
- URL:
https://raw.githubusercontent.com/the-virtual-brain/tvb-data/master/tvb_data/connectivity/connectivity_96.zip - Includes: Thalamus (TM-F, TM-T, TM-OP × 2 hemispheres), Basal ganglia (Cd, Pu, Pa, Acc × 2), Amygdala (× 2)
- Bundled at:
src/encephagen/connectome/bundled/tvb96_* - Primary parcellation used in experiments 2-7
- File:
experiments/01_emergent_roles.py - Parameters: Wilson-Cowan, G=0.03, default WC params, identical everywhere
- Result: 1/4 predictions supported (P5 regional differentiation, var_cv=1.93). P2 (PFC sustained) marginally significant (p=0.047, ratio=1.04). P1 not testable (no thalamus in TVB76). P4 (frequency differentiation) not significant.
- File:
experiments/02_comprehensive.py - Parameters: Wilson-Cowan (w_ee=16, w_ei=12, w_ie=15, w_ii=3, theta_e=2.0, a_e=1.5), G=0.03
- Key results:
- P2 SUPPORTED: PFC tau=4.8ms vs sensory tau=0.6ms (p=0.01, 7.9x ratio)
- P5 SUPPORTED: variance_cv=3.03, tau_cv=1.07, freq_cv=0.50
- Real vs random differentiation: var_cv 1.93 vs 1.81 (p=0.0097)
- Basal ganglia: only region type maintaining oscillations at G=0.03-0.1
- File:
experiments/03_deep_analysis.py - Key finding — Silencing order:
G=0.015: Thalamus + Motor silence first G=0.020: Hippocampus + Sensory G=0.030: Other cortical G=0.050: Prefrontal Never: Basal ganglia - Null model comparison per prediction: PFC tau ratio (real=8.0x, random=7.8x) and BG variance ratio (real=108x, random=120x) are similar — degree distribution explains most.
- File:
experiments/04_isolate_topology.py - Parameters: G=0.01, 15 null instances per type
- Novel finding — Two-level decomposition:
- Level 1 (degree-driven, 24 significant metrics): Oscillation frequencies, variance hierarchy, time constants. Degree-preserving rewiring reproduces these. Erdős-Rényi does not.
- Level 2 (wiring-driven, 11 significant metrics): ALL are functional connectivity patterns. BG-sensory coupling (p=0.0001), hippocampus-motor decoupling (p=0.0001), hippocampus-thalamus coupling (p=0.025), sensory internal coherence (p=0.0005).
- Interpretation: Degree distribution creates the functional hierarchy. Specific wiring creates the communication patterns. Both emerge from identical parameters.
- Problem: LIF neurons either completely silent or fire at 430+ Hz. No intermediate regime.
- Root cause: Single synaptic current accumulator mixing E and I with averaged decay.
- Solution: Separate i_exc and i_inh tracking. Brunel (2000) calibration:
nu_ext = C_ext * nu_thr * ext_ratewherenu_thr = V_threshold / (j_eff * C_ext * tau_m). - Auto-scaling:
j_eff = j_exc * (16 / C_E)to maintain consistent behavior across population sizes. - Working parameters:
LIFParams(j_exc=2.0, g_inh=5.0),ext_rate=3.5,global_coupling=0.05
- Parameters: 200 neurons/region, C_E=16, j_eff=2.0mV, ext_rate=3.5, G=0.05
- Result: Mean=11.18 Hz, CV=0.224, biologically realistic
- Hierarchy (spiking):
sensory 12.43 Hz (most active) other cortical 11.67 Hz hippocampus 10.26 Hz thalamus 9.80 Hz motor 8.74 Hz basal_ganglia 8.47 Hz prefrontal 7.46 Hz (least active) - OPPOSITE of Wilson-Cowan (where BG was most active, sensory silenced)
- Spiking hierarchy matches biology better: sensory cortex fires fastest, PFC slowest (consistent with Murray et al. 2014 empirical hierarchy)
- Bottom regions: BG-Pa (5.5 Hz), PFCm (6.1 Hz), PHC (6.8 Hz) — exactly the regions known for low spontaneous rates in real brains
- File:
experiments/06_familiarity_learning.py - Protocol: Present pattern A 30 times with STDP, pattern B 0 times. Test both.
- STDP params: a_plus=0.005, a_minus=0.005, tau=20ms, applied every 10 steps
- Homeostatic: target_rate=10Hz, tau_homeo=500ms, eta=0.01
- Result — HABITUATION DETECTED:
Before learning: A response=2.38 Hz, B response=2.21 Hz (both novel) After learning: A response=2.38 Hz, B response=3.01 Hz Familiarity effect: -0.80 Hz (A weaker than B) - Interpretation: Repetition suppression — the brain responds less to familiar stimuli. This is a well-documented neurological phenomenon (Grill-Spector et al. 2006).
- Average weight change: 0.58 mV per region (~29% from baseline j_exc=2.0)
- Runtime: 22 minutes for full experiment
- File:
experiments/07_learn_to_stand.py - Architecture: toy20 connectome, 100 neurons/region, 2000 total neurons
- Body: MuJoCo 2-legged walker (4 joints: right/left hip/knee)
- Timing: 200 brain steps (20ms) per physics action, 4 physics steps (20ms)
- Learning: STDP every 50 brain steps, reward-modulated
- Reward: upright bonus + height + forward velocity - tilt - fall penalty
- Protocol: 10 baseline (no learning) → 50 learning → 10 test (retention)
- Result — BRAIN LEARNED TO STAND:
BASELINE AFTER LEARNING CHANGE Avg steps before fall 46.2 50.0 +3.8 Avg reward 46.2 59.9 +13.7 Avg height 0.73 0.81 +0.08 Fall rate 50% 0% -50% - Fall rate dropped from 50% to 0%. Reward increased by 30%.
- Learning curve: rapid improvement by episode 6-10 (already at 50 steps, 0 falls).
LIFParams(
tau_m=20.0, # Membrane time constant (ms)
v_rest=0.0, # Resting potential (mV, normalized)
v_threshold=20.0, # Spike threshold (mV)
v_reset=0.0, # Reset after spike (mV)
t_ref=2.0, # Refractory period (ms)
tau_syn_exc=5.0, # Excitatory synaptic time constant (ms)
tau_syn_inh=5.0, # Inhibitory synaptic time constant (ms)
j_exc=2.0, # Excitatory PSP amplitude (mV) — for C_E=16
g_inh=5.0, # Relative inhibitory strength
)SpikingBrain(
connectome=tvb96,
neurons_per_region=200, # 19,200 total
exc_ratio=0.8, # 80% excitatory, 20% inhibitory
internal_conn_prob=0.1, # 10% within-region connectivity
between_conn_prob=0.02, # 2% between-region (scaled by connectome weight × G)
global_coupling=0.05, # Between-region coupling strength
ext_rate=3.5, # External Poisson rate (× Brunel threshold)
)
# Auto-scaled: j_eff = j_exc * (16 / C_E)
# At these params: ~11 Hz mean firing, CV=0.22STDPParams(
a_plus=0.005, # LTP amplitude (0.003 for embodied learning)
a_minus=0.005, # LTD amplitude
tau_plus=20.0, # LTP time window (ms)
tau_minus=20.0, # LTD time window (ms)
w_max=10.0, # Maximum weight (mV)
w_min=0.0, # Minimum weight (mV)
)HomeostaticParams(
target_rate=10.0, # Target firing rate (Hz)
tau_homeo=500.0, # Slow time constant (ms)
eta=0.005, # Scaling rate per adjustment
)- Model: 2-legged walker (torso + 2×thigh + 2×shin + 2×foot)
- Joints: right_hip, right_knee, left_hip, left_knee (4 DOF)
- Actuators: 4 torque motors, gear=20, range [-1, 1]
- Sensors: 4 joint angles, 4 joint velocities, torso pos/quat
- Physics dt: 0.005s
encephagen/
├── src/encephagen/
│ ├── connectome/ # Connectome loading (from cortexlet/conntopo)
│ │ ├── loader.py # Connectome class
│ │ ├── parcellations.py # Region classification
│ │ └── bundled/ # TVB76 + TVB96 data files
│ ├── dynamics/ # Phase 1: Wilson-Cowan
│ │ ├── wilson_cowan.py # WC oscillator model
│ │ └── brain_sim.py # BrainSimulator (WC on connectome)
│ ├── neurons/ # Milestone 1: Spiking
│ │ ├── lif.py # LIFNeurons (vectorized, separate E/I)
│ │ └── population.py # RegionPopulation (balanced E/I)
│ ├── network/ # Milestone 1: Brain assembly
│ │ └── spiking_brain.py # SpikingBrain (Brunel-calibrated)
│ ├── learning/ # Milestone 2: Plasticity
│ │ ├── stdp.py # STDPRule (vectorized, sparse)
│ │ └── homeostatic.py # HomeostaticPlasticity
│ ├── sensory/ # Milestone 3: Input encoding
│ │ ├── visual.py # VisualEncoder (images → spikes)
│ │ └── auditory.py # AuditoryEncoder (audio → spikes)
│ ├── motor/ # Milestone 4: Output decoding
│ │ └── decoder.py # MotorDecoder (spikes → actions)
│ ├── environment/ # Milestone 4: World
│ │ └── grid_world.py # GridWorld (2D navigation)
│ ├── body/ # Milestone 6: Physics body
│ │ └── simple_body.py # SimpleBody (MuJoCo 2-leg walker)
│ ├── loop/ # Milestone 5+6: Closed loop
│ │ ├── closed_loop.py # ClosedLoopRunner (brain + GridWorld)
│ │ └── embodied_loop.py # EmbodiedLoopRunner (brain + MuJoCo body)
│ ├── analysis/ # Analysis tools
│ │ └── functional_roles.py # Region classification, predictions
│ └── viz/ # (placeholder for visualization)
├── experiments/
│ ├── 01_emergent_roles.py # Phase 1: TVB76 predictions
│ ├── 02_comprehensive.py # Phase 1: TVB96 + subcortical
│ ├── 03_deep_analysis.py # Phase 1: Silencing order + null comparison
│ ├── 04_isolate_topology.py # Phase 1: Degree vs wiring
│ ├── 05_spiking_hierarchy.py # Milestone 1: Spiking hierarchy test
│ ├── 06_familiarity_learning.py # Milestone 2: STDP habituation
│ └── 07_learn_to_stand.py # Milestone 6: Embodied learning
├── tests/ # 81 tests total
│ ├── test_brain_sim.py # Wilson-Cowan (10 tests)
│ ├── test_functional_roles.py # Analysis (3 tests)
│ ├── test_spiking.py # LIF + population + brain (13 tests)
│ ├── test_learning.py # STDP + homeostatic (14 tests)
│ ├── test_sensory.py # Visual + auditory (13 tests)
│ ├── test_motor_env.py # Motor + GridWorld (13 tests)
│ ├── test_body.py # MuJoCo body (10 tests)
│ ├── test_closed_loop.py # GridWorld loop (4 tests)
│ └── test_embodied_loop.py # MuJoCo loop (4 tests)
├── figures/ # Phase 1 figures
│ ├── fig1_phase_transition.png # Silencing order
│ ├── fig2_hierarchy_bar.png # 96 regions ranked
│ └── fig3_fc_comparison.png # Real vs random FC
├── scripts/
│ └── generate_figures.py # Figure generation script
├── results/ # Experiment outputs (gitignored)
├── RDP.md # Research Design Proposal v2
├── RDR-2026-04-01.md # This document
├── README.md # Project README with figures
└── pyproject.toml # Package config
Degree distribution determines the functional hierarchy (which regions are active, their time constants). Specific wiring determines functional connectivity patterns (which regions communicate). Separated using degree-preserving rewiring.
A specific ordering of region-type silencing as coupling increases: thalamus/motor → hippocampus/sensory → other cortex → prefrontal → basal ganglia (never). Not previously reported.
With identical LIF parameters, the spiking network produces sensory(12.5Hz) > thalamus > motor > BG > PFC(7.5Hz). This matches Murray et al. 2014 empirical hierarchy. Extends Gollo 2015 and Zamora-Lopez 2025 to spiking neurons.
Repetition suppression from STDP on a connectome-structured spiking network. The phenomenon is well-known; the context (human-connectome-topology spiking network) is new.
Experiment 7 claimed the brain learned to stand. Experiment 9 (control) invalidated this:
- STDP without reward modulation produces the same result (reward modulation adds nothing)
- Motor output torque std drops from 0.26 to 0.03 after STDP (motor death, not active control)
- The "0% fall rate" was the body standing stiff, not learned balance
Real connectome vs degree-preserving random wiring for embodied learning: no significant difference (reward 59.6 vs 60.7). The specific wiring pattern does not accelerate motor learning at this scale.
Why do Wilson-Cowan and spiking models produce OPPOSITE hierarchies on the same connectome? WC: BG most active, sensory silenced. LIF: sensory most active, BG least active. Until this is explained, "topology drives hierarchy" is not a defensible claim — it should be "the interaction between dynamics model and topology drives hierarchy." (Reviewer 2 feedback)
- 96-region parcellation is coarse. Glasser 360 or Schaefer 200 needed for validation. Results may not hold at finer scales.
- Only 15-20 null model instances. Need 500 minimum for robust statistics. Current p-values may not survive.
- No empirical FC comparison. Every paper in this tradition compares simulated FC against fMRI. This is conspicuously absent.
- Chaudhuri et al. (2015) is a challenge, not a predecessor. They showed that removing heterogeneous parameters eliminates the hierarchy — directly contradicting our "topology alone" claim. Must be framed as such.
- Degree-preserving rewiring preserves more than degree. Also preserves assortativity, rich-club structure. Need rich-club-specific null models to truly isolate degree.
- Spiking E/I balance breaks at C_E=80. j_eff auto-scaling is empirical, not principled. 200 neurons/region (C_E=16) is a different connectivity regime from biology (~C_E=1000).
- No conduction delays. At 6 m/s, a 120mm tract introduces 20ms delay — same timescale as STDP window.
- STDP learning rate too high. 29% weight change from 30 presentations is excessive. Likely an artifact.
- Familiarity effect has no statistical test. 0.80 Hz effect, N=1, no permutation test, no error bars.
- Embodied learning doesn't work. STDP produces motor death (constant torque output), not active motor control. Basic STDP is insufficient for motor learning — need e-prop or three-factor rules.
- Performance too slow for interactive use. 640x slower than real-time. Need Norse/NEST for Milestone 5+.
- "Miniature human brain" framing is not defensible. No cell-type diversity, no laminar structure, no neuromodulation, no dendritic computation. "Connectome-topology-driven emergence in spiking networks" is accurate.
Two rounds of expert panel review were conducted. Full feedback is documented separately. Key demands:
- Explain WC/spiking hierarchy inversion — this is the central scientific question
- Run two-level decomposition on spiking network (not just WC)
- Compare simulated FC against empirical HCP fMRI FC (Pearson's r, upper triangle)
- Increase null models to ≥500 instances
- Reframe Chaudhuri 2015 as "challenge" not "extension"
- Retire "miniature human brain" framing
- Remove/qualify OpenWorm/FlyWire analogy
- Add rich-club-preserving null model
- Statistical tests for familiarity: 20 runs with different seeds, permutation test
- Reduce STDP a_plus by 10x, verify habituation survives
- Compute autocorrelation timescales from spike trains (not just firing rates)
- Random connectome control (done — Exp 8, no difference)
- STDP without reward control (done — Exp 9, reward adds nothing)
- Frozen weights control (not done)
- 10x longer training (not done)
- Scale to TVB96 (not done, blocked by C_E=80 calibration)
- Explain the WC/spiking hierarchy inversion. Is it a WC sigmoid artifact? A Brunel calibration artifact? An operating-point-dependent interaction with topology? This requires a dedicated analysis, not a footnote.
- Run two-level decomposition on spiking network. Does degree-preserving rewiring reproduce the LIF hierarchy? If yes, the finding extends to a more biologically plausible substrate.
- Increase null models to 500 instances. Current 15-20 is a pilot.
- Compare simulated FC vs empirical HCP fMRI. Download HCP resting-state FC, compute Pearson's r. This is the standard validation in the field.
- Run familiarity experiment 20 times with different seeds. Compute mean ± SD, permutation test.
- Replace basic STDP with e-prop (Bellec et al. 2020) or three-factor rules (Frémaux & Gerstner 2016). Basic STDP is insufficient for motor control.
- Migrate to Norse (PyTorch spiking) or NEST for GPU acceleration. Current NumPy is too slow.
- Fix E/I balance at C_E=80 for 1000 neurons/region on TVB96.
- Test with Schaefer 200 parcellation to verify parcellation independence.
- Add conduction delays from TVB tract lengths.
# Clone and install
git clone https://github.com/toroleapinc/encephagen.git
cd encephagen
pip install -e ".[dev]"
conda install -c conda-forge mujoco # For embodied experiments
# Run all tests (81 tests, ~10 minutes)
python -m pytest tests/ -v
# Phase 1 experiments (Wilson-Cowan)
python experiments/01_emergent_roles.py # ~2 min
python experiments/02_comprehensive.py # ~5 min
python experiments/03_deep_analysis.py # ~15 min
python experiments/04_isolate_topology.py # ~10 min
# Spiking hierarchy
python experiments/05_spiking_hierarchy.py # ~30 min
# Learning
python experiments/06_familiarity_learning.py # ~22 min
# Embodied (includes negative results and controls)
python experiments/07_learn_to_stand.py # ~15 min (initial claim)
python experiments/08_topology_vs_random_embodied.py # ~50 min (null result)
python experiments/09_learning_control.py # ~30 min (invalidates Exp 7)
# Generate Phase 1 figures
python scripts/generate_figures.py- GPU: NVIDIA RTX 5070 (12 GB VRAM) — not used for computation (all NumPy/CPU)
- CPU: Intel Core Ultra 7 265 (20 cores)
- RAM: 16 GB
- OS: WSL2 on Windows, Ubuntu
# Clone and install
git clone https://github.com/toroleapinc/encephagen.git
cd encephagen
pip install -e ".[dev]"
conda install -c conda-forge mujoco # For Milestone 6
# Run all tests (81 tests, ~10 minutes)
python -m pytest tests/ -v
# Phase 1 experiments (Wilson-Cowan)
python experiments/01_emergent_roles.py # ~2 min
python experiments/02_comprehensive.py # ~5 min
python experiments/03_deep_analysis.py # ~15 min
python experiments/04_isolate_topology.py # ~10 min
# Milestone 1: Spiking hierarchy
python experiments/05_spiking_hierarchy.py # ~30 min
# Milestone 2: Familiarity learning
python experiments/06_familiarity_learning.py # ~22 min
# Milestone 6: Embodied learning
python experiments/07_learn_to_stand.py # ~15 min
# Generate Phase 1 figures
python scripts/generate_figures.py- GPU: NVIDIA RTX 5070 (12 GB VRAM) — not used for computation (all NumPy/CPU)
- CPU: Intel Core Ultra 7 265 (20 cores)
- RAM: 16 GB
- OS: WSL2 on Windows, Ubuntu
- cortexlet (https://github.com/toroleapinc/cortexlet) — Brain-topology-structured trainable PyTorch neural network. 98% MNIST accuracy, 45 tests. Not novel as ML contribution.
- conntopo (https://github.com/toroleapinc/conntopo) — Toolkit for connectome dynamics vs null models. Reproduces established findings (Honey 2007+). 27 tests. Value as open-source tool, not as discovery.