geoopt/geoopt

Riemannian Adaptive Optimization Methods with pytorch optim

What it solves

Geoopt provides tools for Riemannian optimization within the PyTorch ecosystem. Standard deep learning optimization often assumes a flat (Euclidean) space, but many machine learning problems require working with data that naturally exists on curved surfaces or specific geometric constraints, such as spheres, hyperbolic spaces, or symmetric positive definite matrices.

How it works

The library extends PyTorch by introducing specialized tensor and parameter classes that are "manifold-aware." It provides a suite of manifold implementations (e.g., Poincare ball, Lorentz, Stiefel) and Riemannian versions of standard optimizers like SGD and Adam. These tools allow users to perform operations like projections, exponential maps, and gradient transformations directly on the manifold, ensuring that model parameters remain constrained to the desired geometry during training.

Who it’s for

This project is designed for researchers and machine learning engineers working on geometric deep learning, hyperbolic neural networks, or any task requiring optimization over non-Euclidean manifolds.

Highlights

  • Provides manifold-aware versions of PyTorch tensors and parameters.
  • Includes Riemannian implementations of popular optimizers (SGD and Adam).
  • Supports a wide variety of manifolds, including Poincare balls, Lorentz models, and Stiefel manifolds.
  • Offers specialized samplers for Riemannian Stochastic Gradient Langevin Dynamics and Hamiltonian Monte-Carlo.
  • Integrates seamlessly with existing PyTorch workflows via an experimental layers module.

Related

  • Project
  • Project
  • Project
  • Project