arXivDaily arXiv每日学术速递 周一至周五更新
​通知:联邦节假日调休:哥伦布日 / 原住民日(Columbus Day / Indigenous Peoples' Day),今日(13日)无更新。
arXiv 2405.16605cs.CV

揭秘视觉中的 Mamba:线性注意力视角

Demystify Mamba in Vision: A Linear Attention Perspective

Tsinghua University(清华大学);Alibaba Group(阿里巴巴集团)

Dongchen Han, Ziyi Wang, Zhuofan Xia, Yizeng Han, Yifan Pu, Chunjiang Ge, Jun Song, Shiji Song, Bo Zheng, Gao Huang

AI总结:

本文从线性注意力视角统一解析 Mamba,识别遗忘门与模块设计为其成功关键,并提出 MILA,在分类和高分辨率密集预测上优于视觉 Mamba。

摘要:

Mamba 是一种具有线性计算复杂度的高效状态空间模型。近期,它在各类视觉任务中处理高分辨率输入时展现出令人瞩目的效率。本文揭示,强大的 Mamba 模型与在实践中通常逊于传统 Transformer 的线性注意力 Transformer 之间存在惊人的相似性。通过探究高效的 Mamba 与表现欠佳的线性注意力 Transformer 之间的异同,我们进行了全面分析,以揭示 Mamba 成功背后的关键因素。具体而言,我们在统一表述下重新形式化选择性状态空间模型和线性注意力,将 Mamba 重新表述为具有六大区别的线性注意力 Transformer 变体:输入门、遗忘门、快捷连接、无注意力归一化、单头以及改进的模块设计。对于每一项设计,我们都细致分析其优缺点,并通过实验评估其对视觉任务中模型性能的影响。有趣的是,结果突出表明遗忘门和模块设计是 Mamba 成功的核心贡献因素,而其他四项设计则不那么关键。基于这些发现,我们将这两个关键设计的优点融入线性注意力,提出了 Mamba 启发的线性注意力(Mamba-Inspired Linear Attention,MILA)模型。所得模型在图像分类和高分辨率密集预测任务中均优于各类视觉 Mamba 模型,同时具备可并行计算和快速推理速度。代码可在 https://github.com/LeapLabTHU/MLLA 获取。

英文摘要:

Mamba is an effective state space model with linear computation complexity. It has recently shown impressive efficiency in dealing with high-resolution inputs across various vision tasks. In this paper, we reveal that the powerful Mamba model shares surprising similarities with linear attention Transformer, which typically underperform conventional Transformer in practice. By exploring the similarities and disparities between the effective Mamba and subpar linear attention Transformer, we provide comprehensive analyses to demystify the key factors behind Mamba's success. Specifically, we reformulate the selective state space model and linear attention within a unified formulation, rephrasing Mamba as a variant of linear attention Transformer with six major distinctions: input gate, forget gate, shortcut, no attention normalization, single-head, and modified block design. For each design, we meticulously analyze its pros and cons, and empirically evaluate its impact on model performance in vision tasks. Interestingly, the results highlight the forget gate and block design as the core contributors to Mamba's success, while the other four designs are less crucial. Based on these findings, we propose a Mamba-Inspired Linear Attention (MILA) model by incorporating the merits of these two key designs into linear attention. The resulting model outperforms various vision Mamba models in both image classification and high-resolution dense prediction tasks, while enjoying parallelizable computation and fast inference speed. Code is available at https://github.com/LeapLabTHU/MLLA.

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

↑