Abstract
Deep Metric Learning (DML) often faces a trade-off between the high representation capacity of high-dimensional embeddings and the retrieval efficiency of low-dimensional ones. We present Simultaneous Similarity-based Self-Distillation (S2SD), a training framework that enables low-dimensional "student" embeddings to inherit the complex sample relationships captured in high-dimensional "teacher" spaces. By performing distillation simultaneously on a single backbone during training, S2SD achieves state-of-the-art results across major benchmarks with zero added cost at inference time.
Introduction
Deep Metric Learning is fundamental to tasks like face recognition and image retrieval, where the goal is to map images into an embedding space such that semantically similar items are clustered together. While high-dimensional embeddings (e.g., 2048-D) generalize better due to their higher capacity, they are computationally expensive for large-scale search. S2SD addresses this by distilling the knowledge of high-dimensional auxiliary heads into a compact base head, providing the generalization benefits of high dimensionality at the cost of a low-dimensional embedding.
Methodology
The S2SD framework introduces a multi-head architecture attached to a shared backbone network, such as ResNet50.
Architecture and Training Paradigm
The model consists of a base head $f$, which produces the final low-dimensional embedding used during inference, and several auxiliary heads $g_i$ of higher dimensionality used exclusively during training.
The training process incorporates several key distillation components:
- Dual Self-Distillation (DSD): For each batch, similarity matrices are computed in both the student and teacher spaces. The student's similarity distribution is then aligned with the teacher's using KL-divergence.
- Multiscale Self-Distillation (MSD): Multiple teachers with varying dimensions are employed, forcing the student to learn robust relationships that are consistent across different scales.
- Feature Space Distillation (MSDF): Knowledge is distilled directly from the high-dimensional feature maps preceding the final pooling layer, helping to mitigate dimensionality bottlenecks.
- Gradient Detachment: Gradients from the distillation loss are prevented from flowing back into the teacher branches. This ensures that the teachers do not degrade their own performance to match the student's current capacity.
Experimental Evaluation
S2SD was evaluated on three standard DML benchmarks: CUB200-2011 (birds), CARS196 (cars), and Stanford Online Products (SOP).
Key Insights
A primary finding of this work is that dimensionality itself acts as a powerful teacher. An auxiliary head with higher dimensionality inherently captures more nuanced relationships between samples. Furthermore, S2SD is shown to improve the "spectral decay" of the embedding space. By reducing spectral decay, the model is encouraged to utilize its available dimensions more diversely, leading to better generalization.
Results and Discussion
S2SD consistently outperforms strong baselines and previous state-of-the-art (SOTA) methods. On the CUB200 dataset, it provided improvements of up to 7% in Recall@1 compared to standard training. Notably, a 128-D model trained with S2SD can match or exceed the performance of a standard 512-D or 2048-D model, enabling a 10x reduction in retrieval time without sacrificing accuracy.
The training overhead is minimal, with less than a 5% increase in wall-clock time. Since auxiliary branches are discarded post-training, there is no additional computational cost during inference.
Conclusion and Limitations
S2SD offers a highly efficient and effective method for boosting DML performance. While it requires some hyperparameter tuning for distillation weights and temperature, it allows for the deployment of compact, high-performance models suitable for large-scale real-world applications. Future work may extend these concepts to localized feature distillation or broader self-supervised learning tasks.
Summary updated