Cleft Labs Research Initiative · C++20 / C ABI / Python · v0.1.0

Whole-brain spiking simulation in 7.0 milliseconds.

CleftEngine is a simulation engine for connectome-scale spiking neural networks: fixed wiring diagrams with 105–106 neurons and 107–108 synapses, in which most neurons are silent most of the time, simulated across many trials. On the Drosophila whole-brain model of Shiu et al. (2024) — 138,639 neurons and 15.1 million connections — one second of activity takes 7.0 ms on one CPU core (143× real time), and 30 trials finish in 60 ms on 4 cores (499× real time), matching Brian2 spike for spike.

FIG. 01 · LAZY PROPAGATION & PEAK BOUND Exact LIF + Exp. Synapse
v_thresh v_rest COLD · 0 GRID STEPS HOT · GRID t_ref peak bound < v_thresh 1 closed-form k-step jump input kick > 44 mV spike v (mV) time t (dt = 0.1 ms)
Because the subthreshold LIF dynamics are linear, an analytical upper bound decides whether a neuron can cross v_thresh before its next input. In the fly-brain benchmark, only 0.024% of neuron-steps are computed — an exact optimization, not an approximation.
Fly Brain · 1 Core
7.0 ms / s
143× real time on 138,639 neurons and 15.1 M synapses (537× faster than Brian2 Cython).
30-Trial Batch · 4 Cores
60 ms
499× real time total (2.0 ms/trial) on one shared immutable connectome; thread-count invariant.
Brian2 Equivalence
13,411 / 13,411
Every spike across 381 active neurons matches in step and neuron ID, in float64 and float32.
Dense AVX2 & Footprint
176 ms / s
5.7× real time dense (32-wide AVX2 + sparse ref bitmap); 16 B/neuron, 8 B/synapse, THP-aligned.
01 / Live 3D Brain Dashboard & Showcase

Real FlyWire whole-brain spiking telemetry, rendered and interactive.

CLEFTENGINE LIVE TELEMETRY · FLYWIRE FAFB v783 SUGAR-GRN ACTIVATION (1,000 ms) 138,639 NEURONS · 15.1M SYNAPSES · 100% BRIAN2 MATCH

Explore the live connectome directly in your browser.

Driven by authentic CleftEngine simulation output on the FlyWire FAFB v783 connectome (20 sugar-sensing GRNs at 150 Hz, 358 active neurons, 12,237 spikes, 1.86 M synaptic events). Orbit the 3D brain, toggle excitatory and inhibitory pathways, scrub the timeline, and inspect live v(t)/g(t) probes with exact cold-vs.-hot peak-bound detection — zero external CDNs.

02 / Architecture & Exact Integration

Three consequences of linear subthreshold dynamics.

01 · DIAGONALIZED PROPAGATOR

Exact closed-form eigen-stepping

The engine integrates the leaky integrate-and-fire neuron with an exponential current synapse in diagonalized (z, g) eigen-coordinates, eliminating cross-terms and shrinking each propagator entry to 8 bytes. A k-step jump reduces to two scalar multiplies, matching Brian2 spike for spike.

Float32 default · Float64 build (-DCE_DOUBLE)
Hot propagator table (k < 64) fits in 512 B of L1d
02 · PEAK BOUND

Cold neurons are skipped, not approximated

The closed-form free trajectory yields a strict analytical upper bound on the future membrane peak. Neurons whose bound lies below v_thresh remain cold and are brought up to date only when an event arrives; pure-inhibitory segments bypass wake checks altogether.

Fly-brain constants: kick > 44 mV to turn hot
0.024 % of neuron-steps computed in sugar-GRN run
03 · SIMD EVENT PATH

Cost scales with events, not network size

Synapses are stored in a delay-segmented CSR grouped by (pre, delay) so each spike queues one entry per distinct delay and streams targets through a 2-wide SIMD delivery loop. Across trials, worker threads share one immutable connectome while reusing thread-local workspaces.

Lazy: ~3 ns / synaptic event · THP-backed state
Dense AVX2: 32-wide f32 / 16-wide f64 + ctzll bitmap
Subthreshold ODE (per neuron class)

dv/dt = (v_rest − v + g) / τ_m      dg/dt = −g / τ_syn

Spike when v > v_thresh; reset v = v_reset, g = 0, frozen for t_ref. Tonic drive is expressed as v_rest > v_thresh.

Analytical Peak Bound (ρ = τ_syn / τ_m, φ0 = ρ1/(1−ρ))

u_max ≤ max(u, φ_0 · max(g, 0) + (1 − φ_0) · max(u, 0))

With u = v − v_rest. If u_max < v_thresh − v_rest, the neuron cannot spike before its next input and stays cold.

