Abstract
Latent variable models have been widely applied for the analysis of time series resulting from experimental neuroscience techniques. In these datasets, observations are relatively smooth and possibly nonlinear. We present Variational Inference for Nonlinear Dynamics (VIND), a variational inference framework that is able to uncover nonlinear, smooth latent dynamics from sequential data. The framework is a direct extension of PfLDS; including a structured approximate posterior describing spatially-dependent linear dynamics, as well as an algorithm that relies on the fixed-point iteration method to achieve convergence. We apply VIND to electrophysiology, single-cell voltage and widefield imaging datasets with state-of-the-art results in reconstruction error. In single-cell voltage data, VIND finds a 5D latent space, with variables akin to those of Hodgkin-Huxley-like models. VIND's learned dynamics are further quantified by predicting future neural activity, substantially outperforming current methods.
Introduction
In the field of neuroscience, researchers often attempt to interpret complex neural processes through limited experimental observations. Whether recording the voltage of a single neuron or the collective activity of thousands of cells via calcium imaging, the resulting data is typically a low-dimensional "shadow" of a much richer, high-dimensional, and highly nonlinear dynamical system.
Traditional methods for analyzing these neural time series often rely on Linear Dynamical Systems (LDS). While mathematically tractable, LDS models assume that the hidden state of the brain evolves linearly over time—an assumption that is biologically unrealistic. When researchers attempt to use nonlinear models, they frequently encounter the problem of intractable inference. In Variational Inference (VI), standard practice involves choosing a simplified approximate posterior (e.g., a standard Gaussian) to maintain mathematical feasibility. However, these simple approximations often fail to capture the underlying "flow" of the true dynamics, resulting in models with poor predictive capabilities.
The VIND Framework
To address these challenges, we introduce VIND (Variational Inference for Nonlinear Dynamics). VIND utilizes a "structure-sharing" approach where the approximate posterior $q(Z|X)$ mirrors the exact nonlinear structure of the generative model. This ensures that the recognition model is inherently aware of how latent states are expected to evolve.
Key Methodological Innovations
- Shared Evolution: The approximate posterior includes the same nonlinear transition terms as the prior, allowing the model to capture complex temporal dependencies.
- Laplace Approximation: Because the shared structure makes the distribution unnormalizable, VIND employs a Laplace approximation, fitting a Gaussian at the mode of the distribution.
- Fixed-Point Iteration (FPI): Finding the mode of the distribution is achieved through an iterative numerical method (FPI), as no closed-form solution exists.
- Locally Linear Dynamical Systems (LLDS): VIND can be implemented using dynamics that are "locally linear." In this setup, the system's behavior at any moment is linear ($z_{t+1} = A(z_t)z_t$), but the transition matrix $A$ varies based on the current position in the latent space.
Importantly, the entire process maintains $O(T)$ time complexity, scaling linearly with the length of the recording and making it practical for large-scale neuroscience datasets.
Experimental Validation
VIND was validated across four distinct scenarios, demonstrating its versatility and superior performance compared to existing methods.
Synthetic and Electrophysiology Data
Using a synthetic Lorenz System, VIND successfully recovered the chaotic "butterfly" attractor from noisy 10D observations. It maintained high accuracy ($R^2 > 0.9$) even 30 steps into the future, whereas standard linear models (GfLDS) failed almost immediately. In multi-electrode electrophysiology recordings, VIND effectively captured the dynamics of mice performing a delayed-discrimination task.
Single-Cell Voltage Recordings
In a "dimensionality expansion" task using data from the Allen Brain Atlas, VIND identified a 5D latent space as the optimal representation. This result is particularly compelling as it aligns with the classic Hodgkin-Huxley model, which utilizes four gating variables and one current variable to describe neuronal activity. VIND outperformed linear models by an order of magnitude in predictive Mean Squared Error (MSE).
Widefield Calcium Imaging
VIND was applied to large-scale "movies" of the dorsal cortex in mice. By learning the dynamics of the left hemisphere, the model was able to reconstruct the activity of the right hemisphere with an $R^2$ of 0.49, significantly surpassing baseline statistical methods.
Insights and Future Directions
A critical finding of this research is the value of forward interpolation as a performance metric. While standard reconstruction metrics ($R^2$) assess how well a model fits current data, forward interpolation tests the model's ability to predict future states without immediate observations. VIND excels in this area, capturing the underlying "flow" of neural dynamics rather than just the noise.
Furthermore, the use of a Poisson observation model for spikes encourages the discovery of smoother latent paths. While this may slightly reduce immediate reconstruction accuracy, it vastly improves the model's ability to predict future activity.
Future work will focus on extending VIND to incorporate external inputs (such as sensory stimuli) and labeled data, which will enable more controlled investigations into neural computation. For researchers seeking to uncover the nonlinear machinery beneath noisy neural data, VIND provides a mathematically rigorous and powerful new tool.
Summary updated