Learning Interpretable Switching Dynamics in Shared Neural-Behavioral Latent Space

Yongxu Zhang, Josue Ortega Caro, Rachel L. Oren, Michael James Higley, Jessica Cardin, Anne Churchland, Shreya SaxenaNeurIPS 2026

TL;DR

Our brains generate a torrent of electrical chatter every millisecond, only a fraction of which actually steers what our bodies are doing right now. Switching Shared Latent Dynamics (SSLD) filters out internal background noise by isolating the exact space where brain activity and physical behavior intersect—and reveals how the rules governing that space abruptly shift as an animal switches from planning, to moving, to resting. It gives neuroscientists a clean, interpretable window into how neural circuits shift gears to drive action.

What Problem Does This Paper Address?

Modern neuroscience tools let us record hundreds of neurons firing while simultaneously tracking an animal’s every twitch and reach. Connecting the two, however, is like trying to figure out how a car’s engine turns the wheels while also listening to the radio, the air conditioning, and two passengers arguing. Most neural activity has nothing to do with immediate movement.

Until now, researchers mostly relied on two separate toolkits:

  1. Dynamical systems models, which look at how neural activity evolves and switches states over time. However, because they look at the brain in isolation, the "switches" they find might reflect arbitrary internal chatter rather than actual behavioral changes.
  2. Shared representation models, which align brain data and behavioral data into a common mathematical space. Yet, these typically treat the connection as static, ignoring how those shared patterns evolve and change rules as an animal transitions from, say, waiting for a cue to lunging for a treat.

SSLD bridges this divide: it isolates the brain-behavior overlap and explicitly models how its underlying dynamics switch across different behavioral phases.

Methods

SSLD is a variational autoencoder framework that splits incoming neural and behavioral time-series data into three distinct buckets, while applying a state-switching engine exclusively to the middle bucket.

Figure 1: Overview of Switching Shared Latent Dynamics (SSLD). Neural activity and behavior are encoded by separate Transformer-based encoders into a shared latent representation and modality- specific private latent variables. The shared latent is modeled with switching dynamics to capture behaviorally-relevant discrete dynamical regimes. The shared and private modality-specific latent representations are then used to reconstruct the corresponding neural and behavioral signals.

Here is how the pipeline works:

  • Separate Encoders & Disentangled Spaces: Two Transformer encoders take in neural recordings and behavioral tracking data, respectively. Linear layers then split these into three latent spaces: a private neural latent (brain activity unrelated to the measured movement), a private behavioral latent (movement nuances not captured by the recorded neurons), and a shared latent (where brain and behavior meet). To ensure the private and shared buckets don't leak identical information into each other, the authors penalize overlap during training—primarily by maximizing the Cauchy-Schwarz divergence between their distributions.
  • Switching Dynamics in the Shared Space (The Novel Twist): Rather than modeling dynamics across all brain activity, SSLD places a Switching Recurrent Neural Network (SRNN) strictly inside the shared latent space. At each time step, the model infers a discrete state (via Markov transitions) that selects a specific set of RNN weights. During training, known behavioral epochs act as a prior to guide these switches; at test time, SSLD infers the discrete state switches purely from the raw data.
  • Reconstruction: Finally, decoders stitch the shared latent back together with each modality's private latent to reconstruct the original neural and behavioral signals.

Datasets

The authors tested SSLD on one simulated dataset and four public experimental datasets (no new benchmarks were introduced, though they span an impressive variety of species and recording styles):

  • Monkey Reaching: Single-unit electrophysiology from motor/premotor cortex paired with hand kinematics and muscle activity across 27 reaching conditions.
  • Monkey Bump Task: Single-trial somatosensory cortex recordings paired with hand position, velocity, and arm force during active reaches and passive bumps.
  • Mouse Decision-Making: Widefield calcium imaging across 22 dorsal cortex regions paired with paw, nose, and tongue pose tracking.
  • Mouse Spontaneous Movement: Dorsal cortex widefield calcium imaging during unconstrained, natural behavior (locomotion, grooming, quiescence).

Key Insights and Ideas

  • Isolating the "private" brain reveals hidden housekeeping: When SSLD strips behaviorally relevant signals out of the monkey reaching data, the leftover private neural latent isn't just random static—it shows massive, clean rotational trajectories that look nearly identical across all 27 reaching conditions. This aligns beautifully with prior neuroscience findings that the largest signals in the motor cortex actually reflect when a movement happens (internal timing), not which movement is being made!
  • Brain-behavior dynamics visibly change shape across task phases: By plotting the RNN "flow fields" (which show where the shared state wants to drift next) and computing line-attractor scores, SSLD reveals distinct computational regimes. In monkeys, dynamics stabilize along a line attractor right after a "go" cue or during preparation, then relax during movement. In mice making decisions, stimulus onset triggers a stable line attractor—pointing to an evidence-accumulation mode in the cortex.
