Dynamical Similarity Analysis uniquely captures how computations develop in RNNs

Quentin Guilhot, Michał J Wójcik, Jascha Achterberg, Rui Ponte Costa · Submission to ICLR 2025 · Rejected

TL;DR

Evaluating representational alignment in dynamic neural systems is challenging because popular metrics like CKA and Procrustes analyze geometric shapes of neural traces rather than temporal vector fields. By designing controlled benchmarks around compositional learning in recurrent neural networks (RNNs) and simulated attractors, this paper shows that Dynamical Similarity Analysis (DSA) reliably tracks evolving computational motifs and connects them to task behavior. Furthermore, applying DSA to the modern Mamba state-space architecture reveals that unlike RNNs, Mamba solves simple cognitive tasks through a reservoir-computing-like mechanism.

What Problem Does This Paper Address?

Representational alignment metrics (such as Procrustes alignment and Centered Kernel Alignment, or CKA) are widely used in neuroscience and mechanistic interpretability to compare activations across architectures, layers, and biological brains. However, these metrics were originally developed for static inputs (e.g., images). When applied to time-varying tasks, they treat neural trajectories as static geometric curves, ignoring the "momentum" or underlying dynamical vector fields driving the computation.

Recent work shows that static metrics can latch onto computationally irrelevant signals in the neural null space. To make dynamic metrics dependable, researchers need well-characterized benchmarks with ground-truth expectations. This paper addresses this gap by creating controlled test cases based on simulated attractors and compositional learning in RNNs to systematically evaluate whether metrics truly track computational dynamics.

Methods

The authors compare three representational alignment metrics:

  • Centered Kernel Alignment (CKA) and Procrustes Transformation: Adapted from static representations by treating dynamic neural time-courses as flattened or concatenated geometric traces.
  • Dynamical Similarity Analysis (DSA): A dynamic-specific metric that delay-embeds time-series trajectories into higher-dimensional linear spaces to estimate and compare the underlying transition matrices (vector fields) of two dynamical systems.

To benchmark these metrics, the authors designed two test frameworks:

  1. Simulated Attractor Benchmark: Combines Lorenz attractors with varying levels of Gaussian noise and compositional blending ($A + B + \text{noise}$) to quantitatively measure noise robustness and response linearity.
  2. Compositional RNN Benchmark: Based on multi-task cognitive training where networks learn compound tasks (e.g., DelayAnti) by combining motifs from subtasks (Delay and Anti). Networks (Leaky RNNs and Leaky GRUs) were evaluated under different training regimens (untrained, partial pretraining with frozen weights, full pretraining, and unconstrained "Master" training).

Datasets

  • Synthetic Attractor Datasets: Generated numerical trajectories from Lorenz attractors ($\sigma = 10, \beta = 2.667$) with controlled additive Gaussian noise.
  • Neurogym Cognitive Tasks: Standard neuroscience behavioral tasks including the Delay task, the Anti task, and the compound DelayAnti (Master) task, where networks observe two continuous input modalities, fixate, remember stimuli across a delay, and make a decision rule-based choice.

Key Insights and Ideas

  • Vector Fields Truncate Spurious Geometric Noise: CKA and Procrustes struggle to isolate true computational motifs in the presence of noise because they align raw spatial configurations. DSA assesses dynamical operators (how state $x_t$ transitions to $x_{t+1}$), making it inherently more resilient.
  • DSA Uniquely Reflects Learning Hierarchies: When an RNN learns subtasks compositionally, its internal dynamics should systematically mirror the amount of shared subtask structure. DSA was the only evaluated metric that reproduced the expected ordinal similarity hierarchy: untrained networks were furthest from the fully trained Master network, partially pretrained networks were intermediate, and fully pretrained networks were the most similar.
  • Representations Directly Tied to Task Accuracy: DSA was the only metric whose representational dissimilarity significantly predicted task performance disparities across training checkpoints, establishing a concrete bridge between representation and behavioral computation.
  • Mamba Operates Like a Reservoir on Simple Tasks: Applying DSA to Mamba state space models (SSMs) showed that their internal hidden-state dynamics barely change from the untrained initialization. Instead, Mamba predominantly optimizes its readout MLP, behaving analogously to an Echo State / Reservoir Network for these cognitive tasks.

Key Results

  • Noise Robustness: DSA demonstrated the smallest dissimilarity gap under varying noise levels ($1.7 \times 10^{-2}$ for DSA vs. $4.5 \times 10^{-2}$ for CKA and $3.9 \times 10^{-2}$ for Procrustes).
  • Compositional Linearity: When linearly scaling the contribution of a secondary attractor, DSA exhibited the most linear decay in dissimilarity ($R^2 = 0.99$, compared to $0.96$ for CKA and $0.97$ for Procrustes).
  • Linking Dynamics to Behavior: Across 3,456 network comparison pairs during training, DSA dissimilarity positively correlated with task accuracy disparity ($b = 0.22, p = 3.3 \times 10^{-47}, R^2 = 0.12$). CKA and Procrustes showed no meaningful predictive relationship.
  • Mamba Dynamics: For Mamba, networks trained normally had internal dynamics indistinguishable from untrained models, whereas networks restricted to input-weight updates diverged significantly ($p = 2.7 \times 10^{-16}$).

Limitations and Future Work

  • Omission of Recent Vector-Field Metrics: Newer dynamic alignment methods, such as Diffeomorphic Vector Field Alignment (Dform), were not evaluated.
  • Coarse Behavioral Metric: Network behavior was summarized purely via task accuracy rather than detailed error patterns or psychometric response strategies.
  • Lack of Empirical Biological Data: The test cases rely strictly on synthetic attractors and artificial neural networks without validation against real in vivo neural recordings.
  • Theoretical Explanation: The paper demonstrates empirical superiority of DSA over CKA and Procrustes, but does not provide formal analytical proofs detailing the exact mathematical mechanisms behind the failure of geometric metrics.

Summary updated

BibTeX
@misc{guilhot2024dynamical,
  author = {Quentin Guilhot and Michał J Wójcik and Jascha Achterberg and Rui Ponte Costa},
  title = {{Dynamical Similarity Analysis uniquely captures how computations develop in RNNs}},
  year = {2024},
  eprint = {2410.24070},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2410.24070},
}
Figure