通过清理注意力头提升CLIP在跨域泛化中的表现。
Attention Head Purification: A New Perspective to Harness CLIP for Domain Generalization
- 从任务和领域双角度净化CLIP的注意力头,提升模型适应性。
- 在多个基准上达到或超越现有最优结果,性能显著提升。
- 适合需要高效利用预训练视觉模型的跨域学习研究者。
领域泛化(DG)旨在从多个源域中学习模型,以在未见目标域上取得良好表现。近期工作引入CLIP因其出色的图像-文本对齐能力和零样本性能用于DG任务。以往方法多采用全量微调或提示学习范式,但主要关注避免原始知识遗忘,而忽视了CLIP中天然包含的领域特异性线索会限制其泛化能力。本文提出一种新视角:注意力头净化。我们观察到不同注意力头可能编码图像的不同属性,合理选择可显著提升跨域性能。基于此,我们在任务层与领域层分别进行净化:任务层设计头感知的LoRA使各头更适配具体任务;领域层采用简单门控策略进行头选择,并使用MMD损失促使被掩码头特征更具域不变性,强调更通用的属性。训练中联合执行两类净化。在多个代表性DG基准上实验表明,虽方法简洁,仍显著优于现有最先进方法。
原文摘要 · Abstract (English)
Domain Generalization (DG) aims to learn a model from multiple source domains to achieve satisfactory performance on unseen target domains. Recent works introduce CLIP to DG tasks due to its superior image-text alignment and zeros-shot performance. Previous methods either utilize full fine-tuning or prompt-learning paradigms to harness CLIP for DG tasks. Those works focus on avoiding catastrophic forgetting of the original knowledge encoded in CLIP but ignore that the knowledge encoded in CLIP in nature may contain domain-specific cues that constrain its domain generalization performance. In this paper, we propose a new perspective to harness CLIP for DG, i.e., attention head purification. We observe that different attention heads may encode different properties of an image and selecting heads appropriately may yield remarkable performance improvement across domains. Based on such observations, we purify the attention heads of CLIP from two levels, including task-level purification and domain-level purification. For task-level purification, we design head-aware LoRA to make each head more adapted to the task we considered. For domain-level purification, we perform head selection via a simple gating strategy. We utilize MMD loss to encourage masked head features to be more domain-invariant to emphasize more generalizable properties/heads. During training, we jointly perform task-level purification and domain-level purification. We conduct experiments on various representative DG benchmarks. Though simple, extensive experiments demonstrate that our method performs favorably against previous state-of-the-arts.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。