Abstract
Animal brains flexibly and efficiently achieve many behavioral tasks with a single neural network. A core goal in modern neuroscience is to map the mechanisms of the brain's flexibility onto the dynamics underlying neural populations. However, identifying task-specific dynamical rules from limited, noisy, and high-dimensional experimental neural recordings remains a major challenge, as experimental data often provide only partial access to brain states and dynamical mechanisms. While recurrent neural networks (RNNs) directly constrained neural data have been effective in inferring underlying dynamical mechanisms, they are typically limited to single-task domains and struggle to generalize across behavioral conditions. Here, we introduce JEDI, a hierarchical model that captures neural dynamics across tasks and contexts by learning a shared embedding space over RNN weights. This model recapitulates individual samples of neural dynamics while scaling to arbitrarily large and complex datasets, uncovering shared structure across conditions in a single, unified model. Using simulated RNN datasets, we demonstrate that JEDI accurately learns robust, generalizable, condition-specific embeddings. By reverse-engineering the weights learned by JEDI, we show that it recovers ground truth fixed point structures and unveils key features of the underlying neural dynamics in the eigenspectra. Finally, we apply JEDI to motor cortex recordings during monkey reaching to extract mechanistic insight into the neural dynamics of motor control. Our work shows that joint learning of contextual embeddings and recurrent weights provides scalable and generalizable inference of brain dynamics from recordings alone.
Introduction
A fundamental challenge in neuroscience is understanding how a single physical neural network—the brain—can reconfigure its internal dynamics to perform a vast array of tasks. While data-constrained Recurrent Neural Networks (dRNNs) have become a standard tool for modeling neural population dynamics, they are often limited to single-task scenarios. Traditional dRNNs typically assume a fixed set of connectivity weights for a specific behavior, making it difficult to capture the brain's inherent flexibility or to generalize across different behavioral contexts.
The Jointly Embedded Inference of Neural Dynamics (JEDI) framework addresses this limitation. By employing a hierarchical architecture, JEDI learns a shared embedding space that maps different behavioral contexts to specific RNN weights, allowing a single model to capture multi-task dynamics and reveal the underlying mechanistic rules of neural computation.
The JEDI Framework
The JEDI architecture consists of two primary components: a hypernetwork and a primary data-constrained RNN (dRNN).
- Hypernetwork: A multi-layer perceptron (MLP) that receives a "context vector" representing a specific trial or task. This network outputs the parameters for the primary RNN.
- Primary dRNN: This network reconstructs the observed neural trajectories. To ensure the model captures meaningful dynamical structures rather than over-fitting to noise, JEDI constrains the generated RNN weights to be low-rank ($J = MN^T$).
The system is trained end-to-end, jointly optimizing the contextual embeddings and the mapping to functional neural weights. This approach allows the model to find a unified representation of diverse tasks in a shared latent space.
Experimental Validation
The researchers evaluated JEDI using both synthetic and biological datasets:
- Synthetic "Teacher" RNN: A chaotic RNN driven by various signals (e.g., sine waves, ramps) to provide ground-truth multi-task dynamics.
- MemoryPro Task: A benchmark requiring the model to maintain a stimulus in memory and respond after a delay.
- Macaque Motor Cortex: Electrophysiological recordings from monkeys performing a "center-out" reaching task.
Results and Generalization
JEDI demonstrated high fidelity in reconstructing neural activity, achieving an $R^2$ of approximately 0.94 on complex multi-task data. Crucially, the model showed remarkable generalization capabilities. For instance, embeddings learned for a "sine wave" task naturally generalized to a "cosine wave" task, indicating that JEDI captures the underlying structural relationships between behaviors.
Beyond reconstruction, JEDI enables "reverse-engineering" of the brain's dynamics. By analyzing the eigenspectra of the generated weight matrices, researchers can observe how the stability and rotational velocity of neural populations change across tasks. In monkey motor cortex data, JEDI revealed a shift from stable dynamics during movement preparation to "marginal stability" (the edge of chaos) during execution, a state hypothesized to be optimal for complex motor control.
Discussion
JEDI represents a significant advancement in inferring brain dynamics from recordings alone. By learning a shared embedding space over recurrent weights, it provides a scalable and generalizable framework for multi-task modeling.
However, some limitations remain. The current implementation requires manual selection of the RNN's rank, and the model's accuracy is still constrained by the partial observability of neural populations in experimental data. Future work may involve adaptive rank selection and further refinement of the hierarchical architecture to handle even more diverse behavioral datasets. Ultimately, JEDI shifts the focus from merely mimicking neural activity to uncovering the fundamental dynamical rules that enable biological flexibility.
Summary updated