Simultaneous Similarity-based Self-Distillation for Deep Metric Learning

Karsten Roth, Timo Milbich, Björn Ommer, Joseph Paul Cohen, Marzyeh GhassemiICML 2021

TL;DR

S2SD (Simultaneous Similarity-based Self-Distillation) is a training framework that boosts the performance of low-dimensional embedding models by distilling knowledge from high-dimensional auxiliary "heads" during training. It achieves state-of-the-art results in Deep Metric Learning (DML) with zero added cost at test time and negligible overhead during training.

What Problem Does This Paper Address?

Deep Metric Learning (DML) is the art of teaching a neural network to map images into a space where "similar" items are close together and "dissimilar" items are far apart. This is the backbone of image retrieval, face recognition, and zero-shot learning.

Researchers have hit a plateau: regardless of the loss function used, performance seems to saturate. While we know that higher-dimensional embedding spaces generalize better, they come with a heavy price tag: retrieval cost. If you are searching through millions of images, a 2048-dimensional vector is significantly slower and more memory-intensive to process than a 128-dimensional one.

The authors ask: Can we get the generalization benefits of high-dimensional spaces into a low-dimensional model without actually using those high dimensions at test time?

Methods

The authors propose S2SD, which introduces three key components to the standard DML training pipeline to distill knowledge simultaneously without a pre-trained teacher.

S2SD Architecture and Training Framework
  1. Dual Self-Distillation (DSD): The model has a "base" head (the low-dim student) and an "auxiliary" head (the high-dim teacher). Both are attached to the same backbone. During training, the base head is forced to mimic the sample-to-sample similarity patterns found in the high-dim head using Kullback-Leibler (KL) divergence.
  2. Multiscale Self-Distillation (MSD): Instead of one teacher, the authors use multiple auxiliary heads of increasing dimensionality. This encourages the base head to learn "reusable" features that are robust across different levels of representational capacity.
  3. Feature Space Self-Distillation (MSDF): The authors distill information directly from the backbone's penultimate feature layer (which is usually much higher dimensional than the final embedding) into the base head. This helps bypass the "dimensionality bottleneck" created by the final projection.

Crucially, this is "Simultaneous": Unlike traditional distillation, which requires a pre-trained teacher model (2-stage), S2SD trains the student and teachers at the same time on a single backbone. At test time, the auxiliary heads are discarded, leaving a lean, high-performing low-dim model.

Datasets

The method was evaluated on three standard DML benchmarks for zero-shot image retrieval:

  • CUB200-2011: 200 species of birds.
  • CARS196: 196 classes of cars.
  • Stanford Online Products (SOP): A large-scale dataset of 120k images across 22k product classes.

Key Insights and Ideas

  • Dimensionality as a Teacher: You don't need a different, larger network architecture to act as a teacher. Simply projecting the same features into a higher-dimensional space provides a "richer" signal that can guide the lower-dimensional head.
  • Relational Distillation: Instead of matching raw embedding vectors (which is impossible when dimensions differ), S2SD matches the relationships between images in a batch. If the high-dim head thinks Image A and Image B are very similar, the low-dim head is trained to agree.
  • Efficiency: Because the auxiliary heads are just small MLP layers on top of a shared backbone, the training time increase is negligible (less than 5%).
  • Spectral Properties: The authors found that S2SD leads to lower "spectral decay" in the embedding space. In plain English: the model uses its available dimensions more efficiently and avoids collapsing into a few dominant features.

Key Results

  • Significant Boosts: S2SD improved Recall@1 by up to 7% over strong baselines like Margin Loss and Multi-Similarity Loss.
  • New State-of-the-Art: The method outperformed much more complex DML extensions (like DiVA or MIC) across all three major benchmarks.
  • Doing More with Less: A 128-dimensional model trained with S2SD can outperform a standard 2048-dimensional model. This is a massive win for production systems where memory and latency are critical.
  • Agnosticism: The framework works regardless of the underlying backbone (ResNet50, Inception) or the specific DML loss function used.

Limitations and Future Work

  • Hyperparameter Sensitivity: While the authors show some robustness, the method introduces new hyperparameters like $\gamma$ (distillation weight) and $T$ (temperature) that may require tuning for new datasets.
  • Batch Size Dependency: Since the distillation relies on batch-similarity matrices, the quality of the "teacher" signal is inherently tied to the batch size. Very small batches might limit the effectiveness of the relational signal.
  • Theoretical Gap: The paper is heavily empirical. While the results are impressive, a deeper theoretical understanding of why high-dim projections of the same features provide a better training signal remains an open question for future research.

Summary updated

BibTeX
@inproceedings{roth2021simultaneous,
  author = {Karsten Roth and Timo Milbich and Björn Ommer and Joseph Paul Cohen and Marzyeh Ghassemi},
  title = {{Simultaneous Similarity-based Self-Distillation for Deep Metric Learning}},
  booktitle = {International Conference on Machine Learning},
  year = {2021},
  url = {https://openreview.net/forum?id=bvJjIvtqWDj},
}
Figure