Skip to main content
QUICK REVIEW

[Paper Review] McTorch, a manifold optimization library for deep learning

Mayank Meghwanshi, Pratik Jawanpuria|arXiv (Cornell University)|Oct 3, 2018
Human Pose and Action RecognitionComputer Science22 references24 citations
TL;DR

McTorch is a PyTorch extension that enables manifold-constrained optimization in deep learning by integrating Riemannian optimization capabilities directly into the PyTorch framework. It allows users to constrain model parameters to manifolds such as Stiefel (orthogonal matrices) and PositiveDefinite (symmetric positive definite matrices) using a modular design that decouples manifolds from optimizers, enabling seamless use with standard PyTorch modules and optimizers like SGD and Adagrad.

ABSTRACT

In this paper, we introduce McTorch, a manifold optimization library for deep learning that extends PyTorch. It aims to lower the barrier for users wishing to use manifold constraints in deep learning applications, i.e., when the parameters are constrained to lie on a manifold. Such constraints include the popular orthogonality and rank constraints, and have been recently used in a number of applications in deep learning. McTorch follows PyTorch's architecture and decouples manifold definitions and optimizers, i.e., once a new manifold is added it can be used with any existing optimizer and vice-versa. McTorch is available at https://github.com/mctorch .

Motivation & Objective

  • To bridge the gap between deep learning frameworks and manifold optimization by extending PyTorch with native manifold support.
  • To lower the barrier for researchers and practitioners to apply manifold constraints—such as orthogonality and positive definiteness—in deep learning models.
  • To enable seamless integration of manifold-constrained layers and optimizers within PyTorch’s dynamic computation graph and autograd system.
  • To support efficient, GPU-accelerated Riemannian optimization by reusing PyTorch’s tensor operations and computational graph.
  • To provide a modular, extensible library that allows new manifolds and optimizers to be added independently and reused across models.

Proposed method

  • Extends PyTorch’s Parameter class to accept a manifold specification, enabling initialization of parameters on a manifold and tracking of Riemannian gradients via the rgrad attribute.
  • Introduces a Manifold base class with abstract methods for key Riemannian operations: rand (random point generation), retr (retraction for tangent vector mapping), and egrad2rgrad (conversion of Euclidean gradient to Riemannian gradient).
  • Modifies existing PyTorch optimizers (e.g., SGD, Adagrad, ConjugateGradient) to use Riemannian gradients and apply retraction-based updates instead of Euclidean updates.
  • Introduces a ManifoldShapeFactory to generate manifold objects compatible with layer weight shapes, ensuring initialization adheres to manifold constraints.
  • Integrates manifold-constrained linear and convolutional layers (Linear, Conv1d, Conv2d, Conv3d) via a new weight_manifold attribute in the layer definition.
  • Implements all numerical operations using PyTorch’s tensor API, ensuring full support for CPU and GPU computation and end-to-end differentiability.

Experimental results

Research questions

  • RQ1How can manifold optimization be efficiently and seamlessly integrated into the PyTorch deep learning framework?
  • RQ2Can a modular design decoupling manifolds from optimizers enable flexible and extensible use of Riemannian optimization in deep learning?
  • RQ3To what extent does McTorch support common deep learning operations such as backpropagation and GPU acceleration while maintaining strict parameter feasibility on manifolds?
  • RQ4How does McTorch enable practical applications of manifold constraints—such as orthogonal weight initialization—in standard deep learning architectures?
  • RQ5What is the feasibility and performance of using McTorch for training models with constraints like orthogonality or positive definiteness in real-world deep learning tasks?

Key findings

  • McTorch successfully extends PyTorch to support manifold-constrained optimization with minimal changes to existing code, enabling users to constrain layer weights to manifolds like Stiefel and PositiveDefinite with a single parameter attribute.
  • The library maintains full compatibility with PyTorch’s autograd system, ensuring that backpropagation correctly computes Riemannian gradients through the egrad2rgrad transformation.
  • Optimizers such as Adagrad and SGD are successfully adapted to perform Riemannian optimization by using retractions and Riemannian gradients, preserving the feasibility of parameters on the manifold.
  • The modular design allows any new manifold to be used with any existing optimizer and vice versa, significantly improving extensibility and reducing implementation overhead.
  • McTorch supports both CPU and GPU computation, and all numerical operations are implemented using PyTorch’s tensor operations, ensuring high performance and compatibility with existing deep learning workflows.
  • The library is released under the BSD-3-Clause license and is publicly available at https://github.com/mctorch/mctorch, with examples and benchmarks in development to support community adoption.

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.