NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

TensorFlow ManOpt: a library for optimization on Riemannian manifolds

Oleg Smirnov · OpenReview

TL;DR

This paper introduces tensorflow-riemopt, a Python library designed to bring optimization on Riemannian manifolds into the TensorFlow ecosystem. It aims to bridge the gap between research-oriented tools and production-ready machine learning pipelines, enabling the deployment of geometric deep learning models.

What Problem Does This Paper Address?

Machine learning is increasingly being applied to data that doesn't live in simple Euclidean spaces. Think of data with hierarchical structures (like language), or data represented by matrices with specific properties (like images or diffusion tensor data). These "non-Euclidean domains" often require specialized mathematical tools, particularly optimization techniques that respect the underlying geometry of the data space (Riemannian manifolds). While research libraries exist, they often lack the robust integration needed for real-world production deployment. This paper addresses the need for a library that combines the power of Riemannian optimization with the scalability and production-readiness of TensorFlow.

Methods

tensorflow-riemopt is built on TensorFlow, leveraging its automatic differentiation capabilities. The library provides two main modes of use:

  • High-level API for Machine Learning Applications: This allows practitioners to integrate manifold-constrained layers directly into their TensorFlow models. It supports seamless mixing of manifold layers with standard Euclidean layers and works with TensorFlow Extended for production pipelines. A key feature is the assign_to_manifold function, which transparently constrains model weights to specific manifolds.
  • Low-level API for Researchers: This exposes fundamental Riemannian geometry operations (like projections, exponential maps, and vector transports) and optimization algorithms. This enables researchers to develop novel algorithms and custom manifolds.

The library implements a wide range of manifolds (including hyperbolic spaces, matrix manifolds like Grassmannian and SPD matrices, and Lie groups like SO(3)) and Riemannian optimization algorithms (like Riemannian SGD, RMSprop, and Adam). It prioritizes closed-form expressions for manifold operators where possible, with numerical approximations as fallbacks.

Datasets

Not discussed in the paper. The paper focuses on the library's functionality and performance rather than specific datasets.

Key Insights and Ideas

  • Bridging Research and Production: The core insight is that existing Riemannian optimization tools were often research-focused. tensorflow-riemopt aims to be a production-ready solution by integrating deeply with TensorFlow and its extended ecosystem (TFX).
  • Seamless Integration: The library is designed to be a "drop-in replacement" for native TensorFlow APIs, allowing users to leverage geometric methods without needing to be experts in differential geometry.
  • Performance in High Dimensions: Benchmarks suggest that tensorflow-riemopt is particularly effective for high-dimensional manifolds, outperforming alternatives due to optimized computational graph transformations.
  • Flexibility for Researchers: The low-level API empowers researchers to experiment with new algorithms and manifolds, while the high-level API ensures these can be deployed.

Key Results

The paper presents benchmarks comparing tensorflow-riemopt with other open-source Riemannian optimization toolkits (Geomstats, Pymanopt, Geoopt, McTorch) across various manifolds (Euclidean, Poincaré ball, hypersphere, SO(n), SPD matrices) and dimensions.

  • Performance: In high-dimensional settings (up to 10^6 for vector spaces), tensorflow-riemopt performs comparably to or better than existing alternatives.
  • Implementation Choices Matter: The observed performance differences are attributed to implementation choices, such as using exact geometric operations versus approximations like retractions.
  • Broad Manifold Support: The library supports 14 manifolds, including hyperbolic spaces, matrix manifolds, and SPD matrices.

Limitations and Future Work

  • Limited Hyperbolic Operations in Some Toolkits: The benchmarks highlight that some competing toolkits have limitations in supporting hyperbolic operations.
  • Future Work: The paper implies that the library's architecture is extensible, suggesting future work could involve adding more manifolds, optimization algorithms, and potentially further performance optimizations. The integration with TensorFlow Extended also points towards continued development for production ML pipelines.

Summary updated

BibTeX
@misc{smirnov2021tensorflow,
  author = {Oleg Smirnov},
  title = {{TensorFlow ManOpt: a library for optimization on Riemannian manifolds}},
  year = {2021},
  eprint = {2105.13921},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2105.13921},
}
Figure