FIG. 02 · ENGINE EXECUTION PIPELINE Connectome CSR → Delay Wheel → Diagonalized SIMD Lazy Engine → Batch Workspaces
Swiss scientific architecture diagram of CleftEngine: immutable delay-segmented CSR connectome feeds timing wheels, 2-wide diagonalized (z,g) SIMD lazy delivery with pure-inhibitory fast path and analytical peak bound, and parallel multi-trial batch workspaces.
End-to-end data flow from static connectome construction to zero-allocation parallel trial execution. One read-only Connectome (118 MiB for FlyWire) is shared across concurrent worker threads, each owning a reusable Workspace.
03 / Empirical Benchmarks

Whole-brain throughput and lazy-vs.-dense scaling.

Drosophila Whole-Brain Model · Shiu et al. (2024)

138,639 neurons, 15.1 million connections

Reproducing the sugar-GRN activation experiment on the FlyWire FAFB v783 connectome (1 second of simulated biological time, dt = 0.1 ms, 20 sugar GRNs @ 150 Hz). Every row is a single CPU thread unless noted otherwise.

Configuration (1 s activity) Wall time vs. Real time
Brian2 2.10 (Cython, run phase) 4.10 s 0.24×
CleftEngine, dense AVX2 (f64 / f32) 349 / 176 ms 2.9× / 5.7×
CleftEngine, lazy f32 (1 thread) 7.0 ms 143×
CleftEngine, 30 trials · 4 threads 60 ms 499×

Hardware: 4 cores of AMD Ryzen 9 5950X (VM), GCC 13.3, -O3 -march=native. Load Parquet/CSV + Connectome build: 0.55 s. Fixed-input Brian2 parity run: 7.63 ms f32 (537× Brian2), 8.24 ms f64 (497× Brian2). Reproducible via bench/flywire.py and bench/compare_brian2.py.

FIG. 03 · WALL TIME PER SIMULATED SECOND Log scale (ms)
1× real time Brian2 Cython 4,100 ms CE dense (1T) 176 ms (5.7×) CE lazy (1T) 7.0 ms (143×) CE batch (4T) 2.0 ms/trial (499×) 1 ms 10 100 1,000 10,000 lower is faster (log10 wall time per simulated second)
Single-core lazy execution reduces wall time from 4.1 s to 7.0 ms (537× vs. Brian2 on the fixed-input reference). Trial batches reach 499× real time on 4 cores without duplicating the connectome.
Choosing a Backend · Random Balanced Network

Crossover at ~0.19 synaptic events per neuron-step

backend="lazy" scales with synaptic events; backend="dense" scales with neurons × steps via an adaptive AVX2 kernel. On a 100,000-neuron, 10 M-synapse network simulated for 500 ms (bench/synthetic.py), both backends produce identical spikes and cross over near 0.19 events/neuron/step:

Mean rate Events / neuron · step Lazy Dense
0.01 Hz 0.00009 0.2 ms 60.5 ms
0.04 Hz 0.0004 0.8 ms 62.0 ms
0.19 Hz 0.0019 3.4 ms 67.8 ms
0.97 Hz 0.0096 17.0 ms 86.0 ms
3.84 Hz 0.0383 75.5 ms 147.7 ms
19.18 Hz 0.191 482.9 ms 482.6 ms
Backend Crossover Estimator (dt = 0.1 ms) Break-even ≈ 0.19
Estimated load: 0.0055 ev / neuron · step Use backend="lazy"
FIG. 04 · LAZY VS. DENSE SCALING 100k neurons · 10M synapses
Log-log scaling plot comparing CleftEngine lazy and dense AVX2 backends across firing rates from 0.01 Hz to 19.2 Hz, crossing near 0.19 synaptic events per neuron and step.
Connectome models driven via sparse sensory pathways sit orders of magnitude to the left of the ~0.19 crossover. Inspect stats["n_syn_events"] / (n_neurons * stats["n_steps"]) on your workload.
FIG. 05 · OPTIMIZATION COMPARISON Baseline vs. Current
CleftEngine baseline versus current optimization comparison across FlyWire whole-brain and synthetic balanced network benchmarks.
FIG. 06 · MULTI-THREAD BATCH SCALING 30 × 1 s FlyWire Trials
Multi-thread throughput scaling on 30 FlyWire whole-brain trials across 1, 2, and 4 worker threads reaching 499x real time.
04 / Verification & Honest Limits

Checked against Brian2, sanitizers, and its own dense kernel.

VALIDATION · 46 TESTS · ASAN / UBSAN CLEAN

