Differentiating through the Fréchet Mean

Aaron Lou, Isay Katsman, Qingxuan Jiang, Serge J. Belongie, Ser-Nam Lim, Christopher De Sa

Overview

Hyperbolic neural networks are powerful tools for modeling hierarchical data, but they have historically lacked a crucial operation: a differentiable way to calculate a "mean" directly on the manifold. This paper provides a mathematical framework to differentiate through the Fréchet mean—the non-Euclidean generalization of an average. Alongside this theory, the authors introduce a fast, hyperparameter-free solver that enables state-of-the-art performance in hyperbolic graph networks and makes Hyperbolic Batch Normalization practical.

What Problem Does This Paper Address?

Deep learning typically operates in Euclidean space, where finding the "average" of a set of points is as simple as summing them and dividing by their count. This operation has a closed-form solution and is trivially differentiable, making it easy to use in neural networks.

However, many real-world datasets—such as social networks, biological taxonomies, or language hierarchies—exhibit tree-like structures that are best represented in hyperbolic space, where distances grow exponentially. In these non-Euclidean spaces, a standard Euclidean average fails because it does not respect the geometry of the underlying manifold.

Visualizing the Fréchet mean on a curved manifold.

The mathematically correct alternative is the Fréchet mean, which identifies the point on the manifold that minimizes the sum of squared distances to all other points. The major hurdle is that the Fréchet mean has no closed-form solution; it is the result of an optimization problem (an argmin). Historically, this made it nearly impossible to use as a standard layer in neural networks, as calculating gradients through an iterative optimization process is slow, memory-intensive, and numerically unstable.

Methods

The authors tackle this bottleneck with a two-pronged approach:

  1. The Backward Pass (Implicit Differentiation): Instead of trying to "unroll" an iterative solver during backpropagation, the authors utilize implicit differentiation. By applying the implicit function theorem to the optimality conditions of the Fréchet mean, they derive a closed-form expression for the gradient. This elegant mathematical workaround allows the Fréchet mean to function as a standard, fully differentiable layer in any neural network.
  2. The Forward Pass (Fast Solver): Finding the mean itself during the forward pass is traditionally slow. To fix this, the authors developed a novel, hyperparameter-free iterative algorithm specifically tailored for hyperbolic space. By exploiting the fact that the squared distance metric is concave in certain models, they created a solver that converges significantly faster than traditional methods like Riemannian Gradient Descent (RGD).

Key Insights and Ideas

  • Moving Beyond the Tangent Space: Previous hyperbolic models often bypassed the missing mean operation by "cheating": they projected points onto a flat tangent space, averaged them there, and projected the result back onto the manifold. This paper demonstrates that calculating the true Fréchet mean directly on the manifold captures the geometry much more accurately, leading to superior downstream performance.
  • Hyperbolic Batch Normalization (HBN): A major breakthrough of this work is the realization that Batch Normalization—a staple for stabilizing Euclidean deep learning—can finally be generalized to hyperbolic space using the Fréchet mean. This stabilizes training and improves performance across the board.
  • Efficiency Matters: The new forward-pass solver is not just a marginal improvement. It reaches high precision in approximately 14 iterations, whereas standard baselines often require over 800. This dramatic reduction makes hyperbolic operations practical for standard, real-world training loops.

Key Results

The researchers evaluated their methods on several graph-based datasets, including Disease & Disease-M (high-hyperbolicity, tree-like datasets for link prediction) and CoRA (a standard citation network with lower hyperbolicity).

Performance comparison showing SOTA results on the Disease dataset.
  • State-of-the-Art (SOTA): Replacing the "tangent space" aggregation in Hyperbolic Graph Convolutional Networks (HGCN) with the differentiable Fréchet mean achieved SOTA results. Most notably, on the Disease dataset, ROC AUC improved massively from 76.4 to 93.7.
  • Speedup: The proposed forward-pass algorithm is roughly 100x faster than Riemannian Gradient Descent and significantly faster than the Karcher Flow algorithm.
  • Stability: Implementing Hyperbolic Batch Normalization led to faster convergence and lower validation loss across all tested datasets, even on those that weren't strictly hyperbolic (like CoRA).

Limitations and Future Work

While the paper provides a robust framework for hyperbolic deep learning, the authors note a few limitations:

  • Manifold Specificity: While the implicit differentiation theory is generalizable to any Riemannian manifold, the fast forward-pass solver was specifically derived for hyperbolic space. Extending this high-speed solver to other manifolds, such as spherical space, remains an open challenge.
  • Computational Overhead: Even with the highly optimized solver, calculating a Fréchet mean remains more computationally expensive than a simple Euclidean average.
  • Broader Applications: The authors suggest that this theoretical foundation could be used to generalize other complex operations—like attention mechanisms or advanced pooling layers—into non-Euclidean domains in the future.

Summary updated

BibTeX
@inproceedings{lou2020differentiating,
  author = {Aaron Lou and Isay Katsman and Qingxuan Jiang and Serge J. Belongie and Ser-Nam Lim and Christopher De Sa},
  title = {{Differentiating through the Fréchet Mean}},
  booktitle = {International Conference on Machine Learning},
  year = {2020},
  url = {https://openreview.net/forum?id=VBEtRuaZdiQ},
}
Figure