cs.LGNov 23, 2026

Physics-Constrained Neural ODEs for Learning Traffic Dynamics and Trajectories from Road Entry/Exit Times

Authors: Dennis Bogatov Wilkman, Karl Henrik Johansson, Matthieu Barreau

Organizations: Department of Decision and Control Systems, School of Electrical Engineering and Computer Science, Digital Futures, KTH Royal Institute of Technology, 100-44, Sweden

Abstract

We consider the problem of learning microscopic traffic dynamics and reconstructing vehicle trajectories from section entry/exit timestamps (EET) recorded by cameras and from the positions of a probe vehicle leading the platoon. The dynamics are difficult to recover as each vehicle's position is measured only at two points, and its trajectory between them is unknown. By combining Neural ODEs with a local density approximation, we learn a follow-the-leader model whose speed--density relation is a neural network. With such sparse data, an unconstrained network may learn physically unrealistic relations, such as negative speeds or non-zero speeds on a fully congested road. We therefore introduce a normalization that, applied to a monotone neural network with a learned regime change, enforces the endpoint conditions, guaranteeing an admissible speed--density relation while provably retaining the ability to approximate any admissible one. We validate the method on first- and second-order simulations, recovering the speed--density relation of the first-order model and reconstructing the trajectories of both models, with mean maximum position errors of 2.50m and 2.51m, respectively, on a 125~m road segment. On real-world ring-road data, the proposed model still yields an admissible relation, whereas both baselines violate the constraints; the large spread in the data, however, highlights the limitations of a first-order model with homogeneous driver behaviors.

Figures & tables

Explore similar work

May 5, 2026

Local Truncation Error-Guided Neural ODEs for Large Scale Traffic Forecasting

Spatiotemporal forecasting in physical systems, such as large-scale traffic networks, requires modeling a dual dynamic: continuous macroscopic rhythms and discrete, unpredictable microscopic shocks. While Neural Ordinary Differential Equations (ODEs) excel at capturing smooth evolution, their inherent Lipschitz continuity constraints inevitably cause severe over-smoothing when confronting abrupt anomalies. Recent physics-informed methods attempt to bypass this by penalizing numerical integration errors to enforce manifold smoothness. However, we mathematically reveal that such rigid regularization inherently triggers gradient conflicts and ``attention collapse,'' stripping the model of its sensitivity to anomalies. To resolve this continuity-shock dilemma, we propose Local Truncation Error-Guided Neural ODEs (LTE-ODE). Rather than treating numerical error as a nuisance to be eliminated, we innovatively repurpose the Local Truncation Error (LTE) as an unsupervised forward inductive bias. By mapping the LTE into a dynamic spatial attention mask, our architecture gracefully preserves high-precision continuous ODE evolution in stable regions, while adaptively triggering a discrete compensation branch exclusively at shock points. Trained purely end-to-end without manifold penalties, LTE-ODE achieves state-of-the-art performance on multiple large-scale benchmarks, exhibiting exceptional robustness against highly non-linear fluctuations. Furthermore, our ablation on integration steps demonstrates high deployment flexibility, allowing the model to seamlessly adapt to varying hardware memory constraints in real-world applications.
Sep 26, 2026

Neural ODEs Meet Concurrent Learning: Stable Online Learning with Lyapunov Guarantees

Neural ODEs learn dynamics from trajectory losses, but their adjoint gradients lack the regressor-times-parameter-error structure on which Lyapunov analyses of online adaptation rest, so training on streaming data comes without stability guarantees. We show that this structure is in fact present: the adjoint gradient decomposes exactly into a positive semi-definite trajectory operator acting on the parameter error plus a nonlinear perturbation with explicit, horizon-dependent bounds. A quadratic Lyapunov function then certifies online Neural ODE training over sliding windows under computable gain and horizon conditions, and the same certificate extends to stored data: its drift branch recovers concurrent learning, and its trajectory branch yields NODE-CL, a stored-segment Gauss-Newton method built on batched forward sensitivities that needs no state-derivative estimates. On four DeepMind Control Suite domains, NODE-CL attains the lowest median prediction error on three under velocity measurement noise, where observer-based concurrent learning degrades by up to 8x; with clean measurements it is best on the pendulum and within a factor of 1.6 of the best stored-data baseline on the cartpole and reacher.
May 11, 2026

Exact Fixed-Point Constraints in Neural-ODEs: Injecting Prior Knowledge into the Network Parameters

Neural ordinary differential equations (Neural-ODEs) learn a velocity field from data. Often, however, additional information on the target field is available, such as the location of some of its equilibria or, more generally, its values at given points. We introduce a method to inject this information directly into the parameters of a Neural-ODE, so that a finite set of prescribed fixed points holds exactly throughout training, with no penalty terms and no post-hoc projection. The output matrix is parametrized through the Moore-Penrose pseudoinverse, implemented by a thin QR factorization of the hidden features at the prescribed points. This splits the output matrix into a component determined by the constraints and a free one, which shapes the field away from the prescribed points without altering its values there. As a result, the constrained Neural-ODE remains a universal approximator of the continuous vector fields compatible with the constraints. We test the method on a two-dimensional Lotka-Volterra competition model with four equilibria. In vector field regression, the constrained model keeps the fixed-point residual at single-precision round-off, and its test error is up to about five times lower than that of an unconstrained network of the same architecture. A soft penalty on the equilibria lowers the residual only at the cost of accuracy, and still leaves it at least an order of magnitude above that of the constrained model. Trained to convergence on datasets of increasing size, the unconstrained and penalized networks saturate already on small datasets, while the constrained model keeps improving over a wider range. Close to the equilibria and over long time horizons, the constrained model is the most accurate at every dataset size considered. This also holds when the models are trained on observed trajectories, by backpropagation through the ODE solver.