[SPDLearn] Geometric Deep Learning: Bridging Riemannian Manifolds and Standard Neural Workflows
SPD Learn: A Geometric Deep Learning Python Library for Neural Decoding Through Trivialization
SPDLearn is a specialized Python library for Geometric Deep Learning that provides a unified framework for Symmetric Positive Definite (SPD) matrix-based neural networks. It implements core SPD operators and layers—such as BiMap, ReEig, and SPDBatchNorm—using numerically stable spectral differentiation and trivialization-based parameterization to achieve SOTA performance in neural decoding tasks.
TL;DR
Learning from Symmetric Positive Definite (SPD) matrices (like covariance matrices) is crucial for neuroimaging and signal processing but suffers from implementation fragmentation. SPDLearn is a new Python library that unifies SPD operators using trivialization-based parameterization. This allows researchers to train manifold-constrained neural networks using standard Euclidean optimizers (like Adam) while maintaining numerical stability and geometric integrity.
Background: The Power and Pain of SPD Manifolds
In neural decoding (EEG/fMRI), covariance matrices capture essential spatial dependencies and second-order statistics. However, these matrices reside on a non-Euclidean SPD manifold. Traditional neural networks assume Euclidean geometry, and simply flattening a covariance matrix destroys its structural properties (positive definiteness and symmetry).
Previous SOTA attempts, such as the original SPDNet, required specialized Riemannian optimizers or fragile ad-hoc constraints. SPDLearn shifts the paradigm by treating the manifold as a mapping from a flat space, making geometric deep learning as easy as standard PyTorch coding.
Problem & Motivation: Why is Geometric Learning Hard?
The primary challenge is preserving the Positive Definiteness of parameters (like weights or batch norm biases) during gradient descent. If an eigenvalue hits zero or becomes negative, the model collapses. Prior works often used:
- Iterative Riemmanian Manifold Optimization: Computationally expensive and hard to integrate with standard deep learning libs.
- Ad-hoc Spectral Clipping: This can lead to unstable gradients and poor convergence.
The authors' insight is to use Trivialization. Instead of moving on the manifold, we optimize in a flat "shadow" space and map the result back to the manifold using a smooth function ().
Methodology: Trivialization & Stable Operators
1. Trivialization-based Parameterization
The core trick is the mapping .
- Stiefel Manifold (Weights): Used in BiMap layers (). SPDLearn uses Householder transformations or Cayley maps to ensure remains orthogonal without needing specialized optimizers.
- SPD Manifold (Bias): Used in SPDBatchNorm. A symmetric matrix is projected via eigenvalue transformations (Exponential or Softplus) to ensure strict positive definiteness.
2. Stable Spectral Differentiation
Standard matrix operations like Log(X) or Exp(X) are prone to gradient explosion when eigenvalues are close. SPDLearn implements a stable Loewner matrix formulation for backpropagation:
