Skip to main content
QUICK REVIEW

[论文解读] Vision Transformers provably learn spatial structure

Samy Jelassi, Michael E. Sander|arXiv (Cornell University)|Oct 13, 2022
Advanced Neural Network Applications被引用 7
一句话总结

本文提出一个理论框架,表明视觉变换器(ViTs)即使在没有显式局部性归纳偏置的情况下,也能通过一种称为“图像块关联”的机制隐式学习空间结构。通过分析仅使用位置注意力的简化ViT模型,作者证明梯度下降优化会导致空间局部化的注意力模式,从而实现对具有相似结构的下游任务的样本高效迁移。

ABSTRACT

Vision Transformers (ViTs) have achieved comparable or superior performance than Convolutional Neural Networks (CNNs) in computer vision. This empirical breakthrough is even more remarkable since, in contrast to CNNs, ViTs do not embed any visual inductive bias of spatial locality. Yet, recent works have shown that while minimizing their training loss, ViTs specifically learn spatially localized patterns. This raises a central question: how do ViTs learn these patterns by solely minimizing their training loss using gradient-based methods from random initialization? In this paper, we provide some theoretical justification of this phenomenon. We propose a spatially structured dataset and a simplified ViT model. In this model, the attention matrix solely depends on the positional encodings. We call this mechanism the positional attention mechanism. On the theoretical side, we consider a binary classification task and show that while the learning problem admits multiple solutions that generalize, our model implicitly learns the spatial structure of the dataset while generalizing: we call this phenomenon patch association. We prove that patch association helps to sample-efficiently transfer to downstream datasets that share the same structure as the pre-training one but differ in the features. Lastly, we empirically verify that a ViT with positional attention performs similarly to the original one on CIFAR-10/100, SVHN and ImageNet.

研究动机与目标

  • 理解视觉变换器(ViTs)在缺乏显式局部连接归纳偏置的情况下,如何学习空间结构。
  • 研究使ViTs通过训练学习空间局部化注意力模式而实现泛化的隐式归纳偏置。
  • 形式化并证明仅使用位置注意力的简化ViT模型,通过梯度下降隐式学习空间结构。
  • 证明该隐式偏置可实现对与预训练数据集具有相同空间结构的下游任务的样本高效迁移。
  • 为ViTs从随机初始化开始仅通过基于梯度的优化学习局部连接模式这一经验观察提供理论依据。

提出的方法

  • 定义一个简化ViT模型,其中注意力矩阵仅依赖于位置编码,称为“位置注意力机制”。
  • 构建一个合成的、具有空间结构的二分类数据集,以隔离空间模式的学习。
  • 证明在总体风险(理想化设定)上进行梯度下降会导致图像块关联,即注意力头学会将空间上连续的图像块分组。
  • 建立该图像块关联可实现泛化,并使模型能对具有相同空间结构的下游数据集实现样本高效迁移。
  • 通过训练过程中注意力系数的不变性与对称性分析,证明模型隐式学习了空间局部性。
  • 利用对数不等式和浓度不等式(如Chernoff不等式)控制优化过程中注意力权重和损失的增长。

实验结果

研究问题

  • RQ1视觉变换器如何在缺乏显式局部连接归纳偏置的情况下学习空间局部化模式?
  • RQ2何种隐式归纳偏置使ViTs即使从随机初始化出发,也能泛化到空间结构化任务?
  • RQ3仅注意力依赖于位置编码的简化ViT模型是否仍能学习并泛化到空间结构化数据?
  • RQ4隐式学习的空间结构(图像块关联)是否能实现对具有相似空间模式的下游任务的样本高效迁移?
  • RQ5在梯度下降训练过程中,视觉变换器中空间局部性出现的理论机制是什么?

主要发现

  • 仅使用位置注意力的单层单头ViT在梯度下降过程中实现图像块关联,即学会将空间上连续的图像块分组。
  • 理论分析证明,该图像块关联在理想化的总体风险最小化和现实中的经验风险最小化设定下均成立。
  • 尽管底层优化问题存在多个解,该模型仍通过隐式学习空间结构实现泛化。
  • 图像块关联使模型能够对与预训练数据集具有相同空间结构的下游数据集实现样本高效迁移。
  • 实验结果表明,仅使用位置注意力的ViT在CIFAR-10/100、SVHN和ImageNet上的性能与标准ViTs相当。
  • 对注意力权重演化的理论边界分析表明,模型在训练过程中通过注意力系数的不变性与对称性维持了空间一致性。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。