Attention Temperature Matters in ViT-Based Cross-Domain Few-Shot Learning

Abstract

Cross-domain few-shot learning (CDFSL) is proposed to transfer knowledge from large-scale source-domain datasets to downstream target-domain datasets with only a few training samples. However, Vision Transformer (ViT), as a strong backbone network to achieve many top performances, is still under-explored in the CDFSL task in its transferability against large domain gaps. In this paper, we find an interesting phenomenon of ViT in the CDFSL task: by simply multiplying a temperature (even as small as 0) to the attention in ViT blocks, the target-domain performance consistently increases, even though the attention map is downgraded to a uniform map. In this paper, we delve into this phenomenon for an interpretation. Through experiments, we interpret this phenomenon as a remedy for the ineffective target-domain attention caused by the query-key attention mechanism under large domain gaps. Based on it, we further propose a simple but effective method for the CDFSL task to boost ViT's transferability by resisting the learning of query-key parameters and encouraging that of non-query-key ones. Experiments on four CDFSL datasets validate the rationale of our interpretation and method, showing we can consistently outperform state-of-the-art methods. Our codes are available at https://github.com/Zoilsen/AttnTempCDFSL.

Cite

Text

Zou et al. "Attention Temperature Matters in ViT-Based Cross-Domain Few-Shot Learning." Neural Information Processing Systems, 2024. doi:10.52202/079017-3694

Markdown

[Zou et al. "Attention Temperature Matters in ViT-Based Cross-Domain Few-Shot Learning." Neural Information Processing Systems, 2024.](https://mlanthology.org/neurips/2024/zou2024neurips-attention/) doi:10.52202/079017-3694

BibTeX

@inproceedings{zou2024neurips-attention,
  title     = {{Attention Temperature Matters in ViT-Based Cross-Domain Few-Shot Learning}},
  author    = {Zou, Yixiong and Ma, Ran and Li, Yuhua and Li, Ruixuan},
  booktitle = {Neural Information Processing Systems},
  year      = {2024},
  doi       = {10.52202/079017-3694},
  url       = {https://mlanthology.org/neurips/2024/zou2024neurips-attention/}
}