The Position Embedding (PE) is critical for Vision Transformers (VTs) due to the permutation-invariance of self-attention operation. By analyzing the input and output of each encoder layer in VTs using reparameterization and visualization, we find that the default PE joining method (simply adding the PE and patch embedding together) operates the same affine transformation to token embedding and PE, which limits the expressiveness of PE and hence constrains the performance of VTs. To overcome this limitation, we propose a simple, effective, and robust method. Specifically, we provide two independent layer normalizations for token embeddings and PE for each layer, and add them together as the input of each layer's Muti-Head Self-Attention module. Since the method allows the model to adaptively adjust the information of PE for different layers, we name it as Layer-adaptive Position Embedding, abbreviated as LaPE. Extensive experiments demonstrate that LaPE can improve various VTs with different types of PE and make VTs robust to PE types. For example, LaPE improves 0.94% accuracy for ViT-Lite on Cifar10, 0.98% for CCT on Cifar100, and 1.72% for DeiT on ImageNet-1K, which is remarkable considering the negligible extra parameters, memory and computational cost brought by LaPE. The code is publicly available at https://github.com/Ingrid725/LaPE.
翻译:位置嵌入器( PE) 对视野变异器( VT) 至关重要, 原因是自我注意操作的变异性差变。 分析 VT 中每个编码层的输入和输出时, 我们发现默认的 PE 组合法( 简单添加 PE 和 补丁嵌入) 运行相同的折线转换为代号嵌入和 PE, 这会限制 PE 的表达性, 从而限制 VT 的性能。 为了克服这一限制, 我们提出了简单、 有效和 稳健的方法 。 具体地说, 我们通过对 VT 的代号嵌入和 PE 进行两个独立的层化分解。 我们发现默认的 PE 组合法( 简单添加 PE) 和 PE, 并把它们合并为每个层的 Muti - 首席自我注意模块的输入。 由于该方法允许该模型对 PE 的信息进行适应性调整, 我们将其命名为图层- 适应性定位定位定位, 缩成 LaPE 。 广泛的实验显示, 可以用不同类别的 VT, PE 和 MIE 格式的 格式的精确性 格式的 格式是 CILE 和 的 。 的 级 级 级 的 的 级 级 的 的 级 级 的 级 级 级 级 级 的 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级 级