What is verified

  • Brian2, spike for spike: Random networks with heterogeneous delays, mixed E/I synapses, and multiple neuron classes match Brian2 identically in the float64 build.
  • Whole fly brain vs. Brian2: With fixed input spikes, all 13,411 spikes across 381 active neurons coincide in step and neuron ID for both backends, in float64 and float32.
  • Lazy vs. dense equivalence: Tested over random τsyn ≷ τm, thresholds, reset levels, tonic classes, and inhibition-dominated regimes. Weakening the peak bound by 10% causes tests to fail.
  • Exact step semantics: Matches three easy-to-miss Brian2 rules — refractory input is discarded, integration resumes at n + t_ref/dt, and same-step input at a spike is wiped by reset.
  • Thread-count determinism: Random streams are keyed to (seed, stimulus, neuron), so parallel trial batches are invariant to thread count.
CURRENT SCOPE & ROADMAP

Known limits

  • Single neuron family: LIF with exponential current synapse (g in mV), configurable per class. No conductance synapses, adaptation currents, gap junctions, or neuromodulation yet.
  • Static weights: No short-term or long-term synaptic plasticity; connectome weights are immutable during a run.
  • Trial-level parallelism: One simulation runs on one thread; parallelism is across trials and parameter sweeps. Fits connectome perturbations, not single ultra-dense networks.
  • CPU-only (x86-64 Linux): Built and tested with GCC 13 on x86-64 Linux. Dense networks past a few million fast-firing neurons belong on a GPU simulator.
  • Planned next: Additional linear models with peak bounds (alpha synapses, adaptation), SIMD hot-neuron pool, intra-run partitioning, and automatic backend switching.
05 / Build & Interfaces

Python / NumPy front end over a zero-dependency C ABI.

import numpy as np
import cleftengine as ce

# Connectome from edge lists (units: ms and mV; scalar or per-synapse delay)
net = ce.Network(n_neurons, pre, post, weight_mv, delay=1.8, dt=0.1)

result = net.run(
    1000.0,                                              # ms
    neurons=ce.LIF(),                                    # or list of classes + class_of=
    stimuli=[ce.Poisson(ids, rate_hz=150, weight=68.75, target="v")],
    silenced=[...],                                      # spike, but do not transmit
    probes=[12, 99],                                     # record v and g traces
    seed=1,
)
result.spike_times, result.spike_ids                     # ms, neuron index
result.rates                                             # Hz per neuron
result.probe_v                                           # [samples, probes], mV

# Parallel trial batch sharing one immutable connectome across all cores
trials = net.run_trials(1000.0, 30, stimuli=..., threads=0)
rates = ce.mean_rates(trials)

Zero External Dependencies

Core engine compiles cleanly with GCC/Clang in C++20 mode. The Python wrapper uses ctypes and NumPy — no PyTorch, CUDA, or build-time codegen required.

Precision Selection

precision="float32" is the default for speed; precision="float64" selects the double-precision build for bit-tight comparisons against reference simulators.

Built for Weightome

Designed alongside Weightome so structural synaptic weights measured from 8 nm 3D electron microscopy can be simulated directly at whole-brain scale.

06 / Licensing, Provenance & References

CleftEngine is part of Cleft Labs, an independent, privately funded research initiative dedicated to reproducible computational neuroscience and whole-brain emulation.

The CleftEngine source code is dual-licensed under AGPL-3.0-only OR PolyForm-Small-Business-1.0.0. You may use, modify, and distribute the software under either license at your option:

Open Research & Copyleft

AGPL-3.0-only

Free software with network copyleft. Academic, open-source, and derived works (including network services) are shared under the same license.

Small Business & Startups

PolyForm Small Business 1.0.0

Use without copyleft obligations for organizations with fewer than 100 people and under $1,000,000 USD (2019, CPI-adjusted) prior-year revenue.

For commercial enterprise use outside those terms, contact kontakt@cleftlabs.com. Consistent with Cleft Labs' charter, 100% of net proceeds from commercial licenses are reinvested into open connectomics compute, storage, and public research. The software license applies strictly to CleftEngine code and not to external connectome datasets (such as FlyWire FAFB v783).

  • 2024 Shiu, P. K., Sterne, G. R., Spiller, N. et al. A Drosophila computational brain model reveals sensorimotor processing. Nature, 634, 210–219.
  • 2024 Dorkenwald, S., Matsliah, A., Yu, S. C. et al. Neuronal wiring diagram of an adult brain (FlyWire FAFB v783). Nature, 634, 124–138.
  • 2019 Stimberg, M., Brette, R., Goodman, D. F. M. Brian 2, an intuitive and efficient neural simulator. eLife, 8, e47314.
  • 1999 Rotter, S., Diesmann, M. Exact digital simulation of time-invariant linear systems with applications to neuronal modeling. Biol. Cybern., 81, 381–402.
  • 2007 Brette, R., Rudolph, M., Carnevale, T. et al. Simulation of networks of spiking neurons: a review of tools and strategies. J. Comput. Neurosci., 23, 349–398.