Despite the recent success in many applications, the high computational requirements of vision transformers limit their use in resource-constrained settings. While many existing methods improve the quadratic complexity of attention, in most vision transformers, self-attention is not the major computation bottleneck, e.g., more than 80% of the computation is spent on fully-connected layers. To improve the computational complexity of all layers, we propose a novel token downsampling method, called Token Pooling, efficiently exploiting redundancies in the images and intermediate token representations. We show that, under mild assumptions, softmax-attention acts as a high-dimensional low-pass (smoothing) filter. Thus, its output contains redundancy that can be pruned to achieve a better trade-off between the computational cost and accuracy. Our new technique accurately approximates a set of tokens by minimizing the reconstruction error caused by downsampling. We solve this optimization problem via cost-efficient clustering. We rigorously analyze and compare to prior downsampling methods. Our experiments show that Token Pooling significantly improves the cost-accuracy trade-off over the state-of-the-art downsampling. Token Pooling is a simple and effective operator that can benefit many architectures. Applied to DeiT, it achieves the same ImageNet top-1 accuracy using 42% fewer computations.
翻译:尽管最近在许多应用程序中取得了成功,但视觉变压器的高计算要求限制了其在资源限制环境中的使用。虽然许多现有方法改善了注意力的四重复杂度,但在大多数视觉变压器中,自我注意并不是主要的计算瓶颈,例如,80%以上的计算在完全连接的层上花费。为了改进所有层的计算复杂性,我们提议了一种新型的象征性降压方法,称为“托肯集合”,有效地利用图像和中间代号表达式中的冗余。我们显示,在轻度假设下,软式注意作为高维低通路(moooating)过滤器。因此,其输出含有冗余,可以调整以在计算成本和准确性之间实现更好的交换。我们的新技术通过尽量减少降压造成的重建错误,准确地接近了一套象征性。我们通过高成本效益的组合解决了这个优化问题。我们严格地分析和比较以前的降压方法。我们的实验显示,托肯合并大大改进了42度低端的低端网络(moos)过滤器,从而可以实现成本-准确性最高计算结构的效益,从而实现了一种超状态。