[Paper Review] A differentiable brain simulator bridging brain simulation and brain-inspired computing
This paper introduces BrainPy, a differentiable brain simulator built on JAX that unifies brain simulation and brain-inspired computing by enabling differentiable, biophysically realistic spiking neural network simulations with efficient, scalable, and flexible support for multi-scale brain models. It achieves state-of-the-art efficiency and differentiability in training complex spiking models via JAX's automatic differentiation and custom sparse operators.
Brain simulation builds dynamical models to mimic the structure and functions of the brain, while brain-inspired computing (BIC) develops intelligent systems by learning from the structure and functions of the brain. The two fields are intertwined and should share a common programming framework to facilitate each other's development. However, none of the existing software in the fields can achieve this goal, because traditional brain simulators lack differentiability for training, while existing deep learning (DL) frameworks fail to capture the biophysical realism and complexity of brain dynamics. In this paper, we introduce BrainPy, a differentiable brain simulator developed using JAX and XLA, with the aim of bridging the gap between brain simulation and BIC. BrainPy expands upon the functionalities of JAX, a powerful AI framework, by introducing complete capabilities for flexible, efficient, and scalable brain simulation. It offers a range of sparse and event-driven operators for efficient and scalable brain simulation, an abstraction for managing the intricacies of synaptic computations, a modular and flexible interface for constructing multi-scale brain models, and an object-oriented just-in-time compilation approach to handle the memory-intensive nature of brain dynamics. We showcase the efficiency and scalability of BrainPy on benchmark tasks, highlight its differentiable simulation for biologically plausible spiking models, and discuss its potential to support research at the intersection of brain simulation and BIC.
Motivation & Objective
- To address the lack of a shared programming framework between brain simulation and brain-inspired computing (BIC) fields.
- To overcome the limitations of traditional brain simulators, which lack differentiability for gradient-based training.
- To bridge the gap between biophysical realism in brain simulation and the training efficiency of deep learning frameworks in BIC.
- To develop a unified, extensible, and scalable simulation environment that supports differentiable, event-driven, and multi-scale brain models.
Proposed method
- Leverages JAX and XLA for automatic differentiation and high-performance computation, extending its capabilities for brain dynamics simulation.
- Introduces custom sparse and event-driven operators to efficiently simulate large-scale, sparsely connected neural networks.
- Employs a modular, composable interface for constructing multi-scale brain models across neurons, synapses, and networks.
- Uses a novel abstraction for synaptic computations to handle diverse synaptic projections and dynamics in a flexible manner.
- Applies an object-oriented just-in-time (JIT) compilation approach to manage memory-intensive brain dynamics efficiently.
- Enables backpropagation through time (BPTT) in spiking networks using surrogate gradients and voltage regularization for stable training.

Experimental results
Research questions
- RQ1Can a unified framework be built that supports both biologically realistic brain simulation and differentiable training for brain-inspired computing?
- RQ2How can differentiability be efficiently integrated into high-fidelity brain simulators without sacrificing simulation performance or biophysical accuracy?
- RQ3To what extent can JAX-based frameworks like BrainPy scale to large-scale, event-driven, and sparse neural network simulations with differentiable dynamics?
- RQ4How does the integration of automatic differentiation in a brain simulator enable end-to-end training of spiking neural networks for cognitive tasks?
- RQ5What performance and scalability advantages does BrainPy offer over existing brain simulators and deep learning frameworks in hybrid brain simulation and BIC workloads?
Key findings
- BrainPy enables differentiable simulation of biologically plausible spiking neural networks using JAX’s automatic differentiation, supporting end-to-end training via backpropagation through time (BPTT).
- The framework achieves high efficiency and scalability on benchmark tasks, demonstrating performance suitable for large-scale brain network simulations.
- The use of surrogate gradients and voltage regularization allows stable training of spiking networks, with successful implementation of a delay-matching task in a spiking recurrent network.
- The rate-based model in BrainPy shows slower convergence, requiring dozens of training epochs to achieve high accuracy, highlighting the training challenges of rate-coded networks.
- BrainPy’s modular interface and custom sparse operators enable flexible, scalable, and memory-efficient simulation of multi-scale brain models across different levels of biological detail.
- The framework successfully bridges brain simulation and BIC by unifying model definition, simulation, and training within a single, extensible, and differentiable programming environment.

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.