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

Yixiong Zou, Ran Ma, Yuhua Li, Ruixuan Li
2/3/2026

No confident code implementation found for this paper.

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/Attn_Temp_CDFSL.

DOISemantic Scholar

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Cite this paper

@article{zou2026attention,
  title  = {Attention Temperature Matters in ViT-Based Cross-Domain Few-Shot Learning},
  author = {Yixiong Zou and Ran Ma and Yuhua Li and Ruixuan Li},
  year   = {2026},
  doi    = {10.52202/079017-3694},
  url    = {https://doi.org/10.52202/079017-3694},
  journal = {NEURIPS 2024 2024}
}

Discussion