Amin Saberi
amnsbr.bsky.social
Amin Saberi
@amnsbr.bsky.social
Postdoc, Cognitive Neurogenerics Group at MPI-CBS & FZJ-INM7 | MD
aminsaberi.me
Thanks for reading! Do reach out to us if you plan to use cuBNM in your study, we are happy to help 🙂

And many thanks to @sofievalk.bsky.social, @sbe.bsky.social, @borismontreal.bsky.social, @wanb.bsky.social and all the collaborators on this project 🙏🏻

21/21
November 14, 2025 at 5:29 PM
I’m now a bit obsessed with GPUs 🤓 They have great potential for scaling up neuroimaging and neuroscience analyses 📈
Coming up next: GPU-accelerated neuroimaging meta-analyses (work in progress 🚧: github.com/amnsbr/nimar...)

20/n
GitHub - amnsbr/nimare-gpu: GPU-accelerated activation likelihood estimation meta-analysis (a GPU wrapper for NiMARE)
GPU-accelerated activation likelihood estimation meta-analysis (a GPU wrapper for NiMARE) - amnsbr/nimare-gpu
github.com
November 14, 2025 at 5:29 PM
This started as a small weekend curiosity and turned into a very fun project.
I learned a lot along the way, and I hope cuBNM helps others with their modeling studies.

19/n
November 14, 2025 at 5:29 PM
Community contributions are very welcome 🙌
If you’re interested to contribute new models, implement features, or help maintain the toolbox, visit the GitHub repo: github.com/amnsbr/cubnm

18/n
GitHub - amnsbr/cubnm: A toolbox for brain network modeling on GPUs
A toolbox for brain network modeling on GPUs. Contribute to amnsbr/cubnm development by creating an account on GitHub.
github.com
November 14, 2025 at 5:29 PM
A few technical details: The frontend is written in Python (for ease of use), but to optimize efficiency, the simulation core is written in CUDA and C++. And not just simulations, but also calculation of FC, FC dynamics and goodness of fit measures is done on GPUs 🚀

17/n
November 14, 2025 at 5:29 PM
As another example: An earlier version of this code was already used in our adolescent development study, where we found decreasing E-I ratio in association cortex with age:
www.science.org/doi/full/10....

16/n
Adolescent maturation of cortical excitation-inhibition ratio based on individualized biophysical network modeling
Individualized simulations reveal a decrease in excitation-inhibition ratio in association areas throughout adolescence.
www.science.org
November 14, 2025 at 5:29 PM
As examples of the utility of these individualized models, we investigated test-retest reliability and heritability of simulated (and empirical) measures in the HCP dataset, and found simulated features to be fairly reliable and heritable.

15/n
November 14, 2025 at 5:29 PM
This took a total of 1,426 hours on A100 GPUs (still considerable!) but multi-core supercomputer CPU nodes would have required 11x more time, 31x more cost and 14x more energy to do the same!

14/n
November 14, 2025 at 5:29 PM
A key advantage of cuBNM’s GPU implementation is to make it possible to fit large numbers of individualized BNMs, in batches!
To demonstrate this, we built individualized models for 430 HCP participants, running >28 million simulations.

13/n
November 14, 2025 at 5:29 PM
cuBNM also supports regional heterogeneity of parameters, using map-based and node-based approaches.
To demonstrate these approaches in the preprint, we applied them to fit group-level models of the HCP data, and as expected, found them to outperform the homogenous model.

12/n
November 14, 2025 at 5:29 PM
Two optimization approaches are included in cuBNM:
1️⃣ grid search
2️⃣ evolutionary optimizers (via pymoo, with CMA-ES as the featured method)
We demonstrate both in the preprint by fitting the rWW model to the group-averaged HCP data.

11/n
November 14, 2025 at 5:29 PM
cuBNM currently includes five commonly used models (with rWW model featured in tutorials and the preprint).
New models can be added via YAML model specification files. And a guide for contributing new models is included in the documentation.

10/n
November 14, 2025 at 5:29 PM
Check out our comprehensive tutorials cubnm.readthedocs.io/en/stable/tu... and read the preprint to learn how to 😊
And feel free to get in touch if you needed help.

9/n
Tutorials - cubnm documentation
cubnm.readthedocs.io
November 14, 2025 at 5:29 PM
Using cuBNM, if you have access to a few GPUs*, you can quickly and easily create individualized BNMs for your own dataset. All you need is: resting-state BOLD & structural connectivity (from each subject’s DWI, or a template SC).

* CPUs are also supported, but are not our focus.

8/n
November 14, 2025 at 5:29 PM
Why are GPUs so much faster?
GPUs are designed for parallel processing, so computations across both *simulations* and *nodes* can be massively parallelized 🧠⚙️

7/n
November 14, 2025 at 5:29 PM
GPU implementation also makes it feasible to simulate denser networks with thousands of nodes: Compute time with number of nodes increases near-quadratically on CPUs, but near-linearly on GPUs.

6/n
November 14, 2025 at 5:29 PM
On GPU, compared to single-core CPU, simulations can run up to 1000+ times faster (typically: 400-800x faster).
For example, running 32,768 simulations would take 3.8 *days* on a single-core CPU, but only 5.6 *minutes* on a data-center A100 GPU ⚡

5/n
November 14, 2025 at 5:29 PM
So we thought: why not use GPUs to parallelize simulation calculations and make them faster? We tried it, and … it paid off really well 🥳Then we turned it into the cuBNM toolbox!

4/n
November 14, 2025 at 5:29 PM
We experienced this directly during my PhD work on adolescent maturation of E-I ratio. We needed to fit individualized models for several hundred subjects, using more complex models, and quickly ran into the limits of CPU-based implementations.

3/n
November 14, 2025 at 5:29 PM
Brain network models (BNMs) are great tools for investigating latent neural properties at micro-/mesoscale (such as excitation-inhibition ratio) using simulations. Despite their usefulness, the computational cost of simulation has limited their application at larger scales.

2/n
November 14, 2025 at 5:29 PM