Softmax Dissection: Towards Understanding Intra- and Inter-Class Objective for Embedding Learning

Lanqing He, Zhongdao Wang, Yali Li, Shengjin Wang

Abstract

Standard Softmax loss is the cornerstone of deep embedding learning but suffers from "entanglement," where inter-class separation objectives inadvertently relax intra-class compactness requirements. This paper introduces D-Softmax, a dissected loss function that decouples these objectives. D-Softmax enables more rigorous intra-class optimization and allows for massive scalability through efficient negative class sampling, achieving up to a 64x speedup on large-scale datasets without sacrificing accuracy.

The Entanglement Problem in Softmax

In tasks like face recognition, the ideal embedding space exhibits high intra-class compactness and clear inter-class separation. However, the standard Softmax loss mathematically links these two goals. When classes are sufficiently separated (inter-class distance is large), the gradient for pulling same-class features closer (intra-class compactness) vanishes. This "lazy" optimization leads to loose clusters that may not generalize well to unseen identities.

Comparison of feature distributions between Softmax and D-Softmax. Standard Softmax (top) results in significantly looser clusters compared to the tight, well-defined clusters of D-Softmax (bottom).

D-Softmax: Dissecting the Objective

To address entanglement, the authors propose D-Softmax (Dissected Softmax), which splits the loss into two independent components:

  • Intra-Class Component: The fluctuating sum of negative classes in the denominator is replaced with a constant value ($\epsilon$). This ensures a persistent "pull" toward the class center, regardless of how far away other classes are.
  • Inter-Class Component: This serves as a regularizer to maintain separation between class weights.

This disentanglement also solves the scalability bottleneck. In standard Softmax, every class must be computed to maintain the denominator's integrity. In D-Softmax, because the intra-class constraint is constant, one can sample a small fraction of negative classes to satisfy the inter-class regularizer without weakening the overall objective. Two variants are introduced: D-Softmax-B (batch-based sampling) and D-Softmax-K (parameter server-based sampling).

Theoretical Insights: The Termination Point

A key contribution of the paper is the mathematical demonstration of a "termination point" in Softmax optimization. As the number of classes ($M$) increases or inter-class similarity decreases, the loss reaches zero even when intra-class similarity is relatively low, leading to premature convergence.

Loss curves for various margin-based losses. The curves show how the loss reaches zero (the termination point) before reaching perfect intra-class similarity ($z_y = 1$), especially as the number of classes $M$ increases.

Furthermore, the authors observe that in high-dimensional spaces, class weights are naturally near-orthogonal. The inter-class objective's primary role is to maintain this orthogonality rather than pushing classes indefinitely apart. This insight justifies the use of sparse negative sampling.

Key Results and Performance

D-Softmax was evaluated on massive datasets, including a combined MS-Celeb-1M and MegaFace2 set with over 750,000 identities.

  • Accuracy: D-Softmax matches or exceeds state-of-the-art margin-based losses like ArcFace, achieving 99.74% on LFW.
  • Scalability: D-Softmax-K achieved a 64x speedup in the loss layer computation on the 757K-identity dataset compared to full Softmax.
  • Robustness: Even when sampling only 1/256th of the classes, D-Softmax-B maintained high accuracy (99.50% on LFW), demonstrating that the disentangled objective is highly resilient to sampling noise.

Conclusion

By dissecting the Softmax objective, D-Softmax provides a more principled approach to embedding learning. It eliminates the optimization "laziness" inherent in standard Softmax and enables training on million-scale identity datasets with unprecedented efficiency. Future work includes exploring its application in other domains like person re-identification and fine-grained categorization.

Summary updated

BibTeX
@inproceedings{he2020softmax,
  author = {Lanqing He and Zhongdao Wang and Yali Li and Shengjin Wang},
  title = {{Softmax Dissection: Towards Understanding Intra- and Inter-Class Objective for Embedding Learning}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2020},
  doi = {10.1609/aaai.v34i07.6729},
}
Figure