Langevin Flows for Modeling Neural Latent Dynamics

Yue Song, T. Anderson Keller, Yisong Yue, Pietro Perona, Max WellingarXiv 2025 · DOI · arXiv

Abstract

LangevinFlow is a novel generative model that leverages physics-inspired stochastic differential equations—specifically the underdamped Langevin equation—to characterize the latent factors driving large-scale neural activity. By integrating physical priors such as inertia, damping, and oscillatory potentials into a Variational Auto-Encoder (VAE) architecture, the model effectively balances deterministic intrinsic dynamics with stochastic external influences. LangevinFlow demonstrates superior performance in predicting neural firing rates and capturing emergent biological phenomena like traveling waves, outperforming existing state-of-the-art deep learning methods on the Neural Latents Benchmark.

Introduction

When neuroscientists record from hundreds of neurons simultaneously, they observe coordinated patterns known as latent dynamics. These dynamics are driven by both the brain’s internal "programming" (intrinsic dynamics) and unobserved sensory inputs or random fluctuations (external stochastic influences). Existing models often struggle to balance these; some are overly rigid, while others lack the physical intuition necessary to model how biological systems evolve over time. LangevinFlow addresses this by integrating physics-based constraints within a modern deep learning framework to naturally model neural state evolution.

Methods

The core of LangevinFlow is a sequential VAE where the latent space is governed by the underdamped Langevin equation. This "physics engine" incorporates several key components:

  • Inertia (Mass): Provides momentum to the system, preventing unrealistic, jerky state jumps.
  • Damping (Friction): A force that stabilizes the system over time.
  • Potential Function ($U$): Parameterized as a network of locally coupled oscillators, this biases the model toward rhythmic, wave-like patterns common in the cortex.
  • Stochastic Forces: Random "kicks" representing unobserved external inputs.
The LangevinFlow architecture combines an RNN encoder, a latent flow governed by Langevin dynamics, and a one-layer Transformer decoder.

As shown in Figure 1, the architecture consists of a GRU-based RNN encoder that maps raw spike data to initial latent states. The latent flow then evolves these states forward in time according to Langevin dynamics. Finally, a one-layer Transformer decoder refines the firing rate predictions by capturing long-range dependencies across the entire sequence.

Results and Evaluation

The model was evaluated on synthetic data (Lorenz attractor) and the Neural Latents Benchmark (NLB), which includes diverse datasets from macaque motor, somatosensory, and frontal cortices.

Comparison of trial-averaged firing rates and spike rasters between ground truth and LangevinFlow across multiple neurons.

LangevinFlow achieved state-of-the-art performance on the NLB, specifically in co-smoothing bits per spike (co-bps) and forward prediction accuracy, surpassing models like AutoLFADS and Neural Data Transformers (NDT). On synthetic Lorenz data, it reached an $R^2$ of 0.944, outperforming competitors in reconstructing ground-truth firing rates. Furthermore, the model's latent variables proved highly effective for decoding physical behaviors, such as hand velocity, indicating their biological relevance.

Discussion and Key Insights

A significant advantage of LangevinFlow is its use of second-order dynamics, which includes velocity to produce smoother, more biologically plausible trajectories than standard first-order models. By designing the potential function as coupled oscillators, the model naturally recovers spatiotemporal traveling waves—a common cortical phenomenon rarely captured explicitly by latent variable models.

Future work may involve making the "energy landscape" (potential function) dynamic to respond to external cues and exploring more complex, non-linear parameterizations of these landscapes. While computationally more intensive than standard RNNs due to SDE integration, the use of a single-layer Transformer decoder helps maintain efficiency.

Summary updated

Abstract

Neural populations exhibit latent dynamical structures that drive time-evolving spiking activities, motivating the search for models that capture both intrinsic network dynamics and external unobserved influences. In this work, we introduce LangevinFlow, a sequential Variational Auto-Encoder where the time evolution of latent variables is governed by the underdamped Langevin equation. Our approach incorporates physical priors -- such as inertia, damping, a learned potential function, and stochastic forces -- to represent both autonomous and non-autonomous processes in neural systems. Crucially, the potential function is parameterized as a network of locally coupled oscillators, biasing the model toward oscillatory and flow-like behaviors observed in biological neural populations. Our model features a recurrent encoder, a one-layer Transformer decoder, and Langevin dynamics in the latent space. Empirically, our method outperforms state-of-the-art baselines on synthetic neural populations generated by a Lorenz attractor, closely matching ground-truth firing rates. On the Neural Latents Benchmark (NLB), the model achieves superior held-out neuron likelihoods (bits per spike) and forward prediction accuracy across four challenging datasets. It also matches or surpasses alternative methods in decoding behavioral metrics such as hand velocity. Overall, this work introduces a flexible, physics-inspired, high-performing framework for modeling complex neural population dynamics and their unobserved influences.
BibTeX
@misc{song2025langevin,
  author = {Yue Song and T. Anderson Keller and Yisong Yue and Pietro Perona and Max Welling},
  title = {{Langevin Flows for Modeling Neural Latent Dynamics}},
  year = {2025},
  eprint = {2507.11531},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2507.11531},
}
Figure