Self-supervised contrastive learning performs non-linear system identification

Rodrigo González Laiz, Tobias Schmidt, Steffen Schneider

Contrastive learning isn't just for static representations; it can actually reverse-engineer the hidden rules governing time-series data. This paper introduces Dynamics Contrastive Learning (DCL), proving theoretically and empirically that adding an explicit dynamics model to a self-supervised learning framework allows us to uncover complex, non-linear latent dynamical systems from high-dimensional observations.

The Challenge of System Identification

In fields ranging from physics to neuroscience, researchers face the problem of system identification: trying to infer the hidden, underlying rules (latent dynamics) that generate a sequence of messy, high-dimensional observations.

While self-supervised contrastive learning (SSL) has become a dominant force in sequence modeling (e.g., Contrastive Predictive Coding, wav2vec), our theoretical understanding of why and how these models capture non-linear dynamics remains limited. The authors ask: Can standard contrastive learning actually identify the true underlying dynamical system? If not, what architectural changes are required to guarantee that the learned latent space and dynamics match the ground truth?

Dynamics Contrastive Learning (DCL)

Standard time-series contrastive learning compares the encoded representation of a current time step $h(y_t)$ with a future time step $h(y_{t+1})$. The authors propose modifying this by explicitly routing the encoded state through a learnable dynamics model $\hat{f}$ before the comparison. The model then minimizes an InfoNCE loss comparing the predicted future state $\hat{f}(h(y_t))$ to the actual encoded future state $h(y_{t+1})$.

The Dynamics Contrastive Learning (DCL) architecture, showing the explicit dynamics model $\hat{f}$ applied to the encoded state before the contrastive loss $\mathcal{L}$.

The authors mathematically prove that if the true dynamics are bijective, the observation mixing function is injective, and the system noise is Gaussian, DCL is guaranteed to recover the true latent space and dynamics up to an affine transformation.

One of the most surprising theoretical and empirical findings is that standard contrastive learning (using symmetric encoders without a dynamics model) cannot identify latent dynamics. It only succeeds if the system noise is so massive that it drowns out the actual dynamics. By simply inserting an explicit dynamics model into the contrastive pipeline, the model is forced to learn the actual transition rules, unlocking structural identifiability.

Modeling Complex Dynamics with $\nabla$-SLDS

To model complex non-linear dynamics in practice, the authors introduce a novel, parameter-free switching mechanism called Differentiable Switching Linear Dynamical Systems ($\nabla$-SLDS).

The $\nabla$-SLDS mechanism uses a bank of linear matrices and the Gumbel-Softmax trick to differentiably select the best linear approximation for the current state.

$\nabla$-SLDS shows that you don't necessarily need a massive RNN or Transformer to model non-linear dynamics in latent space. It uses a bank of linear matrices and the Gumbel-Softmax trick to differentiably select the best linear approximation for the current state, effectively modeling non-linear systems as piecewise linear. This approach works remarkably well and remains highly interpretable.

To handle systems with partial observability—where the mixing function is non-injective, violating the theoretical assumptions—they employ time-delay embeddings. By feeding multiple past time steps into the encoder, they can successfully restore injectivity.

Experimental Validation and Results

The authors evaluate their framework on a mix of synthetic and real-world data, including Linear Dynamical Systems (LDS), Switching Linear Dynamical Systems (SLDS), the chaotic Lorenz Attractor, and real-world 2-photon calcium imaging data from the mouse visual cortex (sourced from the Allen Institute).

  • Linear Dynamics: DCL with a linear dynamics model achieved a 99.0% $R^2$ score in recovering the true latent space, compared to just 73.5% for the baseline contrastive model without dynamics.
  • Non-Linear Dynamics: On the chaotic Lorenz attractor dataset, the baseline model failed entirely (41.0% $R^2$), while DCL equipped with the $\nabla$-SLDS model successfully recovered the latent space with a 94.1% $R^2$.
  • Handling Control Signals: DCL successfully disentangled intrinsic system dynamics from external control signals (like step functions or external linear inputs), maintaining >98% $R^2$ recovery.
  • Real-World Application: On the Allen Institute neural dataset, DCL with a linear dynamics model produced significantly more consistent, structured, and interpretable embedding spaces across multiple training runs compared to standard contrastive learning.

Limitations and Future Directions

While DCL offers a robust framework for system identification, it comes with theoretical constraints. The proof requires the mapping from latent states to observations to be injective. While the authors successfully use time-delay embeddings to bypass this in practice, it remains a formal theoretical limitation.

Additionally, the theory assumes Gaussian system noise. While they empirically show the model works with von Mises-Fisher (vMF) noise on a hypersphere, the formal proof is currently limited to the Normal distribution. Finally, the $\nabla$-SLDS model is a piecewise linear approximation; for highly complex, non-linear chaotic systems, scaling the matrix bank might become computationally expensive or insufficient compared to continuous non-linear models. Future work will likely focus on evaluating DCL on standardized real-world benchmarks for dynamics identification.

Summary updated

BibTeX
@inproceedings{laiz2025self,
  author = {Rodrigo González Laiz and Tobias Schmidt and Steffen Schneider},
  title = {{Self-supervised contrastive learning performs non-linear system identification}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=ONfWFluZBI},
}
Figure