von Mises-Fisher Loss: An Exploration of Embedding Geometries for Supervised Learning

Tyler R. Scott, Andrew C. Gallagher, Michael C. MozerICCV 2021

In deep learning, the "shape" of the embedding space is often an overlooked hyperparameter. While Euclidean space is the default, researchers from the University of Colorado and Google Research suggest that alternative geometries—spherical and hyperbolic—can significantly impact model performance and reliability. This paper provides a systematic comparison of these geometries and introduces the von Mises–Fisher (vMF) loss, a novel probabilistic approach for spherical embeddings.

The Geometry of Embeddings

When a neural network processes an input, it maps it to a high-dimensional vector called an embedding. The choice of loss function determines how these embeddings are organized. The authors compare five distinct approaches:

  1. Standard (Euclidean): Uses the classic dot-product softmax.
  2. Hyperbolic: Utilizes the Poincaré ball model, often used for hierarchical data.
  3. Cosine & ArcFace (Spherical): Project embeddings onto a unit hypersphere, focusing on angular distance.
  4. von Mises–Fisher (vMF): A novel loss that treats embeddings as samples from a vMF distribution.
Visualizing the 3D embedding structures produced by different loss functions.

As seen in the visualization, different losses lead to distinct geometric structures. Spherical losses (Cosine, ArcFace, vMF) tend to produce "spoke-like" clusters radiating from the origin, where the angle between spokes represents class separation.

The von Mises–Fisher (vMF) Loss

The core contribution of this work is the vMF loss. Unlike standard spherical losses that normalize embeddings to a fixed length, the vMF loss uses the $\ell_2$-norm of the embedding to represent uncertainty.

In this framework, both embeddings and class weights are treated as random variables following a von Mises–Fisher distribution—the spherical analogue of a Gaussian. A high-norm embedding indicates high confidence (a concentrated distribution), while a low-norm embedding indicates high uncertainty (a more uniform distribution). This allows the model to naturally signal ambiguity through the length of its output vectors.

Experimental Results

The authors evaluated these geometries across fixed-set classification (MNIST, CIFAR) and open-set retrieval (Cars196, CUB200).

Accuracy and Retrieval

Spherical losses consistently outperformed Euclidean and hyperbolic baselines. In retrieval tasks like Cars196, the gap was significant: ArcFace and vMF achieved approximately 27% mAP@R, compared to 21% for the standard Euclidean loss.

Test accuracy comparison on CIFAR100 and Cars196, highlighting the performance of vMF with learned concentration parameters.

Calibration

A key strength of the vMF loss is its "out-of-the-box" calibration. On FashionMNIST, vMF achieved an Expected Calibration Error (ECE) of 4.2%, a massive improvement over the 12.4% seen with standard Euclidean loss. This means the model's confidence scores are much more representative of its actual likelihood of being correct.

Conclusion

The study demonstrates that spherical geometries are generally superior for both classification and retrieval. The proposed vMF loss offers a principled way to incorporate uncertainty into spherical embeddings, leading to state-of-the-art calibration. While Euclidean models remain easier to calibrate post-hoc, the inherent geometric properties of spherical spaces provide a more robust foundation for high-dimensional representation learning.

Summary updated

BibTeX
@inproceedings{scott2021von,
  author = {Tyler R. Scott and Andrew C. Gallagher and Michael C. Mozer},
  title = {{von Mises-Fisher Loss: An Exploration of Embedding Geometries for Supervised Learning}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2021},
  doi = {10.1109/iccv48922.2021.01044},
}
Figure