Clear Sky Science · en
Unifying non-Markovian dynamics and agent heterogeneity in scalable stochastic networks
Why randomness and memory matter
Many of the systems that shape our lives—from immune cells fighting infection to people mingling at a conference or trades in financial markets—evolve in unpredictable ways. Researchers use mathematical “stochastic” models to capture this randomness, but most popular tools assume that all actors are identical and have no memory of the past. This paper introduces a new framework, called MOSAIC, that breaks free from those assumptions, letting each individual follow its own internal rhythm and history while still keeping simulations fast enough to run on a single computer.
Randomness beyond forgetful systems
Classical simulation methods, such as the widely used Gillespie algorithm, treat complex systems as if the chance of an event depends only on what is happening right now, not on how long it has been since something last occurred. This “memoryless” view works mathematically and is efficient to compute, but real systems rarely behave that way. Cells have internal programs that unfold over minutes or hours, people show bursts of activity followed by quiet stretches, and interactions often depend on who met whom earlier. When these memory effects and individual differences are ignored, models can miss important features seen in data. Existing attempts to add memory or diversity usually become slow or unwieldy, especially when there are many interacting agents.

A new way to simulate diverse individuals
MOSAIC (Modeling of Stochastic Agents with Individual Complexity) tackles this challenge by treating every possible event—such as a cell division, a molecule reaction, or a social contact—as its own process with a personal clock. Instead of constantly updating the exact rate of every process, MOSAIC keeps track of a single upper bound on how fast anything can happen. At each step, it advances time, picks a candidate process at random, and then decides whether that event actually occurs based on its current likelihood. This “rejection sampling” trick ensures that events fire with the correct probabilities while avoiding the heavy bookkeeping that slows other approaches. Crucially, each process can have its own waiting-time pattern, including realistic long-tailed or tightly peaked delays, and can respond to changing conditions or agent traits without sacrificing speed.
Putting the framework to the test
To show what MOSAIC can do, the authors apply it to three very different problems. First, they model how B cells in the immune system compete for help from a small pool of T cells. Individual B-cell families differ in how strongly they bind to a target, and higher-affinity families gradually dominate. Standard methods must track an enormous number of potential B–T pairings; MOSAIC instead samples possible encounters and accepts only those where a stronger competitor can displace a weaker one. This reproduces observed patterns of “winner” clones while keeping computing time nearly constant as the system grows. Second, they study a gene called Hes1, which turns itself off through a delayed negative feedback loop. Here, RNA molecules are produced, slowly elongated, and then translated into protein, with the delay and speed depending on how crowded the system is. MOSAIC naturally handles these state-dependent, non-exponential delays, capturing realistic oscillations in RNA and protein levels that older delay-based tools cannot update once a delay has started.

Following shifting social ties over time
The third test turns to human behavior: face-to-face contacts among hundreds of people at a scientific conference. In this setting, people alternate between long periods of inactivity and brief, intense bursts of conversation, and they are more likely to talk again with people they have already met. The authors extend their framework to temporal networks, calling the variant MOSAIC-TN. Each person carries an internal clock that governs how soon they are likely to start a new interaction, and pairwise encounters depend on both partners’ activity and their past history together. With only a few ingredients, MOSAIC-TN reproduces the heavy-tailed patterns of how long people wait between conversations, how long interactions last, and how tightly the social network clusters—matching real data better than competing models while retaining good computational scaling.
What this means for complex systems
In everyday terms, MOSAIC shows that it is possible to simulate large, messy systems where individuals have their own quirks and memories without needing supercomputers or oversimplified assumptions. By marrying the mathematical rigor and speed of classic stochastic algorithms with the flexibility of agent-based models, it provides a common language for studying systems as varied as germinal centers, gene regulatory circuits, and social gatherings. The key message is that individuality and history are not optional extras: they can be built directly into efficient simulations, offering a more faithful picture of how diverse actors and their memories combine to shape collective behavior.
Citation: Pélissier, A., Phan, M., Le Bail, D. et al. Unifying non-Markovian dynamics and agent heterogeneity in scalable stochastic networks. Nat Commun 17, 3345 (2026). https://doi.org/10.1038/s41467-026-69817-y
Keywords: stochastic simulation, non-Markovian dynamics, agent-based modeling, temporal networks, immune and gene regulation