迈向更深层次的理解:通过卷积视角审视RetNet
Toward a Deeper Understanding: RetNet Viewed through Convolution
AI总结:
本文从CNN视角分析RetNet的局部建模机制,提出仅含两个可学习参数的高斯混合掩码(GMM)来改进ViT的自注意力局部建模,以几乎零额外成本提升ViT性能。
摘要:
Vision Transformer(ViT)在广泛的图像识别任务中取得的成功已被大量报道。ViT能够学习优于CNN的全局依赖关系,然而CNN固有的局部性可以替代昂贵的训练资源。近期,RetNet在语言建模领域的卓越表现引起了关注,其凭借显式局部建模超越了Transformer,使研究者的关注点转向CV领域的Transformer。本文从CNN视角研究RetNet的有效性,并提出了一种针对视觉领域定制的RetNet变体。与RetNet类似,我们通过在原始自注意力矩阵上施加权重掩码来改进ViT的局部建模。一种直接的局部自适应自注意力矩阵的方法可以通过逐元素可学习权重掩码(ELM)实现,我们的初步结果显示了良好的效果。然而,逐元素的简单可学习权重掩码不仅带来不可忽视的额外参数开销,还增加了优化复杂度。为此,本文提出了一种新颖的高斯混合掩码(GMM),其中一个掩码仅具有两个可学习参数,并且可以方便地用于任何其注意力机制允许使用掩码的ViT变体。在多个小数据集上的实验结果表明,我们提出的高斯掩码能够以几乎零额外参数或计算成本的方式免费提升ViT的性能。我们的代码可在https://github.com/CatworldLee/Gaussian-Mixture-Mask-Attention公开获取。
英文摘要:
The success of Vision Transformer (ViT) has been widely reported on a wide range of image recognition tasks. ViT can learn global dependencies superior to CNN, yet CNN's inherent locality can substitute for expensive training resources. Recently, the outstanding performance of RetNet in the field of language modeling has garnered attention, surpassing that of the Transformer with explicit local modeling, shifting researchers' focus towards Transformers in the CV field. This paper investigates the effectiveness of RetNet from a CNN perspective and presents a variant of RetNet tailored to the visual domain. Similar to RetNet we improves ViT's local modeling by applying a weight mask on the original self-attention matrix. A straightforward way to locally adapt the self-attention matrix can be realized by an element-wise learnable weight mask (ELM), for which our preliminary results show promising results. However, the element-wise simple learnable weight mask not only induces a non-trivial additional parameter overhead but also increases the optimization complexity. To this end, this work proposes a novel Gaussian mixture mask (GMM) in which one mask only has two learnable parameters and it can be conveniently used in any ViT variants whose attention mechanism allows the use of masks. Experimental results on multiple small datasets demonstrate that the effectiveness of our proposed Gaussian mask for boosting ViTs for free (almost zero additional parameter or computation cost). Our code can be publicly available at https://github.com/CatworldLee/Gaussian-Mixture-Mask-Attention.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。