Abmax: A JAX-based Agent-based Modeling Framework
Siddharth Chaturvedi, Ahmed Elgazzar, Marcel van Gerven · 2025
Read Abmax: A JAX-based Agent-based Modeling Framework by Siddharth Chaturvedi, Ahmed Elgazzar, Marcel van Gerven (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2508-16508.txt.
Introduction
Siddharth Chaturvedi, Ahmed Elgazzar, and Marcel van Gerven put out ABMax in 2025, a method for agent-based modeling built on the JAX numeric library. Agent-based models mimic complex systems as crowds of interacting agents, and JAX can accelerate them enormously through vectorization and just-in-time compilation. The catch is that JAX demands array shapes that never change mid-model, while modelers constantly need to update a varying, dynamically chosen subset of agents in varied ways.
ABMax supplies just-in-time-compilable methods that deliver exactly that operation inside JAX's constraints, letting modelers apply distinct changes to dynamically selected agents without leaving the fast path. The authors show the method on the canonical predation model. The standard wolf-and-sheep style benchmark of the field, reporting runtime results there as evidence the method scales agent-based modeling to far larger groups.
Catalog record
| CREATOR | Siddharth Chaturvedi, Ahmed Elgazzar, Marcel van Gerven |
|---|---|
| YEAR | 2025 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 29 KB |
| VERSION | 1.0 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2508-16508
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
Abmax: A JAX-based Agent-based Modeling Framework Siddharth Chaturvedi, Ahmed Elgazzar, Marcel van Gerven Abstract Agent-based modeling (ABM) is a principal approach for studying complex systems. By decomposing a system into simpler, interacting agents, agent-based modeling (ABM) allows researchers to observe the emergence of complex phenomena. High-performance array computing libraries like JAX can help scale such computational models to a large number of agents by using automatic vectorization and just-in-time (JIT) compilation. One of the caveats of using JAX to achieve such scaling is that the shapes of arrays used in the computational model should remain immutable throughout the simulation. In the context of agent-based modeling (ABM), this can pose constraints on certain agent manipulation operations that require flexible data structures. A subset of which is represented by the ability to update a dynamically selected number of agents by applying distinct changes to them during a simulation. To this effect, we introduce Abmax, an ABM framework based on JAX that implements multiple just-in-time (JIT) compilable algorithms to provide this functionality. On the canonical predation model benchmark, Abmax achieves runtime performance comparable to state-of-the-art implementations. Further, we show that this functionality can also be vectorized, making it possible to run many similar agent-based models in parallel. We also present two examples in the form of a traffic-flow model and a financial market model to show the use case of Abmax. 1 1 1 Abmax is available at https://github.com/i-m-iron-man/abmax.git Keywords: Agent-based Models, JAX, Complex Systems 1 Introduction Complex systems are systems that are composed of many interacting parts. Examples of such systems include atoms in a molecule ( Testa and Bojarski 2000 ) , neurons in a brain ( Kulkarni and Bassett 2025 ) , companies in a market ( Foster 2005 ) , computers on the internet ( Park 2005 ) , or people in a population ( Rutter et al. 2017 ) . It is important to model, simulate, and analyze such systems to uncover the properties of complex phenomena that can emerge in them ( Kwapień and Drożdż 2012 ) . Examples are phase changes in matter, emergence of intelligence in brains, crashing of financial markets, spread of a computer virus through the internet, or spread of an infectious disease within a population. One of the main approaches to model and simulate such complex systems is to use agent-based modeling (ABM). In this approach, the many interacting parts of a complex system are treated as simpler, independent agents. The merit of using this approach lies in the fact that designing these agents individually and the rules by which they interact with each other is often easier than designing the entire complex system all at once. That is, complexity emerges as a function of these simpler interactions. This technique has already been used to design complex systems in many domains such as sociology ( Macy and Willer 2002 ) , ecology ( DeAngelis and Diaz 2019 ) , economics ( Samanidou et al. 2007 ) , urban planning ( Chen 2012 ) , neuroscience ( Ohsawa et al. 2018 ) , biology ( Pio-Lopez et al. 2023 ) , and computational chemistry ( Fortuna and Troisi 2010 ) . With the increased availability of compute power in the form of hardware accelerators such as GPUs and TPUs, it has become possible to simulate computational models of a large number of agents ( Xiao et al. 2019 ) . This helps to reduce the gap between these models and the actual phenomena they are trying to model. To facilitate agent-based modeling and simulation, various software frameworks have been developed. Notable examples are the Python-based Mesa framework ( Kazil et al. 2020 ) , the Julia-based Agents.jl framework ( Datseris et al. 2022 ) and the C ++ -based Flame-GPU framework ( Richmond and Chimeh 2017 ) . In this work, we introduce Abmax as a novel, generic Python-based ABM framework, combining ease of use with computational efficiency. The former is provided by an intuitive Python application programming interface (API), whereas the latter is provided by using JAX Bradbury et al. 2018 as the backend engine. JAX is a Python native high-performance array computing library that provides automatic vectorization across accelerators and just-in-time (JIT) compilation through simple decorators, allowing modellers to develop efficient large-scale models entirely in Python. This has been extensively showcased in the field of reinforcement learning ( Lu et al. 2022 ) and computational simulations of evolution ( Lange 2023 ) . Abmax provides the research community with these capabilities to support large-scale agent-based modeling. The structure of this paper is as follows. Section 2 introduces the Abmax API. Section 3 describes implementational details of how Abmax achieves efficient simulation of many-agent models with a dynamically varying number of agents. In Section 4 , we compare Abmax to other agent-based modeling frameworks and demonstrate scaling towards large-scale simulations. Finally, in the Discussion section, we present limitations and future work. 2 Abmax Abmax is an ABM framework based on JAX that provides a simple application programming interface (API) to design and simulate custom models. It relies on the flax.struct module from the Flax package ( Heek et al. 2024 ) so that all objects remain friendly to JAX transformations like jit and vmap . Abmax supplies helper classes - State , Params , and Signal , each of which can be defined using a Python dictionary whose leaves are valid JAX types. Although these classes are interchangeable from the compiler’s perspective, conceptually they serve different roles. A State object represents quantities that change every step, like position or energy of the agents. A Params object stores constants like time-step sizes or neural-network weights that remain fixed for multiple steps. Params is also meant to pass additional information to Abmax functions needed for execution. Objects of type Signal are meant to be used as messages that are passed between agents or between agents and the environment. Building on these helpers, the framework exposes three core classes that users inherit to define a model. First, a Policy represents the decision rule that agents follow to take actions in the environment. A Policy instance owns a State field for any internal memory needed by the rule, for instance, the hidden vector of a recurrent neural network (RNN), and a Params field to store, for instance, the RNN’s connection strengths and biases. Second, an Agent encapsulates a single actor or agent in the environment. An agent bundles three parts: its mutable State (like position, energy, etc.), its fixed Params (like vision radius, metabolism rate, etc.), and the policy it uses to act in the environment. Further, each agent carries a unique integer id for unique identification during the simulation, a type tag that classifies the agent (species, role, or cohort), and an age counter that can be incremented at every step to track its lifespan. Finally, a Set is a wrapper around a collection of Agents . It stores an array of Agent objects and two integers num_agents and num_active_agents that represent the maximum number of agents possible and the current number of agents in the set, respectively. Further, it also mirrors most of the fields held by a single Agent , including a State