Skip to main content
QUICK REVIEW

[Paper Review] Fast Differentiable Matrix Square Root

Song Yue, Nicu Sebe|arXiv (Cornell University)|Jan 21, 2022
Advanced Vision and ImagingComputer Science5 citations
TL;DR

This paper proposes two fast differentiable matrix square root methods—Matrix Taylor Polynomial (MTP) and Matrix Padé Approximants (MPA)—for efficient forward computation, combined with an iterative Lyapunov solver for backpropagation. The approach achieves significant speedups over SVD and Newton-Schulz iteration while maintaining competitive performance in vision tasks.

ABSTRACT

Computing the matrix square root or its inverse in a differentiable manner is important in a variety of computer vision tasks. Previous methods either adopt the Singular Value Decomposition (SVD) to explicitly factorize the matrix or use the Newton-Schulz iteration (NS iteration) to derive the approximate solution. However, both methods are not computationally efficient enough in either the forward pass or in the backward pass. In this paper, we propose two more efficient variants to compute the differentiable matrix square root. For the forward propagation, one method is to use Matrix Taylor Polynomial (MTP), and the other method is to use Matrix Padé Approximants (MPA). The backward gradient is computed by iteratively solving the continuous-time Lyapunov equation using the matrix sign function. Both methods yield considerable speed-up compared with the SVD or the Newton-Schulz iteration. Experimental results on the de-correlated batch normalization and second-order vision transformer demonstrate that our methods can also achieve competitive and even slightly better performances. The code is available at \href{https://github.com/KingJamesSong/FastDifferentiableMatSqrt}{https://github.com/KingJamesSong/FastDifferentiableMatSqrt}.

Motivation & Objective

  • Address the computational inefficiency of SVD and Newton-Schulz iteration in deep learning frameworks, especially for batched matrix square root operations.
  • Overcome the instability and high cost of eigendecomposition in backpropagation due to eigenvalue differences.
  • Develop GPU-friendly, differentiable matrix square root methods that are both fast and numerically stable.
  • Enable efficient use of matrix square root in vision applications like covariance pooling and normalization layers.

Proposed method

  • Use Matrix Taylor Polynomial (MTP) and Matrix Padé Approximants (MPA) to approximate the matrix square root in the forward pass, replacing SVD or iterative methods.
  • Apply an iterative Lyapunov solver based on the matrix sign function to compute gradients efficiently during backpropagation.
  • Formulate the backward pass as solving a continuous-time Lyapunov equation, avoiding explicit eigendecomposition.
  • Integrate the methods into deep learning frameworks with minimal computational overhead, leveraging matrix multiplications well-optimized on GPUs.
  • Pre-normalize input matrices to improve convergence stability in iterative components.
  • Use mixed-precision training compatibility to enhance efficiency, especially for large models.

Experimental results

Research questions

  • RQ1Can MTP and MPA provide a faster and differentiable alternative to SVD for matrix square root computation in deep learning?
  • RQ2Does the proposed Lyapunov-based backward solver outperform traditional SVD and Newton-Schulz iteration in terms of gradient computation speed?
  • RQ3How do the proposed methods compare in accuracy and speed on real-world vision benchmarks like ZCA whitening and second-order vision transformers?
  • RQ4Can the methods maintain or improve performance while reducing training time and memory usage in large models?

Key findings

  • Our MPA-Lya method is 3.19× faster than Newton-Schulz iteration and 25.63× faster than SVD-Padé on the So-ViT-14 model.
  • The MTP-Lya method achieves the fastest forward pass at 2.36ms per matrix square root computation, outperforming SVD and NS iteration.
  • On CIFAR-100, MPA-Lya achieves 19.55% ± 0.20 validation error with 2.52ms inference time, outperforming SVD and NS iteration in speed and accuracy.
  • In second-order vision transformers, MPA-Lya converges in 254 epochs—fewer than SVD-based methods—while matching or slightly exceeding their top-1 accuracy.
  • The MTP-Lya method achieves comparable performance to SVD and NS on ResNet-18 but shows a slight drop on ResNet-50, likely due to approximation error accumulation.
  • The Lyapunov-based backward solver reduces matrix multiplications compared to NS iteration, leading to faster backpropagation.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.