TL;DR
Vision Foundation Models (VFMs) possess incredible out-of-domain generalization, but standard knowledge distillation (KD) often destroys this robustness by overfitting the student model to the training domain. This paper introduces Generalizable Knowledge Distillation (GKD), a multi-stage framework that decouples representation learning from task adaptation to preserve the teacher's generalization capability in compact student models. GKD achieves massive performance boosts—up to +10.6% in foundation-to-local settings—on unseen domains and under adverse weather conditions.
What Problem Does This Paper Address?
Semantic segmentation models deployed in the real world frequently encounter distribution shifts, such as changing weather conditions in autonomous driving or variations across different medical imaging devices. Large Vision Foundation Models (VFMs) like DINOv2 handle these shifts remarkably well due to their massive pre-training. However, when we try to compress these giant models into lightweight, deployable versions using conventional Knowledge Distillation (KD), a major bottleneck occurs: the student models overfit to the training data and lose the VFM's robust generalization ability.
The authors discover that this degradation stems from an optimization conflict. Standard KD entangles feature distillation and task learning in a single stage. The task objective aggressively drives the student toward source-specific decision boundaries, while the distillation objective tries to keep representations domain-invariant. This tug-of-war results in unstable convergence and poor out-of-domain performance.
Methods
The authors propose Generalizable Knowledge Distillation (GKD), a framework that splits the distillation process into distinct, non-conflicting phases:
- Domain-General Distillation (Stage 1): The student learns generalizable representations entirely without task labels.
- Task-agnostic step: The student distills knowledge from the VFM on a proxy dataset (ImageNet) to narrow the initial representation gap.
- Domain-agnostic step: The student continues distillation on the target task's source images without using task labels, ensuring it internalizes domain-invariant features (like urban layouts) without learning domain-specific supervision biases.
- Task Learning (Stage 2): The student's encoder is frozen to lock in the generalizable features. Only a lightweight decoder head is trained using standard task supervision (e.g., cross-entropy loss) on the labeled source domain.
To facilitate better feature transfer, GKD introduces Query-based Soft Distillation (QSD). Instead of forcing rigid, point-wise feature alignment (which fails when exact semantic layouts shift), QSD treats student features as queries to selectively retrieve spatial knowledge from the teacher via an attention mechanism. This allows the student to mimic the global relational structure of the VFM. QSD also incorporates masked patch-level distillation and global semantic transfer via the CLS token.
Datasets
The framework was evaluated across several rigorous domain generalization benchmarks:
- Source Domains: GTAV (simulated gameplay), Cityscapes (urban street scenes), and synthetic datasets like SYNTHIA and UrbanSyn (used for scaling experiments).
- Target/Evaluation Domains: Cityscapes, BDD100K, Mapillary Vistas, and the Adverse Conditions Dataset with Correspondence (ACDC), which tests performance under severe environments (Night, Snow, Fog, Rain).
- Remote Sensing Domains: Cross-urban remote sensing datasets including ISPRS Potsdam and Vaihingen.
Key Insights and Ideas
- Decoupling is Crucial: Separating representation learning from task optimization eliminates the gradient conflict inherent in single-stage KD. Freezing the encoder during task adaptation guarantees that the student retains its out-of-domain robustness.
- Relational Structure > Local Activations: Blindly copying exact pixel-level feature values from a teacher restricts a student's flexibility. By using an attention-based query mechanism (QSD), the student learns how different regions relate to each other globally, which translates much better to unseen environments.
- Exceptional Label Efficiency: Because the student internalizes robust representations before ever seeing a segmentation label, it requires far less annotated data during the task learning phase to achieve high performance.
Key Results
- Foundation-to-Local (F2L): When distilling a large VFM (DINOv2-B) into a small, locally trained model (ViT-S), GKD achieved a remarkable +10.6% average mIoU gain over conventional KD across unseen domains.
- Foundation-to-Foundation (F2F): When compressing a larger VFM to a smaller VFM (e.g., DINOv2-L to DINOv2-B), GKD yielded a +1.9% average mIoU gain, consistently outperforming enhanced KD variants like CWD and Af-DCD.
- Data Scarcity Robustness: In label-scarce scenarios using only 1/16 of the training labels, a DeiT-S student trained via GKD achieved 51.4% mIoU on the target domains, outperforming the closest competing distillation method by 5.4% and the vanilla baseline by 15.7%.
Limitations and Future Work
Not discussed in the paper.
Summary updated