arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2207.03341cs.CVcs.AIcs.LG
收藏

无Softmax的线性Transformer

Softmax-free Linear Transformers

School of Data Science, Fudan University(复旦大学数据科学学院);University of Surrey(萨里大学)

Jiachen Lu, Junge Zhang, Xiatian Zhu, Jianfeng Feng, Tao Xiang, Li Zhang

AI总结:

提出无Softmax的线性Transformer(SOFT),用高斯核替代点积相似性,通过低秩分解和牛顿-拉弗森逆估计实现线性复杂度,在多个视觉任务上提升效率与精度平衡。

摘要:

视觉Transformer(ViTs)推动了视觉感知任务的最先进水平。支撑ViTs优势的自注意力机制在计算和内存使用上具有二次复杂度。这促使了以线性复杂度近似自注意力的方法的发展。然而,本工作中的深入分析揭示,现有方法在视觉识别中要么在理论上存在缺陷,要么在经验上无效。我们确定它们的局限性源于在近似过程中继承了基于Softmax的自注意力,即使用Softmax函数对令牌特征向量之间的缩放点积进行归一化。由于保留Softmax操作对后续的任何线性化努力构成挑战。基于这一见解,提出了一系列无Softmax的Transformer(SOFT)。具体来说,采用高斯核函数替代点积相似性,使得完整的自注意力矩阵可以在低秩矩阵分解下被近似。为了计算鲁棒性,我们仅在前向过程中使用迭代牛顿-拉弗森方法估计Moore-Penrose逆,而在反向过程中仅计算一次其理论梯度。为了进一步扩展适用性(例如,密集预测任务),引入了一种高效的对称归一化技术。在ImageNet、COCO和ADE20K上的大量实验表明,我们的SOFT显著提高了现有ViT变体的计算效率。凭借线性复杂度,SOFT允许更长的令牌序列,从而在准确性和复杂度之间实现优越的权衡。代码和模型可在https://github.com/fudan-zvg/SOFT获取。

英文摘要:

Vision transformers (ViTs) have pushed the state-of-the-art for visual perception tasks. The self-attention mechanism underpinning the strength of ViTs has a quadratic complexity in both computation and memory usage. This motivates the development of approximating the self-attention at linear complexity. However, an in-depth analysis in this work reveals that existing methods are either theoretically flawed or empirically ineffective for visual recognition. We identify that their limitations are rooted in the inheritance of softmax-based self-attention during approximations, that is, normalizing the scaled dot-product between token feature vectors using the softmax function. As preserving the softmax operation challenges any subsequent linearization efforts. By this insight, a family of Softmax-Free Transformers (SOFT) are proposed. Specifically, a Gaussian kernel function is adopted to replace the dot-product similarity, enabling a full self-attention matrix to be approximated under low-rank matrix decomposition. For computational robustness, we estimate the Moore-Penrose inverse using an iterative Newton-Raphson method in the forward process only, while calculating its theoretical gradients only once in the backward process. To further expand applicability (e.g., dense prediction tasks), an efficient symmetric normalization technique is introduced. Extensive experiments on ImageNet, COCO, and ADE20K show that our SOFT significantly improves the computational efficiency of existing ViT variants. With linear complexity, much longer token sequences are permitted by SOFT, resulting in superior trade-off between accuracy and complexity. Code and models are available at https://github.com/fudan-zvg/SOFT.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