Figure 2: Reaching: Representative reconstructions of (A) neural activity and (B) behavior. Shared vs. private latent: (C) Behavioral information is mainly encoded in the shared and private behavioral latents, as assessed using a linear decoder (PN: private neural latent; PB: private behavior latent). Behavior decoding performance using latent and LSTM decoder is shown in Table H.1 (D) The shared-latent similarity matrix and condition similarity across the 27 reaching conditions. (E) Linear regression coefficients relating condition similarity to similarity in the shared latent, private neural latent, private behavioral latent, and raw neural activity, respectively (see Appendix F). Switching dynamics: (F) SSLD inferred discrete states align with task-defined behavioral epochs. Baselines include a supervised MLP and unsupervised methods (k-means and HMM). (G) Shared latent trajectories show structured organization across conditions. (H) Private neural latent trajectories show large rotational signals across conditions. (I) Flow fields of the RNN in distinct behavioral states, with line-attractor scores (LS) indicated in the titles, reveal state-dependent latent dynamics.
  • Linear alignment isn't enough: In ablation tests, classic linear Canonical Correlation Analysis (PCA-CCA) overfit on training data and collapsed on held-out test sets, demonstrating that the bridge between neural populations and physical movement is fundamentally nonlinear.

Key Results

  • State Alignment Accuracy: SSLD accurately recovered task-defined behavioral epochs on held-out test data, hitting 0.96 on Monkey Reaching, 0.99 on Monkey Bump, and 0.95 on Mouse Decision-Making. Even an unsupervised variant of SSLD (trained without behavioral state priors) scored 0.81 on Reaching, crushing unsupervised baselines like rSLDS (0.21) and HMMs (0.23). Unconstrained Mouse Spontaneous Movement proved tougher for all models, with SSLD leading at 0.51.
  • Clean Disentanglement & Geometry: Linear decoders confirmed that behavioral information ($R^2$) was packed into the shared and private-behavioral latents, while dropping to near zero (or negative) in the private neural latent. Furthermore, in the reaching task, the geometric similarity of SSLD's shared latent across conditions correlated at $r = 0.942$ with physical hand-path similarity—beating raw neural activity ($r = 0.745$).
  • Ablations: Removing the SRNN switching module caused state-alignment accuracy to plummet (e.g., from 0.96 to 0.51 in Reaching, and 0.95 to 0.44 in Decision-Making). Dropping behavioral observations during training similarly tanked behavioral decoding $R^2$ (e.g., from 0.80 to 0.31 in the Bump task).

Limitations and Future Work

  • Hungry for good labels: Supervised SSLD relies on well-defined discrete behavioral states and crisp behavioral tracking during training. In messy, naturalistic settings like spontaneous mouse behavior, state recovery noticeably degrades (0.51 accuracy).
  • No concept of outside surprises: SSLD treats brain-behavior coupling as a closed, internally driven loop. Even when a robotic arm physically bumped the monkey's hand in the Bump task, the model had no explicit mechanism to account for external inputs or causal perturbations.
  • Next steps: The authors plan to build input-driven and causal components into SSLD to handle external stimuli and perturbations, and aim to scale the framework to ingest raw behavioral video alongside neural data—positioning switching shared dynamics as a core building block for future neuroscience foundation models.

Summary updated

Abstract

Modern recording technologies enable simultaneous measurement of high-dimensional neural activity and rich behavioral variables, creating both an opportunity and a modeling challenge: identifying the shared latent structure that mediates the brain-behavior relationship and the underlying dynamics through which it evolves across behavioral states. Existing approaches focus on different parts of this challenge: shared representation learning methods identify neural-behavioral subspaces but typically do not model dynamical structure, while dynamical models capture temporal variation and discrete state transitions in neural activity, but do not explicitly disentangle shared neural-behavioral structure from modality-specific variability. We introduce Switching Shared Latent Dynamics (SSLD), a unified framework that learns a latent representation shared between neural activity and behavior and endows this shared space with nonlinear switching recurrent dynamics to reflect the hypothesis that behaviorally relevant neural representations exhibit structured dynamical changes across behavioral states. Complementary private latent variables capture modality-specific variability, providing a window into neural activity that does not directly interact with behavior. We evaluate SSLD on a simulated dataset and four diverse experimental datasets spanning species, brain regions, and recording modalities: monkey motor and premotor cortex during reaching, somatosensory cortex during a bump task, widefield calcium imaging across mouse dorsal cortex during (a) self-initiated decision-making and (b) spontaneous movements. Across all four datasets, SSLD accurately reconstructs neural and behavioral signals, recovers discrete states in the dynamics that align with experimentally defined behavioral epochs, and isolates behaviorally-relevant neural information in the shared latent while preserving private neural variability. Ablations confirm that shared representation learning, behavioral supervision, and switching dynamics each contribute to performance. SSLD offers an interpretable approach to modeling shared neural-behavioral dynamics that complements ongoing efforts toward foundation models for neuroscience.
BibTeX
@inproceedings{zhang2026learning,
  author = {Yongxu Zhang and Josue Ortega Caro and Rachel L. Oren and Michael James Higley and Jessica Cardin and Anne Churchland and Shreya Saxena},
  title = {{Learning Interpretable Switching Dynamics in Shared Neural-Behavioral Latent Space}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=ZI46yRLHVp},
}
Figure