arXiv:2610.09946cs.LGOct 2026

Manuscript Offprint

arXiv:2610.09946

Learning Traffic Flow Dynamics with Stochastic Physics-Informed Neural Cellular Automata

Federica Bragone, Matthieu Barreau

Abstract

Traffic flow modeling is essential for understanding and predicting the collective dynamics of vehicles on road networks. Cellular automata provide a simple, interpretable yet powerful framework for representing these dynamics via local interaction rules, while retaining the ability to reproduce complex macroscopic traffic phenomena. However, learning local transition rules from data while preserving physically meaningful constraints remains challenging, particularly for stochastic models. In this work, we propose a physics-informed neural cellular automaton (PI-NCA) for data-driven traffic flow modeling. Building on the standard neural cellular automaton (NCA), we design a neural architecture that is physically consistent with the road topology and guarantees conservation of the total number of vehicles, thereby constraining the learned transition rules to physically admissible dynamics. We further extend this framework to stochastic dynamics by parameterizing probabilistic transition rules while preserving the same physics-informed constraints. We evaluate the proposed models on multiple traffic scenarios generated by the well-established Nagel–Schreckenberg and Kerner–Klenov–Wolf cellular automata. The results demonstrate that the PI-NCA successfully learns the dynamics of both traffic models and consistently outperforms a standard NCA, while the stochastic extension captures probabilistic transition rules without compromising the imposed physical constraints.

Keywords: Neural Cellular Automata, Convolutional Neural Networks, Physics-Informed, Traffic Dynamics, Stochasticity

1. Introduction

Accurate traffic models are fundamental to simulating, forecasting, assessing, and controlling transportation systems. However, obtaining a high-fidelity simulator is challenging, as traffic flow is a dynamical system arising from interactions among individual vehicles and the surrounding road traffic conditions. Classic approaches consider various scales from microscopic modeling to macroscopic, with multiple parameters representing physical quantities [12]. However, determining these parameters is cumbersome because they are not readily measurable. In recent years, a data-driven paradigm has emerged to free from these parameter dependencies [51, 40, 5]. For instance, Machine Learning (ML) methods have gained increasing recognition for modeling traffic dynamics, including recurrent architectures like Long Short-Term Memory (LSTM) [48, 7], Convolutional Neural Networks (CNNs) [30, 11], and Graph Neural Networks [2]. Gomes et al. [14] provide a broader overview of ML approaches applied to traffic flow prediction.

Beyond classical data-driven approaches, Cellular Automata (CA) provide a relatively simple and computationally efficient way to model microscopic traffic. Traffic CA discretize space and time, where vehicle motion is governed by local physics-inspired transition rules applied simultaneously across the road. Even with simple rules, these models can produce non-trivial behaviors, including free flow, congestion, and wave dynamics. A key achievement in this field was the development of the Nagel-Schreckenberg (NaSch) model [33], which simulates freeway traffic using rules for acceleration, deceleration, random deceleration, and movement. This CA was the first to exhibit the empirically validated meta-stability phenomenon, in which the same road configuration could lead to either free flow or congestion [3]. Another well-known example is the Kerner-Klenov-Wolf Traffic Cellular Automaton (KKW-TCA) model [23], which represents the three phases of traffic flow, as described by Kerner in [19, 20, 21] with a limited number of simple rules. More recent traffic CA have extended these approaches to include more heterogeneous conditions. For example, Vranken et al. [47] developed a traffic CA to model traffic consisting of human-driven, automated, and communicating automated vehicles. Jing et al. [17] modeled mixed traffic flow by analyzing the driving behavior of connected automated vehicle platoons.

The main issue with CA is the complexity of the tuning tasks required to faithfully reproduce observations. Therefore, some works included data-driven models; for example, Shang et al. [42] used LSTM and SVM models to learn car following and lane changing behavior, respectively, from observed vehicle data and incorporated these learned behavioral components into a traffic CA. Interestingly, CA and CNNs share a local, spatially invariant structure across the spatial domain [26, 25, 24], suggesting that CA rules could be learned. Indeed, Gilpin [13] showed that any CA rule set can be represented and learned by a CNN architecture, highlighting that networks trained on simpler CAs develop hierarchical internal structures, whereas more complex CAs yield shallower networks. In [43], CA trajectories are treated as images, and CNNs are used to categorize their emergent pattern behavior into Wolfram classes [50] automatically. In [1], the authors show how CNNs can learn unseen rule sets for Conway's Game of Life. In [39], the authors use CNNs to identify behavioral classes in CA. Related research on Neural Cellular Automata (NCA) has further demonstrated how learnable local rules can generate and reproduce complex spatiotemporal patterns [31, 32, 37]. A combination of CA and neural networks has also been applied to traffic modeling. Chai and Wong [6] introduced a traffic model that combines a rule-based traffic CA with a pretrained artificial neural network to support vehicle lane-choice decisions. More recently, Yang and Jerath [52] used a CA traffic model to generate training data for a CNN–LSTM architecture for traffic flow prediction. In [53], the authors combined a labeled traffic CA based on three-phase traffic theory with Graph Neural Networks to classify traffic phases for traffic control applications.

These developments show promising results in how neural networks can complement CA to alleviate the heavy parameter-tuning task. However, in traffic, CA have mainly been used to generate data for training prediction or classification models, or used neural networks to learn only one specific part of the CA model. In contrast, less attention has been given to learning the local traffic transition rules directly from state trajectories and using the learned rules to simulate traffic dynamics. The ability of learned local rules to reproduce realistic traffic dynamics, such as preserving the number of vehicles, generalizing to unseen traffic conditions, and capturing both deterministic and stochastic behavior, has not been explored in depth. Building on these observations, we investigate whether NCA can learn microscopic traffic transition rules directly from simulated trajectories and reproduce vehicle dynamics and corresponding macroscopic traffic behavior.

To achieve this goal, we propose two models. The first is directly inspired by NCA with a specific neural architecture to represent realistic local behavior, in which a one-dimensional CNN learns the local transition rule and directly predicts the next traffic state. The second one, defined as Physics-Informed Neural Cellular Automata (PI-NCA), instead predicts the vehicles' velocities and explicitly updates their positions following the conservation law. We then extend the PI-NCA formulation to stochastic traffic dynamics by predicting categorical distributions over possible next vehicle velocities. In this way, the model learns and represents the probabilistic nature of the underlying transition rule. We evaluate the learned models via autoregressive rollout at both the microscopic and macroscopic levels, considering predictive accuracy, vehicle conservation, generalization to unseen traffic configurations, and reproduction of characteristic traffic flow behavior as metrics. We assess the framework on data generated using NaSch dynamics and, furthermore, on more complex interactions using the KKW-1 model [23], which introduces synchronization-based interactions and therefore provides more complex reference dynamics than the NaSch model.

References (51)