Research map / Label-efficient and robust learning / Domain adaptation and generalization
Attention Temperature Matters in ViT-Based Cross-Domain Few-Shot Learning
Read the paperCheck your idea against 108,967 papers
AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.
Shows that scaling ViT attention by a small temperature (down to 0, i.e., uniform attention) improves cross-domain few-shot transfer, and proposes Attention Abandonment during source training plus target-time attention temperature adjustment to boost ViT-S transferability.
Problem
Vision Transformers transfer poorly under large domain gaps in cross-domain few-shot learning (CDFSL); the query-key attention yields ineffective target-domain attention.
Approach
Attention temperature (even 0, giving uniform attention) improves target-domain accuracy but hurts source accuracy; the authors attribute this to query-key attention being discriminative but poorly transferable, and propose randomly abandoning query-key attention (setting its temperature to 0 with probability p=0.8) during source training, plus a fixed target-time temperature.
Key results
- AttnTemp (ViT-S, fine-tuned, transductive) reaches 57.23 average 5-way 5-shot accuracy, vs. 55.62 for FLoR* (ResNet10) and 55.14 for MEM-FS+RDA*.
- Without finetuning, AttnTemp achieves 54.12 average 5-way 1-shot accuracy, above FLoR (52.80) with ViT-S.
- Attention Abandonment alone gives a 2.47% average 5-way 5-shot improvement over the baseline in ablation (63.53 to 66.00 with adjustment, 66.62 full).
Measured effects reported in the paper
| What was changed | Where | Measured | Effect |
|---|---|---|---|
| add attention abandonment during source-domain training (ablation) | ViT-S CDFSL · CropDiseases, 5-way 5-shot | accuracy: 94.24±0.27 -> 95.40±0.33 | Helped |
| add target-domain attention adjustment (ablation) | ViT-S CDFSL without abandonment · CropDiseases, 5-way 5-shot | accuracy: 94.24±0.27 -> 94.48±0.31 | Helped |
| add target-domain attention adjustment when abandonment is active (ablation) | ViT-S CDFSL · CropDiseases, 5-way 5-shot | accuracy: 95.40±0.33 -> 95.53±0.22 | Helped |
| replace stochastic temperature with learnable temperature (ablation) | ViT-S CDFSL · CDFSL, 5-way 5-shot | average accuracy: 64.02±0.07 vs 66.62±0.19 | Hurt |
| replace global attention-map abandonment with element-wise dropout (ablation) | ViT-S CDFSL · CDFSL, 5-way 5-shot | average accuracy: 64.11±0.17 vs 66.62±0.19 | Hurt |
| mask diagonal attention instead of using global temperature (ablation) | ViT-S CDFSL · CDFSL, 5-way 5-shot | average accuracy: 64.38±0.17 vs 66.62±0.19 | Hurt |
| fix the attention network during training (ablation) | ViT-S CDFSL · CDFSL, 5-way 5-shot | average accuracy: 64.08±0.19 vs 66.62±0.19 | Hurt |
| abandon all attention rather than stochastically abandoning query-key attention (ablation) | ViT-S CDFSL · CDFSL, 5-way 5-shot | average accuracy: 65.16±0.16 vs 66.62±0.19 | Hurt |
| replace query-key attention with cosine relation (ablation) | ViT-S last-block attention · CropDiseases, 5-way 1-shot | accuracy: 79.10 -> 79.98 | Helped |
| replace query-key attention with average relation (ablation) | ViT-S last-block attention · CropDiseases, 5-way 1-shot | accuracy: 79.10 -> 80.73 | Helped |
| add default query-key self-attention to input tokens (ablation) | ViT-S last block · CropDiseases, 5-way 1-shot | accuracy: 79.63 -> 79.10 | Hurt |
| add default query-key self-attention to input tokens (ablation) | ViT-S last block · miniImageNet, 5-way 1-shot | accuracy: 90.17 -> 92.59 | Helped |
Surprising findings
- Setting attention to a uniform map (temperature 0) for all blocks improves target-domain accuracy, even though it removes query-key attention entirely.
- Learnable temperature and dropout-based variants give only marginal gains compared with the proposed global, stochastic temperature.
Limitations
- Evaluated on only four target domains (CropDiseases, EuroSAT, ISIC2018, ChestX), so generality across domains is untested.
- Abandoning all attention (p=1) hurts performance, so the method depends on tuning the abandonment probability.
- Interpretation rests on empirical visualizations and CKA analyses rather than theory.
Experimental setup
Datasets: miniImageNet CropDiseases EuroSAT ISIC2018 ChestX
Benchmarks: miniImageNet CropDiseases EuroSAT ISIC2018 ChestX
Metrics: 5-way 1-shot accuracy 5-way 5-shot accuracy domain similarity (CKA)
Baselines: StyleAdv FLoR SDT MEM-FS PMF GNN+AFA LDP-net RDC MICM Learnable Temp.
Builds on: DINO StyleAdv ProtoNet Dropout
Closest papers by meaning
- A Closer Look at the CLS Token for Cross-Domain Few-Shot Learning (NeurIPS 2024 · similarity 0.91)
- Random Registers for Cross-Domain Few-Shot Learning (ICML 2025 · similarity 0.91)
- Revisiting Continuity of Image Tokens for Cross-domain Few-shot Learning (ICML 2025 · similarity 0.90)
- Flatten Long-Range Loss Landscapes for Cross-Domain Few-Shot Learning (CVPR 2024 · similarity 0.88)
- On the Surprising Effectiveness of Attention Transfer for Vision Transformers (NeurIPS 2024 · similarity 0.87)
- Attention Transfer Is Not Universally Effective for Vision Transformers (NeurIPS 2026 · similarity 0.86)
Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.
