TL;DR
This paper reveals a surprising theoretical connection between the standard cross-entropy loss (used in classification) and complex pairwise losses commonly used in Deep Metric Learning (DML). They demonstrate that minimizing cross-entropy is equivalent to maximizing mutual information between features and labels, a goal shared by many DML losses, but achieved with a simpler optimization process. This insight leads to state-of-the-art results using cross-entropy on DML benchmarks.
What Problem Does This Paper Address?
Deep Metric Learning (DML) aims to learn an embedding space where semantically similar data points are close, and dissimilar points are far apart. The dominant approach in DML involves designing intricate "pairwise" loss functions that explicitly enforce these distance constraints. However, these losses often require complex optimization strategies like sample mining or pair weighting, which can be cumbersome and introduce many hyperparameters. This complexity has led to a situation where the much simpler cross-entropy loss, a staple of classification, has been largely overlooked in DML, despite its potential for efficient optimization. The core problem this paper addresses is bridging this gap: can the simplicity of cross-entropy be leveraged for DML, and if so, what is the theoretical justification for its effectiveness compared to established pairwise DML losses?
Methods
The authors propose a unifying theoretical framework that connects cross-entropy to pairwise DML losses through the lens of mutual information (MI). They explore two main perspectives:
- Optimization Insight (Bound Optimization): They introduce a novel "Pairwise Cross-Entropy" (PCE) loss and demonstrate that the standard cross-entropy loss acts as an upper bound on this PCE loss. Minimizing cross-entropy can therefore be viewed as an approximate Majorize-Minimize (or bound optimization) algorithm for minimizing this new pairwise loss. This PCE loss, like other DML losses, has both a "tightness" component (minimizing intra-class distances) and a "contrastive" component (maximizing inter-class distances).
- Information-Theoretic View (Mutual Information): They show that both pairwise DML losses and cross-entropy are fundamentally trying to maximize the mutual information between the learned features (Z) and the true labels (Y). They connect this to both the discriminative view (labels are easily identifiable from features) and the generative view (features are spread out but clustered by class) of MI. This provides a deeper theoretical understanding of why these seemingly different losses achieve similar goals.
They also analyze several popular pairwise DML losses (Center Loss, Contrastive Loss, SNCA, MS) and show how they can be decomposed into tightness and contrastive terms, and how these terms relate to each other and to the MI.
Datasets
The paper evaluates their approach on four standard DML benchmark datasets:
- Caltech-UCSD Birds-200-2011 (CUB)
- Cars Dataset
- Stanford Online Products (SOP)
- In-shop Clothes Retrieval
These datasets are commonly used for evaluating metric learning methods and are summarized in Table 3 of the paper. The paper does not introduce any new datasets.
Key Insights and Ideas
- Cross-entropy is a proxy for mutual information: The most significant insight is that minimizing cross-entropy is not just a classification objective but is fundamentally equivalent to maximizing the mutual information between learned features and labels, a goal shared by many DML losses.
- Cross-entropy as an approximate bound optimizer: The paper shows that cross-entropy can be seen as an approximate Majorize-Minimize algorithm for a newly defined pairwise loss (PCE). This explains how a simple unary loss can implicitly enforce pairwise constraints.
- Simplicity beats complexity (often): The theoretical framework suggests that the primary advantage of cross-entropy over complex pairwise losses lies in its simpler optimization. Pairwise losses require careful sample mining and weighting, whereas cross-entropy's unary nature simplifies training significantly.
- Pairwise losses are related: The paper demonstrates that many existing pairwise DML losses can be explicitly linked to each other through bound relationships, further solidifying the idea that they are optimizing similar objectives.
- Euclidean distance can be competitive: Contrary to common practice, the paper shows that Euclidean distance on non-normalized features can be competitive with cosine distance on normalized features for evaluation, especially when using cross-entropy.
Key Results
- State-of-the-art performance: The authors achieve state-of-the-art results on the evaluated DML benchmarks using cross-entropy, outperforming many recent and complex DML methods.
- Competitive recall with Euclidean distance: On CUB200, Cars-196, and SOP datasets, their cross-entropy method with Euclidean distance achieves recall scores comparable to or better than existing methods, even outperforming some using cosine distance. For example, on CUB200 with cosine distance, their method achieves 89.3% recall@32, while many others are in the low 90s. On Cars-196, they achieve 99.7% recall@32, again competitive with the best.
- Simplified Pairwise Cross-Entropy (SPCE): They introduce SPCE as a simplified version of their PCE loss, which is computationally efficient and exhibits similar behavior to cross-entropy in preliminary experiments.
- Cross-entropy handles large numbers of classes: The paper suggests that cross-entropy (and its SPCE variant) can handle scenarios with a very large number of classes, where storing the full weight matrix for pairwise losses might become prohibitive.
Limitations and Future Work
- Limitations of Cross-Entropy: The paper acknowledges that while cross-entropy is generally effective, there are scenarios where its straightforward use becomes prohibitive.
- Relative Labels: When only relative labels (similar/dissimilar pairs) are available, and absolute class labels are not, standard cross-entropy is difficult to apply. However, their proposed SPCE loss can handle such cases.
- Large Number of Classes: For problems with millions of classes, storing the classifier's weight matrix for cross-entropy becomes infeasible. Again, SPCE is suggested as a solution.
- Future Work: The authors strongly advocate for cross-entropy to be carefully tuned and used as a baseline in future DML research. They also suggest that their theoretical framework can be extended to analyze other DML losses and potentially inspire new, more efficient loss functions. The preliminary results with SPCE on MNIST suggest it's a promising direction for further investigation.
Summary updated