Frequency Attention for Knowledge Distillation

Cuong Pham, Van-Anh Nguyen, Trung Le, Dinh Q. Phung, Gustavo Carneiro, Thanh-Toan Do

Introduction

Deep neural networks have achieved remarkable success but often come with high computational costs. Knowledge distillation (KD) serves as a vital technique for model compression, where a lightweight "student" model is trained to mimic the behavior of a high-performing "teacher." While existing state-of-the-art KD methods primarily rely on spatial attention to transfer knowledge, these approaches are inherently local. Spatial attention identifies important pixel clusters, but changes in one region do not naturally propagate to distant parts of the feature map, making it difficult for students to grasp global structural patterns.

To address this, we introduce the Frequency Attention Module (FAM). By leveraging the properties of the Fourier domain, FAM enables student models to capture global context and structural relationships that are often missed by purely spatial methods.

Methodology

The core of our approach is the Frequency Attention Module (FAM), which processes feature maps through two parallel branches to capture both global and local information.

The Frequency Attention Module (FAM) architecture, featuring parallel global and local branches.

The Global Branch

In the global branch, feature maps are transformed into the frequency domain using a Fast Fourier Transform (FFT). Because every frequency component is calculated from the entire spatial input, a Learnable Global Filter applied here acts as a form of global attention. To further refine the knowledge transfer, we employ a High Pass Filter (HPF) that suppresses the lowest 1% of frequencies. This forces the student to ignore smooth, non-salient backgrounds and focus on high-frequency structures like edges and object boundaries. Finally, an Inverse FFT (IFFT) returns the features to the spatial domain.

The Local Branch and Fusion

Simultaneously, a local branch utilizes a standard 1x1 convolution to preserve essential local spatial details. The outputs from both branches are combined using learnable weights. This module can be integrated into various KD frameworks, such as Layer-to-Layer distillation or Knowledge Review distillation, where it helps align the student's feature representations with the teacher's more effectively.

Experimental Results

We evaluated FAM-KD across major benchmarks including CIFAR-100, ImageNet, and MS COCO, using a variety of architectures such as ResNet, ShuffleNet, and MobileNetV2.

Quantitative Performance

On the ImageNet dataset, a ResNet18 student distilled from a ResNet34 teacher using FAM-KD achieved a Top-1 accuracy of 71.91%, significantly outperforming the vanilla student (69.75%) and the previous state-of-the-art, ReviewKD (71.61%). For object detection on MS COCO, the method improved the Average Precision (AP) of a ResNet18 backbone from 33.26 to 37.20, demonstrating its utility beyond simple classification.

Qualitative Analysis

Visualizing the attention maps reveals that FAM-KD helps the student model focus more accurately on the primary objects in a scene compared to other KD methods.

Qualitative comparison of attention maps: FAM-KD (e) shows superior focus on object structures compared to baseline (b) and other KD methods (c, d).

Discussion and Conclusion

Our findings highlight that frequency-domain information is a powerful proxy for global context. One notable observation is the "student surpassing teacher" phenomenon, where some student models achieved higher accuracy than their teachers, suggesting that frequency-based guidance helps discover more efficient representations.

While the current implementation uses a fixed 1% high-pass threshold and focuses on CNNs, future work could explore adaptive filtering and the application of frequency attention to Vision Transformers (ViTs). Overall, FAM-KD provides a robust and effective framework for enhancing knowledge transfer by bridging the gap between local spatial features and global structural understanding.

Summary updated

BibTeX
@inproceedings{pham2024frequency,
  author = {Cuong Pham and Van-Anh Nguyen and Trung Le and Dinh Q. Phung and Gustavo Carneiro and Thanh-Toan Do},
  title = {{Frequency Attention for Knowledge Distillation}},
  booktitle = {IEEE/CVF Winter Conference on Applications of Computer Vision},
  year = {2024},
  doi = {10.1109/wacv57701.2024.00227},
}
Figure