Abstract
Whole brain network models are now an established tool in scientific and clinical research, however their use in a larger workflow still adds significant informatics complexity. We propose a tool, RateML, that enables users to generate such models from a succinct declarative description, in which the mathematics of the model are described without specifying how their simulation should be implemented. RateML builds on NeuroML's Low Entropy Model Specification (LEMS), an XML based language for specifying models of dynamical systems, allowing descriptions of neural mass and discretized neural field models, as implemented by the Virtual Brain (TVB) simulator. The end user describes their model's mathematics once and generates and runs code for different languages, targeting both CPUs for fast single simulations and GPUs for parallel ensemble simulations. High performance parallel simulations are crucial for tuning many parameters of a model to empirical data such as functional magnetic resonance imaging (fMRI). Specifically, while RateML can generate Python model code, it enables generation of Compute Unified Device Architecture C++ code for NVIDIA GPUs. The results reported in this manuscript show that with the CUDA code generated by RateML, it is possible to explore thousands of parameter combinations with a single Graphics Processing Unit, substantially reducing parameter exploration times and resource usage.
Introduction
Whole-brain network models (BNMs) are essential for understanding brain dynamics and personalizing treatments for neurological disorders. However, to make these models useful, researchers must "tune" them to match a specific patient's data, such as fMRI scans. This requires a "parameter sweep"—running thousands of simulations with slightly different settings to find the best fit.
The challenge is twofold: first, the computational complexity of running these simulations at scale requires high-performance computing (HPC) and GPU acceleration. Second, there is an expertise gap; most neuroscientists and clinicians are experts in biology and math, not CUDA programming or low-level hardware optimization. RateML bridges this gap by providing a tool that handles the heavy lifting of code optimization, allowing researchers to focus on the science rather than the software engineering.
Methods and Framework
RateML utilizes a declarative approach to modeling. Instead of writing simulation code, the user describes the model's mathematics using LEMS (Low Entropy Model Specification), an XML-based language. This uncouples the mathematical description from the hardware-specific implementation.
The tool uses the Mako templating library to parse these descriptions and generate executable code for two different backends:
- Python/Numba: Generates vectorized code for CPUs, ideal for fast single-run simulations and debugging.
- CUDA C++: Generates highly optimized code for NVIDIA GPUs. This backend creates a tailored "model driver" that manages memory and parallelization, allowing each GPU thread to handle a unique parameter combination.
Key Insights
- Abstraction as an Accelerator: By separating the mathematical equations from the GPU kernels, RateML allows for rapid prototyping. A researcher can change a single line of math in an XML file and immediately generate a new, optimized GPU solver.
- Memory Bandwidth Constraints: Simulations on GPUs are primarily limited by memory bandwidth rather than raw computational power. This is because models frequently fetch "delayed" states from memory to simulate signal travel time across the brain.
- Efficiency through Scale: GPU performance improves as the parameter space grows. Larger batches of simulations allow the GPU to better hide memory latency by keeping more processing cores busy while others wait for data.
Results
The authors validated RateML using several established neural mass models, including the Kuramoto Model, Reduced Wong-Wang Model, and Epileptor. Using a single NVIDIA A100 GPU, RateML successfully explored up to 144,000 parameter combinations for the Kuramoto model and 22,000 for the complex Epileptor model.
The tool demonstrates linear scaling; as the number of parameters increases, the execution time grows predictably. Furthermore, the generated CUDA code produced results with high fidelity, showing numerical differences smaller than $13.4 \times 10^{-5}$ relative to the simulation timestep compared to standard Python implementations.
Conclusion and Future Work
While RateML currently excels at grid searches on NVIDIA hardware, future work will focus on expanding hardware support (using SIMD and LLVM for CPUs) and integrating adaptive optimization frameworks like "Learning to Learn" (L2L). This will allow the tool to intelligently navigate parameter spaces rather than relying on brute force, further accelerating the research workflow for biologically realistic brain models.
Summary updated