Abstract
This work addresses the problem of knowledge distillation for deep face recognition task. Knowledge distillation technique is known to be an effective way of model compression, which implies transferring of the knowledge from high-capacity teacher to a lightweight student. The knowledge and the way how it is distilled can be defined in different ways depending on the problem where the technique is applied. Considering the fact that face recognition is a typical metric learning task, we propose to perform knowledge distillation on a score-level. Specifically, for any pair of matching scores computed by teacher, our method forces student to have the same order for the corresponding matching scores. We evaluate proposed pairwise ranking distillation (PWR) approach using several face recognition benchmarks for both face verification and face identification scenarios. Experimental results show that PWR not only can improve over the baseline method by a large margin, but also outperforms other score-level distillation approaches.
Introduction
Deep learning has revolutionized face recognition, but the most accurate models are often too large and computationally expensive for deployment on mobile devices or real-time surveillance systems. Knowledge Distillation (KD) is a popular technique to address this, where a compact "student" model learns from a high-capacity "teacher" model. Traditional KD methods typically focus on Individual Knowledge Distillation (IKD), attempting to force the student to replicate the teacher's exact feature vectors or classification outputs. However, face recognition is fundamentally a metric learning task. In this context, the relative relationships between embeddings—the ranking of similarities—are more important than the absolute values of the features themselves.
Methodology: Pairwise Ranking Distillation (PWR)
The authors propose Pairwise Ranking Distillation (PWR), a Relational Knowledge Distillation (RKD) approach that focuses on preserving the structure of the latent space. Instead of point-wise regression, PWR ensures the student model learns the relative ranking of face similarity scores as perceived by the teacher.
Relational Function and Ranking Constraints
PWR utilizes cosine similarity to measure the proximity between face embeddings. The core principle is that if the teacher model determines that Image A is more similar to Image B than to Image C, the student model should preserve this specific ordering.
Loss Formulations
To penalize ranking inversions (where the student's ranking contradicts the teacher's), several loss functions were evaluated:
- Power Difference Loss: Introduces a power factor $p$ to modulate the penalty based on the magnitude of the ranking error.
- Exponential Difference Loss: Employs an exponential function to heavily penalize significant discrepancies in ranking.
- RankNet Loss: Adapts a cross-entropy approach from learning-to-rank literature.
Adaptive Margins
To avoid over-regularizing the student, the authors introduced adaptive margins ($\alpha$). By using dynamic margins such as teacher-diff (the actual difference in similarity scores calculated by the teacher), the student learns the confidence level of the teacher's rankings rather than just a binary relationship.
Experimental Setup
The models were trained using a cleaned version of the MS-Celeb-1M dataset, comprising 5.8 million images of 85,000 subjects. Performance was evaluated on several benchmarks:
- Verification: LFW, CPLFW (cross-pose), and AgeDB-30 (age-invariant).
- Identification: MegaFace, which includes 1 million distractor images. The experiments used a ResNet50 teacher and a ResNet18 student.
Results and Discussion
PWR consistently outperformed baseline models and existing relational distillation methods.
- Benchmark Performance: On the MegaFace Rank-1 identification task, the PWR-Exp variant with adaptive margins improved the baseline student accuracy from 93.80% to 94.33%.
- Comparison with RKD: PWR showed superior results compared to methods like DarkRank and RKD-Angle/Distance. For instance, on AgeDB-30, PWR achieved 97.42% accuracy, while the next best non-PWR relational method reached 96.88%.
- Robustness: A key finding was that PWR is effective as a standalone loss, whereas other RKD methods often require combination with standard classification losses to achieve competitive results.
Conclusion
Pairwise Ranking Distillation effectively bridges the gap between high-capacity teacher models and lightweight student models for face recognition. By treating distillation as a learning-to-rank problem, PWR allows the student to find an efficient internal representation that preserves the teacher's relational logic. While future work may explore list-wise ranking and improved robustness to extreme pose variations, PWR represents a significant step forward in model compression for metric learning tasks.
Summary updated