Abstract
Simultaneous behavioral and electrophysiological recordings call for new methods to reveal the interactions between neural activity and behavior. A milestone would be an interpretable model of the co-variability of spiking activity and behavior across trials. Here, we model a mouse cortical sensory-motor pathway in a tactile detection task reported by licking with a large recurrent spiking neural network (RSNN), fitted to the recordings via gradient-based optimization. We focus specifically on the difficulty to match the trial-to-trial variability in the data. Our solution relies on optimal transport to define a distance between the distributions of generated and recorded trials. The technique is applied to artificial data and neural recordings covering six cortical areas. We find that the resulting RSNN can generate realistic cortical activity and predict jaw movements across the main modes of trial-to-trial variability. Our analysis also identifies an unexpected mode of variability in the data corresponding to task-irrelevant movements of the mouse.
Introduction
In neuroscience, "noise" is often as informative as the signal. Even when a well-trained animal performs the same task repeatedly, its neural activity and behavior vary due to fluctuations in attention, internal states, or task-irrelevant movements. Capturing this trial-to-trial variability is a major challenge. Existing methods typically fall into two categories: abstract generative models (like LFADS) that achieve high predictive accuracy using non-biological units, and biologically constrained models (RSNNs) that are interpretable but historically difficult to fit to complex, multi-session datasets.
Methods: The Trial Matching Framework
The authors developed a large-scale Recurrent Spiking Neural Network (RSNN) comprising 1,500 Leaky Integrate-and-Fire (LIF) neurons. The model adheres to biological constraints: neurons are either excitatory or inhibitory (Dale’s Law), and synaptic transmission includes realistic delays (2–4 ms).
The core innovation is the Trial Matching Loss Function. Standard training methods like Mean Squared Error fail when there is no 1-to-1 mapping between a random simulation and a specific recorded trial. To overcome this, the authors employed Optimal Transport (using the Hungarian algorithm or Sinkhorn divergence) to define a distance between the distribution of generated trials and the distribution of recorded trials. This allows the model to learn the overall "shape" of the data—capturing modes like "hits" versus "misses"—without requiring a direct correspondence between individual simulations and recordings.
Results
The framework was validated using both artificial and real-world datasets. The artificial dataset featured a two-area (sensory and motor) toy model designed to test the algorithm's ability to capture bimodal distributions.
As shown in the artificial data results, models without trial matching tend to produce a "noisy average" of the firing rates. In contrast, models using "hard" or "soft" trial matching successfully recover the distinct "Hit-like" and "Miss-like" firing modes.
When applied to large-scale electrophysiology from mice performing a whisker-tactile detection task (covering six cortical areas: wS1, wS2, wM1, wM2, tjM1, and ALM), the RSNN achieved:
- Realistic Firing Dynamics: The model reproduced log-normal firing rate distributions and single-neuron temporal dynamics (PSTHs).
- Superior Variability Capture: The trial-matched Pearson correlation reached 0.48, compared to 0.28 for models without the trial-matching loss.
- Behavioral Prediction: The model accurately predicted jaw movements and reproduced behavioral outcome distributions (e.g., ~66% hit rate).
Discussion and Conclusion
A key advantage of this approach is that the biologically constrained RSNN acts as a "plausibility filter." Unlike abstract models that might "solve" a task using non-biological parameters, the RSNN's performance is sensitive to realistic constraints like axonal delays. This makes it a powerful tool for testing circuit hypotheses.
Furthermore, the model discovered behavioral sub-modes unsupervised, such as "active" vs. "quiet" hits based on jaw movement intensity. While the current "template brain" approach averages across individual mouse differences, future work aims to use this framework to predict hidden network structures and causal interactions, potentially creating "digital twins" for in silico testing of interventions.
Summary updated