Vectorized Agent Based Simulation on GPUs

17 concepts14 papers

Traditional population and agent-based models (ABMs) treat individuals the way we see them in the real world: as discrete, independent entities. In code, this manifests as the object-oriented programming (OOP) paradigm, where each agent is an instance of a class containing its own unique properties, decision logic, and memory address.

While intuitive, this design creates a massive computational bottleneck. When simulating millions of interacting agents, a CPU must sequentially loop through these objects, chasing pointers across fragmented memory locations. Graphics Processing Units (GPUs) offer massive parallel processing power, but they are fundamentally designed for Single Instruction, Multiple Data (SIMD) architectures. When traditional OOP agents encounter conditional branching ("if-else" behaviors) or random memory lookups, the GPU's performance collapses due to thread divergence and uncoalesced memory access.

To unlock hardware acceleration, a paradigm shift is required: vectorized and tensor-based simulation. Instead of an array of agent objects, the entire world state is flattened into a set of contiguous tensors. Every step of the simulation is then reframed as a series of parallel mathematical operations—such as matrix multiplications, element-wise additions, and sparse matrix reductions—allowing hardware to update millions of entities simultaneously.


From Objects to Tensors: Flattening the State Space

The core intuition behind vectorized simulation is data-oriented design. If you group identical attributes together in memory rather than grouping different attributes within an object, the hardware can load and process data for thousands of agents in a single clock cycle.

Object-Oriented (Slow on GPU):
[Agent 1: Pos, Health, Vel] -> [Agent 2: Pos, Health, Vel] -> [Agent 3: Pos, Health, Vel]

Tensor-Based / Vectorized (Fast on GPU):
Positions Tensors: [Pos 1, Pos 2, Pos 3, ...]
Health Tensors:    [Health 1, Health 2, Health 3, ...]
Velocities Tensors:[Vel 1, Vel 2, Vel 3, ...]

By structuring data this way, execution times can remain nearly constant even as the number of simulated entities increases by orders of magnitude. In NeuralPlane: An Efficiently Parallelizable Platform for Fixed-wing Aircraft Control with Reinforcement Learning, Chuanyi Xue et al. demonstrated that representing agent states as tensors allows a platform to simulate one million aircraft simultaneously in a fraction of a second, providing the massive data throughput required by modern reinforcement learning algorithms.

This architectural shift is equally potent in multi-agent environments and games. In Neural MMO 2.0: A Massively Multi-task Addition to Massively Multi-agent Learning, David Bloomin et al. showed that transitioning from object-oriented game states to flattened tensor formats yields a multi-fold increase in simulation throughput, making large-scale multi-agent reinforcement learning experiments feasible on modest hardware.


Modeling Interactions via Graph and Tensor Calculus

If agents are merely rows in a matrix, how do they interact without relying on slow, nested loops? Vectorized architectures solve this by reframing physical or social interactions through the lens of graph theory and sparse linear algebra.

When agents interact—whether passing a virus, trading goods, or exerting physical forces—their relationships can be represented as a sparse adjacency matrix. In First 100 days of pandemic; an interplay of pharmaceutical, behavioral and digital interventions - A study using agent based modeling, Gauri Gupta et al. leveraged this formulation to simulate pandemic spread across millions of individuals, mapping complex behavioral and epidemiological interventions directly onto parallelized hardware.

Taking this concept to its logical conclusion, the authors of DeepABM: Scalable and Efficient Agent-Based Simulations Via Geometric Learning Frameworks - a Case Study For Covid-19 Spread and Interventions replaced traditional interaction logic entirely with geometric message-passing operations on Graph Neural Networks (GNNs). By executing these message-passing steps directly on GPUs, Ayush Chopra et al. simulated hundreds of millions of individual interactions in minutes rather than hours.

For physical systems where agents exert forces on their neighbors, tensor libraries allow these calculations to be batched efficiently. Andreas Hellander demonstrated in CBMOS: a GPU-enabled Python framework for the numerical study of center-based models that offloading pairwise force computations between biological cells to a GPU via tensor frameworks provides up to a 30x speedup over CPU implementations. Similarly, in cosmological contexts, Daniel J. Eisenstein et al. showed in A high-fidelity realization of the Euclid code comparison N-body simulation with Abacus that utilizing GPUs for near-field force calculations drastically accelerates N-body simulations by offloading the most computationally intensive steps to specialized hardware.


Accelerating Continuous Biophysical Dynamics

The benefits of vectorization extend beyond discrete agents to continuous biophysical systems governed by ordinary differential equations (ODEs) and cellular automata.

In systems biology, evaluating the state transitions of thousands of chemical pathways or cellular structures simultaneously is notoriously expensive. In SBMLtoODEjax: efficient simulation and optimization of ODE SBML models in JAX, Mayalen Etcheverry et al. introduced a method to convert standard biological models into high-performance JAX code. This enables the vectorized execution of ODEs on GPUs, allowing massive parameter sweeps and high-throughput exploration of complex biological networks.

This acceleration is crucial for spatial and multicellular modeling:


The Differentiable Frontier: Gradient-Based Calibration

Perhaps the most profound consequence of tensorizing a simulation is that the entire model becomes differentiable. When a simulation is constructed entirely out of standard tensor operations (using frameworks like JAX or PyTorch), modern automatic differentiation tools can track gradients through the simulation steps.

In traditional agent-based modeling, calibrating parameters to match real-world data requires running millions of brute-force, black-box parameter sweeps. In A differentiable model of supply-chain shocks, Sebastian Rene Towers et al. designed an economic agent-based model amenable to tensorization. Because the model is fully differentiable, researchers can use gradient descent to calibrate parameters and quantify uncertainties directly. This reduces calibration times from days to minutes, allowing large-scale simulations to adapt dynamically to real-world data shocks.

Similarly, this differentiability allows researchers to optimize complex biological networks using the exact same gradient-based techniques used to train deep neural networks, as shown by Mayalen Etcheverry et al. in their JAX-based ODE framework. When combined with advanced statistical sampling methods—such as the GPU-accelerated nested sampling software developed by Michael Stumpf in SYSBIONS: nested sampling for systems biology—differentiable, tensorized simulation bridges the gap between mechanistic modeling and deep learning.

History & citationVersion 1 · 2026-10-04

Current · Permanent link

View frozen version 1

Cite this direction

Latest version (a living page):

@misc{lacuna_vectorized_agent_based_modeling_063c280b,
  title = {vectorized agent-based modeling},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/vectorized-agent-based-modeling/rdr_063c280b481342ababe8984af895c129},
  note = {Latest version of a living research direction; cite a version for a fixed text. Accessed 2026-11-20},
}

This exact version (version 1, frozen text):

@misc{lacuna_vectorized_agent_based_modeling_063c280b_v1,
  title = {vectorized agent-based modeling},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/vectorized-agent-based-modeling/rdr_063c280b481342ababe8984af895c129/v/1},
  note = {Version 1, frozen 2026-10-04. Accessed 2026-11-20},
}

See something wrong? Report a mistake