Demystify Mamba in Vision: A Linear Attention Perspective
Authors: Dongchen Han
Ziyi Wang
Zhuofan Xia
Yizeng Han
Yifan Pu
Chunjiang Ge
Jun Song
Shiji Song
Bo Zheng
Gao Huang
Venue: NeurIPS 2024 poster (2024)
Keywords: Mamba
Linear Attention Transformer
Primary area: deep_learning_architectures

Abstract: 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.

Demystify Mamba in Vision: A Linear Attention Perspective
Dongchen Han'
Ziyi Wang'
Zhuofan Xia
Yizeng Han' Yifan Pul Chunjiang Ge
Jun Song?
Shiji Song'
Bo Zheng?
Gao Huang
Tsinghua University
Alibaba Group
Abstract
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 Trans- former, 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 linear attention Transformer with six major distinctions: input gate, forget gate, shortcut, no attention normalization, single-head, and modified block design. For each design, 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 the core contributors Mamba's 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 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
Introduction
Recently, state space models, exemplified by Mamba, have rapidly gained wide research interest. In contrast to the quadratic complexity of prevailing Transformer models, the state-space-based Mamba offers effective sequence modeling with linear complexity. This crucial property allows Mamba to handle extremely long sequences with manageable computational costs, making it promising architecture for both natural language processing [14, 29] and visual recognition [57, 31J.
However, Mamba is not the first model to achieve global modeling with linear complexity. Linear attention [26], an early work, was proposed an computationally efficient alternative to the widely adopted Softmax attention [42]. namely dot- dot-product attention. Specifically, linear attention replaces the non-lineat Softmax function in attention operation with linear normalization. This enables change in computation order from (QKT) V to Q(K V), thus reducing computation complexity from (N22) to O(N). Despite its efficiency, previous works [4, 39, 15, 16] proved that linear attention suffers from insufficient expressive power, making it impractical for real applications. Surprisingly, we find very close relationship between the formulas of high- perforrrreee Mamba
"Corresponding Author.
38th Conference on Neural Information Processing Systems (NcurIPS 2024).

---

D
Y1
(a) SSM in Mamba
(b) Single Head Linear Attention
Figure I: Illustration of selective SSM in Mamba (eq. (11)) and single head linear attention (eq. (12)). can be seen that selective SSM resembles single-head linear attention with additional input gate A forget gate A; and shortcut D @ #i, while omitting normalization Q;
and subpar linear attention Transformer. Therefore, a compelling research question emerges: What factors contribute to Mamba's 's success and its significant superiority to linear attention Transformer?
In this paper, we offer both theoretical and empirical analyses unveil Mamba through the lens of linear attention Transformer. Specifically, we rewrite the formulas of selective state space model and linear attention within a unified formulation, depicting Mamba as a variation of linear atten- tion Transformer with six distinctions: input gate, forget gate, shortcut, no attention normalization, single-head, and modified block design. To demystify what factors lead to Mamba's effectiveness, empirical studies on vision tasks conducted to assess the impact of each special design. The results demonstrate that the forget gate and block design tend to be the two core contributors to Mamba's superiority. While the block design can be easily adopted, the forget gate necessitates recurrent com- vision models. Therefore, we delve
putation, which may not be well-suited for pon-auto-regressee into the essence of the forget gate and verify that it can be replaced by suitable positional encoding in vision tasks. Based on our findings, we introduce the two core contributors or their alternatives to linear attention Transformer, presenting Experimental results demonstrate that MII.A achieves superior results to various vision Mamba models in both image classification and high-resolution dense prediction tasks, validating that linear attention can surpass Mamba with the merits of two core designs.
Mamba-Inspired Linear Attention (MILA) model.
Our main contributions and takeaways are as follows:
We reveal Mamba's s close relationship linear attention Transformer: Mamba and linear attention Transformer can be formulated within unified framework, with Mamba exhibiting six distinct designs compared to the conventional linear attention paradigm: input gate, forget gate, shortcul, attention normalization, single-head and modified block design.
We provide detailed analyses of each special design and empirically validate that the forget gate and block design largely lead to Mamba' superiority. Additionally, we demonstrate that the recurrent calculation of the forget gate might not be ideal for vision models. Instead, proper positional encoding can function the forget gate in vision tasks, while preserving parallelizable computation and fast inference speed.
We develop a series of linear attention vision Transformer models named MILA, which inherit the merits of Mamba and tend to be more suitable for vision tasks than the original Mamba model.
Related Works
Vision Transformer and attention. Originating from natural language processing, Transformer and attention have been highly successful in vision tasks [32, 36, 37], demonstrating superiority to the conventional CNN models[18, 7, 12]. However, the quadratic complexity widely adopted Softmax attention [42] poses challenges in handling high-resolution images. Numerous works have attempted to reduce the computational cost by introducing local attention windows [32, 9, 20] or sparsity [43, 45, 56]. Lincar attention [26], another approach, inherently offers linear complexity O(N) and is

---

capable of modeling long sequences. Despite its efficiency, previous works [4, 39, 47, 17] have shown that linear attention always fails deliver satisfactory results, limiting its applicability.
Mamba [14] is recently proposed state space model that achieves effective sequence modeling with linear complexity. Motivated by its potential for modeling high-resolution images, many researchers try to apply Mamba to vision tasks [14, 31, 27, 25, 38, 49, 48, 23]. For instance, VMamba [31] introduces a cross-scan module enable ID selective scanning in 2D image space, LocalMamba [25] utilizes local windows to enhance local modeling capability. EfficientVMambe [38] designs an strous-based selective scan approach to enhance efficiency. addition, MambaOut [51] analyzes whether Mamba is needed for vision, and explainability methods [1] have also been proposed.
In contrast to incorporating Mamba into vision, this paper reveals the surprising similarities between the formulas of inferior linear attention Transformer and powerful Mamba model. This interesting finding gives the opportunity demystify the key factors behind Mamba's success.
3 Preliminaries
This section revisits the formulations of attention and selective state space model. To facilitate comparison in Sec. 4, we employ identical notations for the dimensions of certain variables in both linear attention and selective state space model, and make some modifications to the formula formats.
3.1 Attention Mechanism
Let æ E R denote sequence of features with dimension C. Single head Softmax atten- tion [42]. also known dot-product attention, can be written as:
Q xWQ K= zW.. V= y = Σ exp (Q.KTIVA
V,,
(I)
j= exp (Q:K] /VD)
where Q. WK R Wv e RCCC denote projection matrices, Q, E Nxd V NxC
represent query/key/valuc matrices, and E ViERI are individual query/key/value tokens. Softmax attention computes the similarities between each query-key pair, leading to ((N2) complexity. Therefore, it incurs unbearable computational cost in long-sequence modeling scenarios.
Linear attention [26], another attention paradigm, is proposed to effectively address this problem by reducing the computation complexity to O(N). Specifically, linear attention replaces the non-linear Softmax function with linear normalization, and adopts an additional kernel function & in Q and K:
QKKj J=1 Q.K V, = Q CARKJ. (2)
N
Q = ==((Wo) K (kx V= yi
Q (
This enables the rearrangement of the computation order from (QK to Q(K VV) based on the associative property of matrix multiplication, thus reducing computation complexity to O(N).
Equation (2) defines linear attention with global receptive field, where each query aggregates information from all keys and values. In practice, linear attention can also be implemented in autoregressive models, restricting the receptive field of the i-th token proceeding tokens, i.c., token j.j < i. This causal linear attention is formulated as follows:
Q (E K KJVV)
Q,S: Q,Z,'
y.
S -=>K K
V.
V, Z,
Σ K.
(3)
Q
K
This results in a recurrent linear attention form:
= S K.T Vi, Z. = Z + K, y: y= Q.S//..
(4)
3

---

3.2 Selective State Space Model
State space model (SSM). The classical state space model is a continuous system that maps the imput axt) E R to output y(t) E R through a hidden state h(t) E R which can be written as follows:
h' (t) (h(() + (x((), ((t) = Ch(t) + Dr((),
E A Raxd (, e R
(5)
u(t) CERixd DER.
Discrete SSM. To be applied to deep neural networks, SSM is first transformed into its discrete version through zero-order hold discretization. Specifically, the continuous parameters A, B are transformed into their discretized counterparts A, B using timescale parameter A E IR:
A (A),
B (AA) (aAA))((exx)) (exp(AA) - AB AB.
(6)
Therefore, discrete SSM rewrite eq. (5)
h; = Ah;-1 + B
T7 E R, A Rdxd B, E Baxx
= Ch. + Dra,
VA ER, C Redlx DER.
Selective State Space Model. Mamba [14] improves SSM with selection, presenting the selective state space model. The param- eters B, C, A is set the function of zi, thus becoming input-dependent parameters B; C, A,. As a result, the discretized pa- rameters A, exp( A,),, B, A, are also input-dependent. The selective state space model be written as:
(a) Selective SSM Model
(b) Equivalent Form
Figure 2: Illustration of selective state space model
(eq. (8)) and its equivalent form (eq. (9)).
h = -, + B
24 R, A, Bddd Bi, 1,,h,,,,,, Rx
(8)
= C, + DI,
Vi E R, C, E DER.
For the convenience of subsequent derivation, we make three modifications to eq. (8):
Mamba practically sets A, A, as diagonal matrices. Therefore, A, À, + h4-1, where A; diag( (A.) 1x denotes the matrix composed of diagonal elements of A,
Given B: B; and A; R, have B, A, B,, B,(,,,) B, (A, @ m4).
. Dr, = D @ where @ denotes the Hadamard product, i.c., element- wise multiplication.
Consequently, rewrite eq. (8) as:
h: = A, 3 h; + B, + xi),
E. R. A, B, h; 1. Rdx1
y: C,h, D Z4,
Vi E R. C. E DER.
The selective state space model formulated eq. can only deal with scalar input x; R. To operate over an input sequence æ E NCC x; E gIxC' Mamba applies eq. (9) independently to each channel, leading the following formulations:
h; = A, @ h1-1- + B,(A; ④ ax)
A, EIIC y: EREII C, CR DERIXC
A,. hi- h E Rdc B, ER
(10)
y: C.h, + Bis
where B; Ci Ai are derived from the input. Specifically, Mamba employs B B B= C=
x WW., A Softpplus W, W2) to produce the parameters B RdxN C Nxd AERNCC
where WB, B, Wo R Cxd W e CxCo CGc are projection matrices. Notably, eq. (10) is exactly the selective SSM employed in Mamba, only make modifications to formula formats.
4 Connecting Mamba and Linear Attention Transformer
In this section, we reveal the similarities and disparities between Mamba and linear attention Trans- former from two perspectives: core operation and macro architecture.

---

4.1 Interpreting Selective State Space Model as Linear Attention
As detailed in Sec. 3, for an input sequence of N tokens æ E RRN the formulations of selective state space model and linear attention are provided by eq. (10) and eq. (4), respectively. Many underlying similarities exist between the formulas of these two operations. To facilitate comprehension, we rewrite eq. (10) and eq. (4) with a unified formulation as follows:
h: = A, 3 h + B, O æi),
S 10 1, K; (10 Vi),
(1I)
(12)
y: C,h// / + D m;
y: - /
As illustrated in Fig. 1, close relationship between eq. (11) and eq. (12) is evident. Specifically, h; S; E gdxc,
E g 2; 1g~Vo V; E 1x and Q E 1ixdd Therefore, selective SSM can be viewed as a special variation of linear attention, indicating a very close connection between these two mechanisms. Furthermore, four major differences can be observed:
1. In eq. (11), the input 2; is augmented by Hadamard product with A, Since A = Softplus(# W1 W2), all elements of A; are positive. Therefore, view A; in- put gate, controlling whether to let the input æ; into the hidden state.
2. There an additional A, in eq. (1I). Mamba sets A as diagonal matrix with negative diagonal elements, thus ensuring all elements A, = diag( (A.) = exp(diag( A A)) to fall between 0 and 1. Hence, we interpret A, as forget gate, which decides the degree of attenuation for the previous hidden state h;-1-
3. A learnable shortcut from the input æ; to the output y; is employed eq. (11), i.c. C Z;,
4. As depicted in eq. (12), linear attention divides the output by Q.Z, to maintain that the attention weights sum up to 1, while eq. (11) does not have such normalization.
In addition to these four differences, it is also important to note that eq. (12) represents single-head linear attention there is only group of Q, K. This indicates that the selective state space model is akin to single-head linear attention and does not incorporate a multi-head design.
In word, the similarities and disparities between selective SSM and linear attention can be summa- rized as: selective state space model resembles linear attention with additional input gate, forget gate and shortcut, while omitting normalization and multi-head design.
4.2 Analysis of Differences in Core Operations
Input gate. As discussed before, A; actually functions as an input gate for I,, determining its access to the hidden state. The values of this input gate are predicted from the current input a; as A Softplus(æ,, W, 22). Therefore, by learning the weight of W1, W2, the model can discern the "utility" of v,, generating large A, values for "useful" x; and small ones for "less useful" æ, For example, in vision tasks, tokens representing foreground objects may yield larger input gate values, while background tokens may yield smaller ones.
Forget gate. A, acts as a forget gate in selective state space model. offering two essential properties: local bias and positional information. Firstly, all elements of A, strictly range from 0 1, indicating that the model consistently decays the previous hidden state h;-1 upon the arrival of the current token Di. This results in a strong local bias. Secondly, A, provides positional information for the model. It ensures that the model is sensitive to the order of input sequences. Without this forget gate, rearranging the order of the preceding sequence will not affect subsequent outputs. For instance, in recurrent linear attention, if we change the order of æ and ø2, the outputs y., i 2 3 will not change. Hence, the forget gate A, plays an important role in selective SSM
Despite its effectiveness, incorporating the forget gate also poses significant challenges. Firstly, it forces the model to adopt the recurrent formulation during both training and inference. Previous state space models typically use global convolution for efficient parallelizable training, which is incompatible with selective SSM due to the input-dependency of Á.. As a remedy, Mamba [14] proposes a hardware-aware algorithm to speed up computation by performing parallel scan in recurrent mode (see the abstract of [14]). Although effective, such recurrent calculation unavoidably reduces model throughput and is still slower than parallel linear attention (eq. (2)). Secondly, the
5

---

Elementarise Sum
Hadamaad Product
MLP
SILU Activation
Linear
MLP
Linear
Narm
Norm
Linear
LA Stock
sON block
MLLA Block
Uneer Atlention
Norn
Norm
Unser
Norm
Liaar
Lineor
(a) Linear Attention Transformer
(b) Mamba
(c) MILA (ours)
Figure 3: Illustration of the macro designs of linear attention Transformer, Mamba and our MILA.
forget gate inherently functions in causal mode, which may not be very suitable for non-auto- regressive vision models. Using the forget gate A, in vision tasks requires transforming the image into a ID sequence and conducting recurrent computation, which limits the receptive field of each image token to its preceding sequence and incurs extra latency. Therefore, we believe that the forget gate is ideally suited for modeling causal data, which naturally needs auto-regressive training and recurrent calculation. However, it may not be as suitable for non-causal data like images. We further speculate that suitable positional encoding can substitute for the forget gate, since certain positional encodings, such as LePE [9] and RoPE [41], ]. can also provide local bias and positional information.
Shortcut. Selective SSM employs a learnable shortcut D @ 2i, making it resemble residual block [22]. This shortcut may aid in optimizing the model and stabilizing training.
Normalization. The output in linear attention is divided by Q.Z, Z to ensure the attention weights sum up 1. We believe this normalization is crucial for stabilizing training and improving model capacity. Let's consider an input ax,, >> O. It is transformed into aQ aK; i, a VV; through projections. If there is no normalization on attention weights, as a increases, aQ, exhibits larger similarities with all keys aQ, K Vj. This indicates that longer tokens will have larger attention scores with every token, leading longer output. Additionally, as a grows bigger, aK; yields bigger similarities with all queries a K Vj. This implies that all queries will focus more longer tokens. As result, longer tokens tend to dominate the whole feature map, while shorter tokens may fail to represent their corresponding semantics. This may result in training instability and could possibly lower model's expressiveness. Normalizing the attention weights can significantly alleviate this issue.
Multi-heade Linear attention commonly utilizes multi-head design [42] for better outcome. Multi- head attention employs multiple groups of Q, K produce attention matrices and allows the model to simultaneously attend to information from various representation subspaces at different positions, thus enhancing its expressive power.
4.3 Analysis of Macro Architecture Design
Modern linear attention Transformer models commonly adopt the block design depicted in Fig. 3(a), which comprised of linear attention sub-block and MLP sub-block. In contrast, Mamba modifies the block design by combining two basic designs, H3 [13] and Gated Attention [24], resulting in the architecture illustrated in Fig. 3(b). The improved Mamba block integrates multiple operations such as selective SSM, depth-wiss convolution, linear mapping, activation function, gating mechanism, etc., and tends to be more effective than the conventional Transformer block design.
4.4 Relationship between Mamba and Linear Attention Transformer
Mamba can be seen as a variant of linear attention Transformer with specialized linear attention and modified block design. The special linear attention variation, i.e. selective state space model, has five major distinctions from the common linear attention paradigm, detailed in Sec. 4.2. And the differences in block designs are analyzed in Sec. 4.3. In summary, Sec. 4.2 and Sec. 4.3 reveal the intimate relationship between Mamba and linear attention Transformer, highlighting a total of six differences: five in core operation and one in macro design.

---

Image
(a) Input Gate Values
(b) Forget Gate Average
(c) Forget Gate Illustration
Forget Values
0.8
0.6
0.4
0.2
A,
A, 0.6
Åi 0.8
0.0
103112 Layer
Figure 4: (a) Visualizations of the distributions of input gate values. (b) The average of forget gate values in different layers. (c) The attenuation effect of different forget gate values.
Empirical Study
Mamba [14] is seen as powerful alternative to Transformer [42], while linear attention models generally being considered inferior 15]. J. In Sec. 4, we illustrated the surprisingly close relationship between Mamba and linear attention Transformer and pointed out six major distinctions. In this section, conduct experiments to assess the impact of each distinction, shedding some light on the core contributors behind Mamba's 's success.
5.1 Implementation
We employ the widely used Swin Transformer [32] architecture to verify the effects of the six differences. Firstly, we substitute the Softmax attention in Swin Transformer with linear attention to create our baseline model. Subsequently, model to assess its impact. Based on the results, we further validate whether linear attention can achieve superior results with the merits of Mamba. Specifically, integrate the useful designs into linear attention Transformer to create our Mamba-Inspired Linear Attention (MILA) model, and assess its effectiveness by comparing it with various vision Mamba designs across multiple tasks, including ImageNet-Ie K classification [8], COCO object detection [30], and ADE20K semantic segmentation [55]. Detailed model architectures and training setups are shown the Appendix.
separately introduce each distinction the baseline
5.2 Empirical Analysis of the Differences
As shown in Tab. 1, we separately apply each distinction to the baseline linear attention model and assess their performances on ImageNet- 1
Table 1: Ablation on the impact of each distinction.
Architecture
#Params FLOPs
Throughput Top-I
Baseline
28M
4.5G
1152
77.6
Input Gate. Introducing the input gate results in modest accuracy improvement of 0.2, indi-
+ Input Gate
29M
4.5G
1069
77.8
Forget Gate
29M
4.8G
743
78.4
cating that it slightly helpful for the model.
+ Shorteut
28M
4.5G
1066
77.8
Visualizations in Fig. 4(a) aid in understanding
Normalization
28M
4.5G
1215
72.4
the impact of the input gate. can be seen that
Multi-head Design
3.9G
1540
73.5
the model tends to generate higher input gate
+ Block Design all.
28M
4.7G
915
79.4
values for more informative regions like fore- Block Design sub.
31M
4.8G
1010
80.9
ground objects, while suppressing less useful tokens. However, the model struggles to generate highly effective input gates, since the input gate values A; Softplus(a;, W, W2) are predicted solely from the current input token without considering the overall semantics of the image. For example, in one image, the dog may be the area of interest, whereas another, might simply be part of the background. Without leveraging information from the entire image, assigning large input gate values to the dog in one image while blocking in another is impractical. Moreover, employing input gate results in 7% decrease in model throughput.
Forget Gate, Employing the forget gate linear attention leads to obvious performance improve- ment from 77.6 to 78.4. However, such accuracy gain comes at cost: the model throughput drops severely from 1152 to 743. This is because the forget gate has to employ recurrent calculation, which is slower than the parallelizable matrix multiplication in linear attention. It's worth noting that we already utilize the hardware-aware algorithm proposed in Mamba to speed up the recurrent computa- tion. Thus, we believe the forget gate might not be very suitable for modeling non-causal data like
7

---

Table 3: Comparison with SOTA Vision Mambas on ImageNet-
Method
Type
#Params
FLOPs
Top-1
Method
Type
#Params
FLOPs
Tup-1
ConyNeXi-T
CNN
29M
4.5G
82.1
ConvNeXi-S [33]
CNN
50M
8.7G
83.1
MambaOut-T
CNN
27M
4.5G
82.7
MambaQut-S [51]
CNN
48M
9.0G
84.1
Swin-T [32]
Transformer
29M
4.5G
81.3
PVTv2-B3 [44]
Transformer
45M
7.9G
83.2
PVTv2-B2
Transformer
25M
4.0G
82.0
CSwin-S [9]
Transformer
35M
6.9G
83.6
Focal-T
Transformer
29M
4.9G
82.2
Focal-S [50]
Transformer
51M
83.6
MViTv2-T
Transformer
24M
4.7G
82.3
MVTTv2-S [28]
Transformer
35M
7.0G
83.6
CSwin-1
Transformer
23M
4.3G
VMamba-S [31]
Mamba
50M
8.7G
83.6
Loca/VMamba-S [25]
Mamba
50M
11.4G
83.7
DINAT-T
Transformer
28M
4.3G
82.7
MILA-S
MILA
43M
7.3G
84.4
NAT-T [20]
Transformer
28M
4.3G
83.2
Non-NeXi-B [33]
CNN
89M
15.4G
83.8
PlainMamba-LI
Mamba
7M
3.0G
77.9
MambaQut-B [51]
85M
15.8G
84.2
Vim-S [57]
Mamba
26M
5.1G
80,3
PVTv2-B5 [44]
Transformr
82M
83.8
Loca/Vim-S
Mamba
4.8G
Focal-B [50]
Transformer
90M
16.4G
84.0
PlainMamba-L22
Mamba
CSwin-B
Transforner
78M
15.0G
84.2
Mambu2D-S [27]
Mambu
NAT-B [20]
Transformer
90M
13,7G
84.3
Etfebant [38]
Mamba
33M
4.0G
81.8
PlainMamba-L3 [49]
Mamba
50M
14.4G
82.3
VMamba-T [31]
Mamba
31M
4.9G
82.5
Mamba2D-B [27]
Manba
94M
83.0
LocalVManta-T
Mamba
26M
VMamha-R [31]
Mamba
MILA-T
MILA
4.2G
MILA-B
MILA
96M
16.2G
85.3
images, which do not inherently require recurrence. As an alternative, we analyze the fundamental properties of the forget gate and attempt to substitute it with other parallelizable operations.
In Fig. 4, we calculate the average of forget gate values in each layer and illustrate the attenuation effect of different forget gate values. In shallow layers, the forget gate values A; = 0.2, indicat- ing that each token primarily focuses on itself and the preceding two tokens, demonstrating strong local bias. In deeper layers, the average is approximately 0.6-0.8, suggesting broad re- ceptive field for each token. This confirms our previous analysis that the forget gate offers two crucial properties for the model, namely local bias and positional information. We conduct
Table 2: Substituting the forget gate with various positional encodings.
#Params
FLOPs
Throughput
Top-1
Baseline
28M
4.5G
1152
77.6
+ Forget Gate
29M
4.8G
743
78.4
+ APE [10]
30M
4.5G
1132
80.0
+ LePE [9]
28M
4.5G
1074
81.6
+ CPE [5]
28M
4.5G
1099
81.7
+ RoPE [41]
28M
4.5G
experiments to verify whether the forget gate can be replaced with proper positional encoding, which can also provide local bias and positional information. Results in Tab. 2 show that APE [42], LePE [9], CPE [5] and RoPE [41] can both help the model yield better results than the forget gate, while maintaining high throughput. We attribute the improved outcomes a broader receptive field. Specifically, when using the forget gate, we have to adopt the recurrent linear attention format which restricts the receptive field of each token the preceding sequence. In contrast, without the forget gate, it is natural to utilize parallel linear attention to achieve a global receptive field.
Shortcut. As illustrated in Tab. 1, the usage of learnable shortcut in linear attention provides 0.2 accuracy gain, while decreasing the throughput from 1 1152 to 1066.
Normalization. Without normalization, the model suffers from severe performance degrada- tion from 77.6 to 72.4. This can be attributed to the issue of long tokens dominating, as discussed in Sec. 4.2. To confirm this, we compute the stan- dard deviation of token lengths (12 norm) in each layer using both the baseline model and the model without attention normalization. As depicted Fig. 5, without normalization, the standard devia- tion token lengths tends to be much larger than the baseline, particularly in the last two layers. This supports analysis that without normalization, the difference in token length becomes significant, with some long tokens dominating the model while others struggling to convey their semantics.
Standard Deviation
Normalization
10?
wio Normalization
10
109
10-1
3
5
9
10
11
12
Layer
Figure 5: The standard deviation of token lengths.
Multi-head. Modern Transformers typically adopt the multi-head design [42] to enhance their ex- pressive power. As shown Tab. 1, removing this design reduces computational cost and accelerates the model but significantly diminishes performance. We consider this trade-off unwarranted.

---

similar input Block Design. We employ two ways to assess the effects of Mamba's block design: 1. Substituting the entire Transformer block with Mamba's block architecture. 2. Replacing the attention sub-block with Mamba's block design, while preserving the MI. sub-block. In both settings, the selective SMM in Mamba's block is substituted with linear attention. To maintain similar FL.OPs, we employ Mamba expansion factors [14] E 2.0 and E = 1.0 for the two settings, respectively. The results are presented in Tab. as "Block Design all" and "Block Design sub". Both replacement approaches result in performance improvements, demonstrating the efficacy of Mamba's 's macro design. Substituting the attention sub-block yields better result, which creates our MILA block shown in Fig. 3(c). Notably, we omit the V projection before linear attention calculation, projection already exists. The module complexity of a MILA block is expressed as:
((MILA)) 2.C + 2 + NC
2NCd
NC + 8NC2
(13)
In/Out, Q/K, Gate Projection
Linear Attention
DWConV
MLP
which is slightly larger than the complexity of a Transformer block (Fig. 3a), UNCC+2NCC+8NC.
5.3 Comparison with Mamba in Vision
Based on our findings, we integrate the forget gate and block design into linear attention, introducing our MILA model. Notably, we practically use LePE, CPE, and RoPE to replace the forget gate's 's local bias, input-dependent positional information, and global positional information, respectively.
ImageNet classification. As shown in Tab. 3, our MILA models consistently outperform various vision Mamba models across all model sizes, owing the integration of useful designs from both Mamba and linear attention. These results also validate that with the merits of Mamba's two key designs, the inferior linear attention Transformer can surpass segh-performance Mamba. Notably, we empirically observe that MILA exhibits greater scalability compared to vision Mamba models, as MILA-B achieves an accuracy of 85.3, surpassing other models by a significant margin. Additionally, MILA also outperforms various CNN and vision Transformer designs. For instance, MILA exhibits better performance than MambaOut [51], a recent work that removes the selective SSM in Mamba and employs gated convolution architecture.
Inference time. We offer real speed measure- ments in Fig. 6. Substituting the forget gate with positional encoding, our MILA models ben- efit from parallelizable computation, resulting in significantly faster inference speeds compared to vision Mamba models. For instance, our model achieves 4.5x faster inference speed than Mamba2D [27], while maintaining better accu- racy. Compared to the highly optimized VMamba model [31] I. our model also delivers a 1.5x speedup accompanied by 0.5 accuracy gain. These sub- stantial improvements in model speed further support analysis that the parallelizable MILA is more suitable than Mamba for modeling non-causal data such as images.
85
VMamba
LocalVMemba
Accuracy (%)
Mamba20
PlainMamba
10.5
EfficientVMemba
83
MILA (ours)
11.7
1.0
3.0
5.0
7.0
9.0
Runtime (ms)
Figure 6: Speed tests on a RTX3090 GPU,
COCO object detection. As shown in Tab. 4, on the COCO dataset, MILA models also achieve su- perior results to vision Mamba models, implying their effectiveness in high-resolution dense predic- tion tasks. MILA offers effective global modeling with linear complexity O(N) (see eq. (13)) and parallelizable computation, making it ideally suit- able for high- high-resolution image modeling scenarios. Notably, MILA outperforms MambaQut [51] by a significant margin, which aligns with the findings in MambaOut [51].
Table 5: Results of semantic segmentation using UperNet [46]. The FLOPs are computed with input resolution of 512x2048.
Semantic Segmentation on ADE20K
mIoU
Backbone
#Params
FLOPs
SS
MS
Swin-B [32]
121M
1188G
48.1
49.7
MambaOut-B [Si]
112M
1178G
49.6
51.0
VMamba-B [31]
122M
1170G
51.0
51.6
MILA-B
128M
1183G
51.9
52.5
ADE-20K 20K semantic segmentation. We report the results on ADE-20K dataset in Tab. 5, where "SS" and "MS" denote single-scale and multi-scale testing, respectively. Similar to the object detection task, MIIAA yields better results in semantic segmentation, further verifying our analyses and the effectiveness of MILA model.

---

Table 4: Results on COCO dataset. The FLOPs are computed over backbone, FPN and detection
head with input resolution of x
(a) Mask R-CNN Ix
COCO
Method
Type
Params
FLOPs
AP
AP
AP
APm
5
AP7
ConvNeXt- [33]
CNN
48M
262G
44.2
66.6
48.3
40.1
63.3
42.8
MamhaQut-T [51]
CNN
43M
262G
45.1
67.3
49.6
41.0
64.1
44.1
Swin-T [32]
Transformer
48M
267G
42.7
65.2
46.8
39.3
62.2
42.2
PVTv2-B2 [44]
Transformer
45M
309G
45.3
67.1
49.6
41.2
64.2
44.4
FocalNeet-T [50]
Transformer
49M
268G
46.1
68.2
50.6
41.5
65.1
44.5
CSWin-T [9]
Transformer
42M
279G
46.7
68.6
51.3
45.4
Elficien\VMamba-BB [38]
53M
252G
43.7
66.2
47.9
40.2
63.3
42.9
Plain Adapter- [49]
Mamba
31M
388G
44.1
64.8
47.9
39.1
61.6
41.9
LocalVMamba-TT [25]
Mamba
45M
2916
46.7
68.7
50.8
42.2
65.7
45.5
MILA-T
MILA
44M
255G
46.8
69.5
51.5
42.1
66.4
45.0
ConyNeXt-S [33]
CNN
70M
348G
45.4
67.9
50.0
41.8
65.2
45.1
MambaOut-S [51]
CNN
65M
354G
47.4
69.1
$2.4
42.7
66.1
46.2
Swin-S [32]
Transformer
69M
354G
44.8
66.6
48.9
44.2
PVTv2-B3 [44]
Transformer
65M
397G
47.0
68.1
51.7
42.5
65.7
45.7
FocalNet-S [50]
Transformer
72M
365G
48.3
70.5
53.1
43.1
67.4
46.2
CSWin-S [9]
Transformer
54M
342G
47.9
70.1
52.6
43.2
67.1
46.2
MainMMamma-Adapter [49]
Mamba
53M
542G
46.0
66.9
50.1
40.6
63.8
43.6
LocalVMamba-S
Mamba
69M
414G
48.4
69.9
$2.7
43,2
66.7
46.5
Vinamba-S [31]
Mamha
64M
357G
48.7
70.0
53.4
43.7
67.3
47.0
MILA-S
MILA
63M
319G
49.2
71.5
53.9
44.2
68.5
47.2
ConvNeXI-B [33]
CNN
10SM
486G
47.0
69.4
51.7
42.7
46.0
MambaOut-B [5]]
CNN
100M
495G
47.4
69.3
52.2
43.0
66.4
46.3
Swin-B [32]
Transformer
107M
496G
46.9
42.3
PVTv2-B5 [44]
Transformer
102M
557G
47.4
68.6
51.9
42.5
65.7
46.0
FocalNet-B [50]
Transformer
111M
507G
49.0
70.9
53.9
43.5
67.9
46.7
CSWin-B [9]
Transformer
97M
526G
48.7
70.4
53.9
43.9
67.8
47.3
PlainMamba-AAapterr [49]
Mamba
79M
696G
46.8
68.0
51.1
41.2
64.7
43,9
VMamba-B [31]
Mamba
108M
485G
49.2
70.9
53.9
47.6
MILA-B
115M
502G
50.5
72.0
55.4
48.6
(b) Mask R-CNN 3x on COCO
Method
Type
#Params
FLOPs
AP
AP
AP
AP
APT
APR
ConvNeXt-T [33]
CNN
48M
262G
46.2
67.9
50.8
41.7
65.0
44.9
Swin-T [32]
Transformer
48M
267G
46.0
50.3
41.6
44.9
PVTv2-B2 [44]
Transformer
45M
309G
47.8
69.7
52.6
43.1
66.8
46.7
FocalNet-T [50]
Transformer
49M
268G
48.0
69.7
53.0
42.9
66.5
46.1
Vmamba- [31]
Mamba
50M
270G
48.9
70.6
53.6
43.7
67.7
46.8
LocalVMamba-T [25)
Mamba
45M
291G
48.7
70.1
53.0
43.4
67.0
46.4
MILA-T
MILA
44M
255G
48.8
71.0
53.6
43.8
68.0
46.8
ConvNeXt-S [33]
CNN
70M
348G
47.9
70.0
$2.7
42.9
66.9
46.2
Swin-S [32]
Transformer
69M
354G
48.2
69.8
$2.8
43.2
67.0
46.1
PVTv2-B3 [44]
Transformer
65M
397G
48.4
69.8
$3.3
66.9
46.7
F [50]
Transformer
72M
365G
49.3
70.7
54.2
43.8
67.9
47.4
CSWin-S [9]
Transformer
54M
342G
50.0
71.3
54.7
44.5
68.4
47.7
Vmamba-S [31]
Mamba
70M
384G
49.9
70.9
54.7
44.2
68.2
47.7
Mambaas [25]
Mamba
69M
414G
49.9
70.5
54.4
44.1
67.8
47.4
MILA-S
MILA
63M
319G
50.5
71.8
55.2
44.9
69.1
48.2
Conclusion
This paper reveals the surprisingly close relationship between the powerful Mamba and subpar linear attention Transformer, shedding some light on Mamba's superiority and success, We rephrase Mamba as a variant of linear attention Transformer and identify its six major special designs: input gate, forget gate, shortcut, no attention normalization, single-head and modified block design. Empirical validation shows that the forget gate and block design largely enhance performance, while the other distinctions offer marginal contributions or impair model performance. Based on our findings, we propose our Mamba-Inspired Linear Attention (MILA) model by incorporating the merits of these two key designs into linear attention. MILA surpasses various vision Mamba models across multiple tasks, while maintaining parallel computation and high inference speed.
10

---

Acknowledgement
This work supported in part by the National Natural Science Foundation of China under Grants 42327901 and 62321005.
References
[1] Ameen Ali, Itamar Zimerman, and Lior Wolf. The hidden attention of mamba models. arXiv preprint arXiv:2403.01590 2024." 3
[2] Daniel Bolya, Cheng-Yaue Fu, Xiaoliang Dai, Peizhao Zhang, and Judy Hoffman. Hydra attention: Efficient attention with many heads. ECCVW, 2022. 15
[3] Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, and Sergey Zagoruyko. End-to-end object detection with transformers. In ECCV, 2020. 2
[4] Krzysztof Choromanski, Valerii Likhosherstov, David Dohan, Xingyou Song, Andreea Gane, Tamas Sarlos, Peter Hawkins, Jared Davis, Afroz Mohiuddin, Lukasz Kaiser, et al. Rethinking attention with performers. In ICLR, 2021. 3,
[5] Xiangxiang Chu, Zhi Tian, Bo Zhang, Xinlong Wang, and Chunhua Shen. Conditional positional encodings for vision transformers. arXiv preprint arXiv:2102. 102i::2002.108222 2021. 8
[6] Ekin D Cubuk, Barret Zoph, Jonathon Shlens, and Quoc V Le. Randaugment: Practical automated data augmentation with reduced search space. In CVPRW, 2020. 15
[7] Jifeng Dai, Min Shi, Weiyun Wang, Sitong Wu, Linjie Xing, Wenhai Wang. Xizhou Zhu, Lewei Lu, Jie Zhou, Xiaogang Wang, et al. Demystify transformers convolutions in modern image deep networks. arXiv preprint arXiv:221
2022.
[8] Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In CVPR, 2009.
[9] Xiaoyi Dong, Jianmin Bao, Dongdong Chen, Weiming Zhang, Nenghai Yu, Lu Yuan, Dong Chen, and Baining Guo. Cswin transformer: A general vision transformer backbone with cross-shaped windows. CVPR, 2022. 2, 6, 10
[10] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x 16 words: Transformers for image recognition scale. In ICLR, 2021. 8
[11] Jiawei Du, Daquan Zhou, Jiashi Feng, Vincent Tan, and Joey Tianyi Zhou. Sharpness-aware training for free. In NeurIPS, 2022. 15
[12] Yuxin Fang, Xinggang Wang, Rui Wu, and Wenyu Liu. What makes for hierarchical vision transformer? TPAMI, 2023. 2
[13] Daniel Y Fu. Tri Dao, Khaled K Saab, Armin W Thomas, Atri Rudra, and Christopher Ré. Hungry hungry hippos: Towards language modeling with state space models. In ICLR, 2023.
[14] Albert Gu and Tri Dao. Mamba: Linear-time sequence modeling with selective state spaces. arXiv preprint ar 2023. 1, 3, 4, 7,9
[15] Dongchen Han, Xuran Pan, Yizeng Han, Shiji Song, and Gao Huang. Flatten transformer: Vision transformer using focused linear attention. In ICCV, 2023. 1, 7,
[16] Dongchen Han, Yifan Pu, Zhuofan Xia. Yizeng Han, Xuran Pan, Xiu Li, Jiwen Lu, Shiji Song. and Gao Huang. Bridging the divide: Reconsidering softmax and linear attention. In NeurIPS, 2024. 1
[17] Dongchen Han, Tianzuu Ye, Yizeng Han, Zhuofan Xia, Shiji Song, and Gao Huang. Agent attention: On the integration of softmax and linear attention. In ECCV, 2024.
11

---

[18] Qi Han, Zejia Fan, Qi Dai, Lei Sun, Ming-Mingg Cheng, Jiaying Liu, and Jingdong Wang. On the connection between local attention and dynamic depth- convolution. In ICLR, 2022.
[19] Ali Hassani and Humphrey Shi. Dilated neighborhood attention transformer. arXiv preprint arXiv:2209. 15001, 2022. 8
[20] Ali Hassani, Steven Walton, Jiachen Li, Shen Li, and Humphrey Shi. Neighborhood attention transformer. In CVPR, 2023. 2,
[21] Kaiming He, Georgia Gkioxari, Piotr Dollár, and Ross Girshick. Mask r-cnn. In ICCV, 2017.
15
[22] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016.
[23] Vincent Tao Hu, Stefan Andreas Baumann, Ming Gui, Olga Grebenkova, Pingchuan Ma. Johannes S Fischer, and Björn Ommer. Zigma: A dit-style zigzag mamba diffusion model. In ECCV, 2024.
[24] Weizhe Hua, Zihang Dai, Hanxiao Liu, and Quoc Le. Transformer quality in linear time. In ICML, 2022. 6
[25] Tao Huang, Xiaohuan Pei, Shan You, Fei Wang, Chen Qian, and Chang Xu. Localmamba: Visual state space model with windowed selective scan. arXiv preprint arXiv:2403.0333. 09338993. 2024.
3, 8, 10, 16
[26] Angelos Katharopoulos, Apoorv Vyas, Nikolaos Pappas, and François Fleuret. Transformers are rnss: Fast autoregressive transformers with linear attention. In ICML, 2020. 1, 2, 3
[27] Shufan Li, Harkanwar Singh, and Aditya Grover. Mamba-nd: Selective state space modeling for multi dinetsiiimnniiolll data, arXiv preprint arXiv:2402.05882 2024. 3, 8, 9, 16
[28] Yanghao Li, Chao- Yuan Wu, Haoqi Fan, Karttikeya Mangalam, Bo Xiong, Jitendra Malik, and Christoph Feichtenhofer. Mvitv2: Improved multiscale vision transformers for classification and detection. In CVPR, 2022. 8
[29] Opher Lieber, Barak Lenz, Hofit Bata, Gal Cohen, Jhonathan Osin, Itay Dalmedigos, Erez Safahi, Shaked Meirom, Yonatan Belinkov, Shai Shalev-Shwarzz, et al. Jamba: hybrid transformer-mantn language model. arXiv preprint arXiv:2403. 19887, 2024.
[30] Tsung-Yr Yi Lin, Michael Maire, Serge Belongie, James Hays, Pictro Perona, Deva Ramanan, Piotr Dollár, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In ECCV, 2014. 7, 15
[31] Yue Liu, Yunjie Tian, Yuzhong Zhao, Hongtian Yu, Lingxi Xie, Yaowei Wang, Qixiang Ye, and Yunfan Liu. Vmamba: Visual state space model. arXiv preprint arXiv:2401.10166 2024. 1, 3, 9, 10, 16
[32] Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, and Baining Guo. Swin transformer: Hierarchical vision transformer using shifted windows. In ICCV, 2021.
2, 7, 8, 9, 10, 15
[33] Zhuang Liu, Hanzi Mao, Chao- Wu, Christoph Feichtenhofer, Trevor Darrell, and Saining Xie. A convnet for the 2020s. In CVPR, 2022. 10
[34] Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. In ICLR, 2018. 15
[35] Jiachen Lu, Jinghan Yao. Junge Zhang. Xiatian Zhu, Hang Xu, Weiguo Gao, Chunjing Xu, Tao Xiang, and Li Zhang. Soft: Softmax-frt transformer with lincar complexity. In NeurlPS, 2021. 15
[36] Zanlin Ni, Yulin Wang, Jiangwei Yu, Haojun Jiang, Yue Cao, and Gao Huang. Deep incubation: Training large models by divide-and-conguerrngg In ICCV, 2023. 2
12

---

[37] Zanlin Ni, Yulin Wang, Renping Zhou, Yizeng Han, Jiayi Guo, Zhiyuan Liu, Yuan Yao, and Gao Huang. Enat: Rethinking spatial- interactions in ooken-based image synthesis. In NeurlPS, 2024. 2
[38] Xiaohuan Pei, Tao Huang, and Chang Xu. Efficientvmamba: Atrous selective scan for light weight visual mamba. arXiv preprint arXiv:2403.09977 2024. 3, 8, 10
[39] Zhen Qin, Weixuan Sun, Hui Deng, Dongxu Li, Yunshen Wei, Baohong Lv, Junjie Yan, Lingpeng Kong, and Yiran Zhong. cosformer: Rethinking softmax in attention. In ICLR, 2022.
3,
[40] Zhuoran Shen, Mingyuan Zhang, Haiyu Zhao, Shuai Yi, and Hongsheng Li. Efficient attention: Attention with linear complexities. WACV, 2021. 15
[41] Jianlin Su, Murtadha Ahmed, Yu Lu, Shengfeng Pan, Wen Bo, and Yunfeng Liu. Roformer: Enhanced transformer with rotary position embedding. Neurocompatiing 2024. 6, 6,8
[42] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In NeurlPS, 2017. 1, 2, 3, 6, 7,
[43] Wenhai Wang, Enze Xie, Xiang Li, Deng-Pine Fan, Kaitao Song, Ding Liang, Tong Lu, Ping Luo, and Ling Shao. Pyramid vision transformer: A versatile backbone for dense prediction without convolutions. In ICCV, 2021. 2
[44] Wenhai Wang, Enze Xie, Xiang Li, Deng-Ping Fan, Kaitao Song, Ding Liang, Tong Lu, Ping Luo. and Ling Shao. Pvt v2: Improved baselines with pyramid vision transformer. Computational Visual Media, 2022. 8, 10
[45] Zhuofan Xia, Xuran Pan, Shiji Song, Li Erran Li, and Gao Huang. Vision transformer with deformable attention. In CVPR, 2022.
[46] Tete Xiao, Yingcheng Liu, Bolei Zhou, Yuning Jiang, and Jian Sun. Unified perceptual parsing for scene understanding. In ECCV, 2018. 9, 15
[47] Yunyang Xiong, Zhanpeng Zeng, Rudrasis Chakraborty, Mingxing Tan, Glenn Fung, Yin Li, and Vikas Singh. Nyströmformer: A nyström- based algorithm for approximating self self-attention.
In AAAI, 2021. 3
[48] Jing Nathan Yan, Jiatao Gu, and Alexander M Rush. Diffusion models without attention. In CVPR, 2024. 3
[49] Chenhongyi Yang, Zehui Chen, Miguel Espinosa, Linus Ericsson, Zhenyu Wang, Jiaming Liu, and Elliot Crowley. Plainmamba: Improving non- non-hierarchical mamba in visual recognition. arXiv preprint M4Xi::2403.17699 2024. 3, 8, 10
[50] Jianwei Yang, Chunyuan Li, Pengchuan Zhang, Xiyang Dai, Bin Xiao, Lu Yuan, and Jianfeng Gao. Focal self-attention for local-global interactions in vision transformers. In NewrIPS, 2021.
8, 10
[51] Weihao Yu and Xinchao Wang. Mambaout: Do we really need mamba for vision? arXiv preprint arXiv:2405.07992, 2024. 3, 8, 9, 10
[52] Sangdoo Yun, Dongyoon Han, Seong Joon Oh, Sanghyuk Chun, Junsuk Choe, and Youngjoon Yoo. Cutmix: Regularization strategy to train strong classifiers with localizable features. In ICCV, 2019. 15
[53] Hongyi Zhang, Moustapha Cisse, Yann N. Dauphin, and David Lopez-Paz. mixup: Beyond empirical risk minimization. ICLR, 2018. 15
[54] Zhun Zhong, Liang Zheng, Guoliang Kang, Shaozi Li, and Yi Yang. Random erasing data augmentation. In AAAI, 2020. 15
[55] Bolei Zhou, Hang Zhao, Xavier Puig, Tete Xiao, Sanja Fidler, Adela Barriuso, and Antonio Torralba. Semantic understanding of scenes through the ade20k dataset. IJCV, 2019. 7, 15
13

---

[56] Lei Zhu, Xinjiang Wang, Zhanghan Ke, Wayne Zhang, and Rynson WH Lau. Biformer: Vision transformer with bi-level routing attention. In CVPR, 2023. 2
[57] Lianghui Zhu, Bencheng Liao, Qian Zhang, Xinlong Wang, Wenyu Liu, and Xinggang Wang. Vision mamba: Efficient visual representation learning with bidirectional state space model. arXiv preprint arXir:2401.09417, 2024. 1, 8, 16
14

---

Appendix
A Datasets and Experiment Details
ImageNet classification. The ImageNet-1K dataset comprises 1.28 million training images and 50,000 validation images, encompassing 1,000 classes. For a fair comparison, we train our models under the settings Swin Transformer [32]. Specifically, we utilize AdamW [34] optimizer train all our models from scratch for 300 epochs. We apply a cosine learning rate decay schedule with a linear warm-up of 20 epochs and a weight decay of 0.05. The total batch size 4096 and initial learning rate is set to 4 x 10-3, Augmentation and regularization strategies includes Ragment [6]. Mixup [53], CutMix [52], and random erasing [54]. In the training of MILA models, MESA [11] is employed to prevent overfitting.
COCO object detection. COCO [30] dataset is a widely adopted benchmark for object detection and instance segmentation with 118K training and 5K validation images. We follow the standard 1x and 3x Mask R-CNN [21] training setting in Swin Transformer [32] conduct experiments. The pretrained MILA models are employed as backbones.
ADE20K semantic segmentation. ADE20K [55] dataset contains 25K images, 20K for training, 2K for validation, and 3K for testing, with 150 semantic categories. UPerNet [46] is used as the segmentation framework and the same training setting Swin Transformer [32] is adopted. We report both single-scale and multi-scale testing results.
B Additional Experimental Results
Additional comparison with advanced linear attention designs. The results are shown in Tab. 6. We empirically find that MILA outperforms various advanced linear attention designs without bells and whistles.
Table 6: Comparison with advanced linear attention designs.
Method
#Params
FLOPs
Acc.
Hydra Attention [2]
29M
4.5G
80.7
Efficient Attention [40]
29M
4.5G
81.0
FLatten Transformer [15]
29M
4.5G
82.1
SOFT [35]
24M
3.3G
82.2
MIIA (Ours)
25M
4.2G
83.5
Ablation on the impact of MESA. Like in the early stages of studies on visual Transformer, currently vision Mamba research does not have well-established and universally accepted training protocol. The conventional training setting for vision Transformer may not be optimal for vision Mamba and our Mammba-Inspree Linear Attention. Therefore, in the training of MILA models, we additionally employ the overfitting prevention strategy MESA [11] to fully demonstrate its potential. In Tab. provide the results without MESA. We can observe that: (1) MESA provides modest accuracy gain of 0. 1-0.3. (2) Without MESA, MILA models still significantly surpass various SOTA vision Mamba models.
C Model Architectures
We illustrate the architecture of our MILA model Fig. and summarize the detailed structure in Tab. We adopt the common 4-stage framework to build MILA model by stacking our MILA blocks each stage.
D Limitations
In this paper, we explore the similarities and disparities between Mamba and linear attention Trans- former, providing comprehensive analyses to demystify the key factors behind Mamba's success.
15

---

Table 7: MILA models trained without MESA.
Model
#Params
FLOPs
Acc.
Vim-S [57]
26M
5.1G
80.3
VMamba- T [31]
31M
4.9G
82.5
LocalVMamba-T [25]
26M
5.7G
82.7
MILA-T (w/o MESA)
25M
4.2G
83.3
MILA-T (w/ MESA)
25M
4.2G
83.5
VMamba-S [31]
50M
8.7G
83.6
LocalVMamba-S [25]
50M
11.4G
83.7
MILA-S (w/o MESA)
43M
7.3G
84.2
MILA-S (w/ MESA)
43M
7.3G
84.3
Mamba2D-B [27]
94M
82.3
VMamba-B [31]
89M
15.4G
83.9
MILA-B (w/o MESA)
96M
16.2G
85.0
MILA-B (w/ MESA)
96M
16.2G
85.3
Stage 1: x X
Stage 2: x
Stage 3: x O
Stage 4:
2
Down Saarping Bind
Down Sampling
Down Sarronig Soida
Stem
Block
Block
Block
Block
Li
L,
X
Figure 7: The architecture of MILA model.
Specifically, we begin with the formulas and rephrase Mamba as variant of linear attention Trans- former with six major distinctions: input gate, forget gate, shorteut, attention normalization, single-head and modified block design. Moreover, we meticulously analyze the pros and cons of each design and prove that the forget gate and block design are the core contributors to Mamba's success. Based on our findings, we propose our Mamba-Inspired Linear Attention (MILA) model, which surpasses various vision Mamba models across multiple tasks, while maintaining parallel computation and high inference speed. However, there may be other small differences between the implementation details of Mamba and linear attention Transformer, and this paper exhaustive.
16

---

Table 8: Architectures of MILA models.
stage
output
MILA-T
MILA-S
MILA-B
stem, 64
stem, 64
stem, 96
res
56 x 56
dim x2
dim 64
dim x
x
head 2
head
head 3
downsampling, 128
downsampling. 128
downsampling. 192
res2
28 x 28
dim 128
dim 128
dim 192
x6
x6
head
head
head 6
downsampling. 256
downsampling, 256
downsampling. 384
res3
14 x 14
dim 256
dim 256
dim 384
x
head x1
x
head 8
head 12
downsampling. 512
downsampling, 512
downsampling, 768
res4
7 x 7
dim 512
dim 512
dim 768
x4
head 16
head 16
head 24
17

---

NeurIPS Paper Checklist
1. Claims
Question: Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope?
Answer: [Yes]
Justification:
The main claims made in the abstract and introduction accurately reflect the paper's contributions and scope.
Guidelines:
The answer NA means that the abstract and introduction do not include the claims made the paper.
The abstract and/or introduction should clearly state the claims made, including the contributions made in the paper and important assumptions and limitations. A No
NA answer to this question will not be perceived well by the reviewers.
The claims made should match theoretical and experimental results, and reflect how much the results can be expected to generalize to other settings.
is fine to include aspirational goals as motivation as long as is clear that these goals not attained by the paper.
2. Limitations
Question: Does the paper discuss the limitations the work performed by the authors?
Answer: [Yes]
Justification:
We discuss the limitations of the work in appendix D.
Guidelines:
The answer NA means that the paper has no limitation while the answer No means that the paper has limitations, but those are not discussed in the paper.
The authors are encouraged to create a separate "Limitations" section their paper.
The paper should point out any strong assumptions and how robust the results are to violations of these assumptions (e.g., independence assumptions, noiseless settings, model well-specification, asymptotic approximations only holding locally). The authors should reflect how these assumptions might be violated in practice and what the implications would be.
The authors should reflect on the scope of the claims made, e.g., if the approach was only tested on few datasets or with few runs. In general, empirical results often depend on implicit assumptions, which should be articulated.
The authors should reflect on the factors that influence the performance of the approach. For example, facial recognition algorithm may perform poorly when image resolution is low images are taken in low lighting. Or speech-to-text system might not be used reliably to provide closed captions for online lectures because it fails to handle technical jargon.
The authors should discuss the computational efficiency of the proposed algorithms and how they scale with dataset size.
If applicable, the authors should discuss possible limitations of their approach to address problems of privacy and fairness.
While the authors might fear that complete honesty about limitations might used by reviewers as grounds for rejection, worse outcome might be that reviewers discover limitations that aren't 't acknowledged judgment and recognize that individual actions in favor of transparency play impor- tant role in developing norms that preserve the integrity of the community. Reviewers will be specifically instructed to not penalize honesty concerning limitations.
the paper. The authors should use their best
3. Theory Assumptions and Proofs
Question: For each theoretical result, does the paper provide the full set of assumptions and complete (and correct) proof?
Answer: [Yes]
18

---

Justification:
The paper provides full set of assumptions and complete, correct proof for the theoretical results Sec. and Sec. 4.
Guidelines:
The answer NA means that the paper does not include theoretical results.
All the theorems, formulas, and proofs in the paper should be numbered and cross- referenced.
All assumptions should be clearly stated or referenced the statement of any theorems.
The proofs can either appear in the main paper or the supplemental material, but if they appear in the supplemental material, the authors are encouraged to provide short proof sketch provide intuition.
Inversely, any informal proof provided in the core of the paper should be complemented by formal proofs provided in appendix or supplemental material.
Theorems and Lemmas that the proof relies upon should be properly referenced.
4. Experimental Result Reproducibility
Does the paper fully disclose all the information needed to reproduce the main ex- perimental results of the paper to the extent that it affects the main claims and/or conclusions of the paper (regardless of whether the code and data are provided or not)?
Question:
Answer: [Yes]
Justification: The paper fully discloses the information needed to reproduce the main experimental results of the paper in appendix A.
Guidelines:
The answer NA means that the paper does not include experiments.
If the paper includes experiments, a No answer to this question will not be perceived well by the reviewers: Making the paper reproducible is important, regardless of whether the code and data are provided or not.
If the contribution is dataset and/or model, the authors should describe the steps taken make their results reproducible or verifiable.
Depending on the contribution, reproducibility can be accomplished in various ways. For example, if the contribution is novel architecture, describing the architecture fully might suffice, or if the contribution a specific model and empirical evaluation, it may be necessary either make it possible for others to replicate the model with the same dataset, or provide access to the model. In general. releasing code and data is often one good way accomplish this, but reproducibility can also be provided via detailed instructions for how to replicate the results, access to a hosted model (e.g., in the case of large language model), releasing of a model checkpoint, or other means that appropriate to the research performed.
While NeurlPS does not require releasing code, the conference does require all submis- sions to provide some reasonable avenue for reproducibility, which may depend on the nature of the contribution. For example
(a) the contribution is primarily a new algorithm, the paper should make clear how reproduce that algorithm. (b) If the contribution is primarily new model architecture, the paper should describe the architecture clearly and fully.
(c) the contribution is a new model (e.g., a large language model), then there should either be way to access this model for reproducing the results or way to reproduce the model (e.g., with an open-source dataset instructions for how to construct the dataset).
(d) We recognize that reproducibility may be tricky in some cases, in which case authors are welcome deseribe the particular way they provide for reproducibility. In the case of closed-source models, it may be that access to the model is limited in some way (e.g., to registered users), but it should possible for other researchers to have some path to reproducing or verifying the results.
5. Open access to data and code
19

---

Does the paper provide open access to the data and code, with sufficient instruc- tions faithfully reproduce the main experimental results, as described in supplemental material?
Question:
Answer: [Yes]
Justification:
The code is available https//gghhhbbooomm//.cpp.oo/u/u
Guidelines:
The answer NA means that paper does not include experiments requiring code.
Please see the NeurlPS code and data submission guidelines (https:/ /tte://nnpppppe cc/
publ / guides/ CodeSulom s. onPolioooooooooo icy for more details.
While we encourage the release of code and data, we understand that this might not be possible, "No" is an acceptable answer. Papers cannot be rejected simply for not including code, unless this is central to the contribution (e.g., for a new open-source benchmark).
The instructions should contain the exact command and environment needed to run to reproduce the results. See the NeurIPS code and data submission guidelines (https: /nips. cc/ pttpppullcccccc heabbiccggiidssss CooeeeeeeSSeeeeee Sumeeuubmmii. cessooPolllo ooyicyyyyyy....cc for more details.
The authors should provide instructions on data access and preparation, including how to access the raw data, preprocessed data, intermediate data, and generated data, etc.
The authors should provide scripts to reproduce all experimental results for the new proposed method and baselines. only subset of experiments are reproducible, they should state which ones omitted from the script and why.
At submission time, preserve anonymity, the authors should release anonymized versions (if applicable).
Providing as much information as possible in supplemental material (appended to the paper) recommended, but including URLs to data and code permitted.
6. Experimental Setting/Details
Question: Does the paper specify all the training and test details (c.g., data splits, hyper- parameters, how they were chosen, type of optimizer, etc.) necessary to understand the results?
Answer: [Yes]
Justification: The paper specifies all the training and test details in Sec. 5 and appendix A. Guidelines:
The answer NA means that the paper does not include experiments.
The experimental setting should be presented in the core of the paper to a level of detail that is necessary to appreciate the results and make sense of them.
The full details can be provided either with the code, in appendix, or as supplemental material.
7. Experiment Statistical Significance
Question: Does the paper report error bars suitably and correctly defined or other appropriate information about the statistical significance of the experiments?
Answer: [No]
Justification: Error bars are not reported because it would be too computationally expensive.
Guidelines:
The answer NA means that the paper does not include experiments.
The authors should answer "Yes" if the results are accompanied by error bars, confi- dence intervals, or statistical significance tests, at least for the experiments that support the main claims of the paper.
The factors of variability that the error bars are capturing should be clearly stated (for example, train/test split, initialization, random drawing of some parameter, or overall run with given experimental conditions).
The method for calculating the error bars should be explained (closed form formula, call to a library function, bootstrap, etc.)
20

---

The assumptions made should be given (e.g.. Normally distributed errors).
It should be clear whether the error bar is the standard deviation or the standard error of the mean.
OK to report 1-sigma error bars, but one should state The authors should preferably report a 2-sigma error bar than state that they have 96% CI, if the hypothesis of Normality of errors is not verified.
For asymmetric distributions, the authors should be careful not to show in tables or figures symmetric error bars that would yield results that are out of range (e.g. negative eтror rates).
If error bars are reported in tables or plots, The authors should explain the text how they were calculated and reference the corresponding figures tables in the text.
8. Experiments Compute Resources
For each experiment, does the paper provide sufficient information on com- puter resources (type of compute workers, memory, time of execution) needed to reproduce the experiments?
Question:
Answer: [Yes]
Justification:
We provide information on the computer resources in appendix A.
Guidelines:
The answer NA means that the paper does include experiments.
The paper should indicate the type of compute workers CPU GPU, internal cluster, or cloud provider, including relevant memory and storage.
The paper should provide the amount of compute required for each of the individual experimental runs as well estimate the total compute.
The paper should disclose whether the full research project required more compute than the experiments reported in the paper (e.g.. preliminary or failed experiments that didn't make into the paper).
9. Code Of Ethics
Question: Does the research conducted in the paper conform, in every respect, with the NeurIPS Code of Ethics https: /tte::///neuuue /ttp///errppppppp/ hctpppbllcc/ttttccccceee......
Answer: [Yes]
Justification: The research conducted in the paper conform with the NeurlPS Code of Ethics, in every respect.
Guidelines:
The answer NA means that the authors have not reviewed the NeurIPS Code of Ethics.
If the authors answer No, they should explain the special circumstances that require a deviation from the Code of Ethics.
The authors should make to preserve anonymity (e.g.. if there special consid- eration due to laws or regulations in their jurisdiction).
10. Broader Impacts
Question: Does the paper discuss both potential positive societal impacts and negative societal impacts of the work performed?
Answer: [NA]
Justification: This work focuses general model architecture and has no direct societal impact.
Guidelines:
The answer NA means that there is no societal impact of the work performed.
If the authors answer NA or No, they should explain why their work has no societal impact or why the paper does not address societal impact.
Examples of negative societal impacts include potential malicious or unintended uses (e.g., disinformation, generating fake profiles, surveillance), fairness considerations (e.g., deployment of technologies that could make decisions that unfairly impact specific groups), privacy considerations, and security considerations.
21

---

The conference expects that many papers will be foundational research and not tied particular applications, let alone deployments. However, if there is direct path to any negative applications, the authors should point it out. For example, it is legitimate to point out that an improvement in the quality of generative models could be used to generate deepfakes for disinformation. On the other hand, it is not needed to point out that a generic algorithm for optimizing neural networks could enable people to train models that generate Deepfakes faster.
The authors should consider possible harms that could arise when the technology is being used as intended and functioning correctly, harms that could arise when the technology is being used as intended but gives incorrect results, and harms following from (intentional or unintentional) misuse of the technology.
If there negative societal impacts, the authors could also discuss possible mitigation strategies (e.g., gated release of models, providing defenses in addition to attacks, mechanisms for monitoring misuse, mechanisms monitor how system learns from feedback over time, improving the efficiency and accessibility of ML).
11. Safeguards
Does the paper describe safeguards that have been put in place for responsible release of data models that have high risk for misuse (e.g., pretrained language models, image generators, or scraped datasets)?
Question:
Answer: [NA]
Justification: The paper poses such risks it is foundational research focusing general model structure.
Guidelines:
The answer NA means that the paper poses no such risks.
Released models that have high risk for misuse or dual-use should be released with necessary safeguards to allow for controlled use of the model, for example by requiring that users adhere usage guidelines or restrictions to access the model or implementing safety filters.
Datasets that have been scraped from the Internet could pose safety risks. The authors should describe how they avoided releasing unsafe images.
We recognize that providing effective safeguards is challenging, and many papers do not require this, but we encourage authors to take this into account and make best faith effort.
12. Licenses for existing assets
Question: Are the creators or original owners of assets (e.g., code, data, models), used in the paper. properly credited and are the license and terms of use explicitly mentioned and properly respected?
Answer: [Yes]
Justification: We use all assets properly according to their licenses, and give credits the creators in appendix A.
Guidelines:
The answer NA means that the paper does not use existing assets.
The authors should cite the original paper that produced the code package dataset.
The authors should state which version of the asset used and, possible, include URI
The name of the license (e.g., CC-BY 4.0) should be included for each asset.
For scraped data from a particular source (c.g., website), the copyright and terms of service of that source should be provided.
assets are released, the license, copyright information, and terms of use package should be provided. For popular datasets, papers rswi thoode. com / da sets has curated licenses for some datasets. Their licensing guide can help determine the license of dataset.
22

---

For existing datasets that are re-packaged, both the original license and the license of the derived asset (if has changed) should be provided.
If this information is not available online, the authors are encouraged to reach out to the asset's s creators.
13. New Assets
Question: Are new assets introduced in the paper well documented and is the documentation provided alongside the assets?
Answer: [NA]
Justification:
The paper does not release new assets.
Guidelines:
The answer NA means that the paper does not release new assets.
Researchers should communicate the details the dataset/code/moodl as part their submissions via structured templates. This includes details about training, license, limitations, etc.
The paper should discuss whether and how consent was obtained from people whose asset used.
At submission time, remember to anonymize your assets (if applicable). You can either create an anonymized URL or include an anonymized zip file.
14. Crowdsoureing and Research with Human Subjects
Question: For crowdsourcing experiments and research with human subjects, does the paper include the full text of instructions given to participants and screenshots, if applicable, as well details about compensation (if any)?
Answer: [NA]
Justification:
The paper does not involve crowdsourcing nor research with human subjects.
Guidelines:
The answer NA means that the paper does not involve crowdsourcing nor research with human subjects.
Including this information the supplemental material is fine, but if the main contribu- tion of the paper involves human subjects, then as much detail as possible should be included the main paper.
According the NeurIPS Code of Ethics, workers involved in data collection, curation, or other labor should be paid at least the minimum wage in the country of the data collector.
15. Institutional Review Board (IRB) Approvals or Equivalent for Research with Human Subjects
Question: Does the paper describe potential risks incurred by study participants, whether such risks were disclosed to the subjects, and whether Institutional Review Board (IRB) approvals (or equivalent approval/review based the requirements of your country or institution) were obtained?
Answer: [NA]
Justification: The paper does not involve crowdsourcing nor research with human subjects.
Guidelines:
The answer NA means that the paper does not involve crowdsourcing nor research with human subjects.
Depending the country in which research is conducted, IRB approval (or equivalent) may be required for any human subjects research. If you obtained IRB approval, you should clearly state this in the paper.
We recognize that the procedures for this may vary significantly between institutions and locations, and we expect authors to adhere to the NeurIPS Code of Ethics and the guidelines for their institution.
For initial submissions, do not include any information that would break anonymity (if applicable), such as the institution conducting the review.
23


Reviews:
[{"review_id": "6EQc6OVDVz", "reviewer": "Reviewer_QFdu", "summary": "This paper primarily discusses the similarities and differences between the Mamba model and the Linear Attention Transformer, and conducts an in-depth analysis of the key factors contributing to Mamba's success in visual tasks. The paper elaborates on six major design differences of Mamba compared to the Linear Attention Transformer: input gate, forget gate, shortcut connection, attention-free normalization, single-head attention, and modified block design. For each of these designs, the author meticulously analyzes their advantages and disadvantages, and evaluates their applicability in visual tasks.\n\nThrough experimental research, the paper emphasizes that the forget gate and block design are the core contributors to Mamba's success. Based on these findings, the author proposes a model called Mamba-Like Linear Attention (MLLA), which integrates the advantages of the forget gate and block design into the linear attention framework. Experimental results show that MLLA outperforms various visual Mamba models in image classification and high-resolution dense prediction tasks, while maintaining parallel computing capabilities and fast inference speed.", "questions": "1. How many GPUs are used to perform this research, including the training cost and ablation experiments cost?\n2. Why Fig. 1 is placed on page 2 but cited on page 4?\n3. What are the results of Mamba + Swin?", "limitations": "Nope.", "rating": 7, "confidence": 5, "soundness": 3, "presentation": 3, "contribution": 3, "strengths": "1. The paper provides a new perspective for understanding Mamba's success by thoroughly analyzing the similarities and differences between the Mamba model and the Linear Attention Transformer. By rephrasing formulas, the paper considers Mamba as a variant of the Linear Attention Transformer and clearly points out Mamba's six design features, including input gate, forget gate, shortcut connection, attention-free normalization, single-head attention, and modified block design.\n\n2. Each design aspect is meticulously analyzed, and its advantages and disadvantages in visual tasks are evaluated. Experimental results verify that the forget gate and block design significantly contribute to Mamba's performance improvement, while other designs either have minimal marginal contributions or may potentially harm model performance.\n\n3.  The Mamba-Like Linear Attention (MLLA) model is proposed, combining the advantages of the forget gate and block design in linear attention. The MLLA model outperforms existing Mamba models in image classification and high-resolution dense prediction tasks while maintaining computational parallelization and high-speed inference capabilities.", "weaknesses": "There are some minor issues:\n\n1. In the final MLLA model, there is no SSM but a forget gate. The forget gate was originally proposed in RNN and LSTM. Thus calling it a Mamba-like model seems to be improper.\n\n2. Previous \"Demystify\" papers are not cited in the paper, e.g., [a, b, c]. The final architecture MLLA follows the macro structure of Swin and [a,b,c] all show that the macro structure is very important but the local blocks are not so important. The paper should build a connection with the previous \"Demystify\" papers and tell us what are the most effective parts?\n\n[a] On the Connection between Local Attention and Dynamic Depth-wise Convolution, ICLR 2022\n[b] What Makes for Hierarchical Vision Transformer? DOI: 10.1109/TPAMI.2023.3282019\n[c] Demystify Transformers & Convolutions in Modern Image Deep Networks, arXiv:2211.05781", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "We would first like to express our appreciation for your time and insightful comments. Please find our response to your concerns in the following:\n\n---\n\n**1. The name of MLLA model.**\n\nThanks for your comment.\n\n***Firstly***, we name the final model Mamba-Like Linear Attention because it incorporates two key designs from Mamba: the forget gate and block design. Given that there is no SSM in the final model, maybe Mamba-Inspired Linear Attention (MILA) is a better name?\n\n***Secondly***, we are very happy to rename the model if a more suitable name is suggested.\n\n---\n\n**2. Previous \"Demystify\" papers.**\n\nThanks for the valuable suggestion. We offer discussions with these works.\n\n[1] studies the connection between local attention and dynamic depth-wise convolution, validating that dynamic depth-wise convolution can perform on-par with or slightly better than local window attention. It highlights the effectiveness of larger kernel sizes and input-dependent weights for vision tasks. [2] replaces the attention operations in Swin model families with simple linear mapping layers and shows that the macro architecture may be more responsible for high model performance. [3] proposes a unified macro architecture to identify the real gains of popular convolution and attention operators. It demonstrates that different token mixers achieves varying performance under the same macro architecture, with Halo attention and deformable convolution yield optimal results.\n\nBased on these papers and our findings regarding the forget gate and block design, we boldly make the following inferences:\n\n- ***Both macro and micro structures are important***.  [1, 2] emphasize the importance of macro structure, while [3] shows that superior token mixers can enhance performance under the same macro architecture. In our study, the forget gate and block design serve as micro and macro structures, respectively, both playing significant roles.\n- ***Input-dependent feature, large receptive field and local bias are beneficial for effective micro token mixer designs.*** [1, 3] and our paper suggest these properties are effective. This further explains the effectiveness of MLLA, which incorporates all these features while maintaining linear complexity.\n\n**We will cite these related works and provide detailed discussion in the revised version.**\n\n[1] On the Connection between Local Attention and Dynamic Depth-wise Convolution, ICLR 2022.\n\n[2] What Makes for Hierarchical Vision Transformer? DOI: 10.1109/TPAMI. 2023.3282019.\n\n[3] Demystify Transformers & Convolutions in Modern Image Deep Networks, arXiv:2211.05781.\n\n---\n\n**3. Training cost.**\n\n32 GPUs are used to perform this research. Each tiny-scale model, including ablation experiments, requires around 12 hours for training on ImageNet-1K with 32 GPUs.\n\n---\n\n**4. The position of Fig. 1.**\n\nThanks for your question. Fig. 1 is placed on page 2 as it serves as the main figure of our paper. Considering it is cited on page 4, we will adjust its position.\n\n---\n\n**5. The results of Mamba + Swin.**\n\nDue to time and computation resource constrains, we are unable to provide the results of Mamba + Swin architecture. However, we find that the initial version of VMamba yields pertinent findings by applying Mamba to Swin architecture in a cross-scan approach. The results are provided below.\n\n|                Model                 | #Param | FLOPs | Acc  |\n| :----------------------------------: | :----: | :---: | :--: |\n| Mamba+Swin-T (implemented by VMamba) |  22M   | 4.5G  | 82.2 |\n|                MLLA-T                |  25M   | 4.2G  | 83.5 |", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "extra_scores": {}}, {"review_id": "XvTLGsFiGv", "reviewer": "Reviewer_ii6x", "summary": "This paper explores the similarities and differences between the Mamba and linear attention Transformer models. It redefines Mamba as a variant of linear attention Transformer with six key distinctions. The paper also studies each design's impact, identifying the forget gate and block design as key to Mamba's success. Based on these findings, the paper introduces a Mamba-like linear Attention (MLLA) model, which outperforms other vision Mamba models on various tasks while maintaining fast computation and inference speed.", "questions": "I have some concerns (see weaknesses) about this paper. I am inclined to raise my score if my concerns are fully resolved.\n\n**Reference:**  \n\n[1],Diffusion Models Without Attention.CVPR24. \n\n[2],ZIGMA: A DiT-style Zigzag Mamba Diffusion Model,ECCV24. \n\n[3],Scalable Diffusion Models with State Space Backbone,Arxiv.", "limitations": "Yes, they are addressed and discussed.", "rating": 6, "confidence": 4, "soundness": 3, "presentation": 3, "contribution": 2, "strengths": "* The paper is well-written and well-motivated from the perspective of linear attention.\n\n* The findings are interesting to me.", "weaknesses": "* Several works using Mamba for image synthesis should be discussed [1][2][3]. In Line 68, I wonder whether the exploration in this paper is orthogonal to previous explorations on Mamba. For example, Zigma considers layerwise scanpaths with 8 directions. Can the proposed method still yield some improvements on that result?\n\n* Another consideration is that the authors should discuss something with this paper: https://arxiv.org/abs/2406.06484. Check Table 4; it provides a much more general framework that includes most of the linear attention models.\n\n* My third concern is whether the exploration in this work can extend to other linear attention-based models, such as RWKV and xLSTM.", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "We would first like to express our appreciation for your time and insightful comments. Please find our response to your concerns in the following:\n\n---\n\n**1. Mamba for image synthesis.**\n\n- Thanks for pointing out these works. ***We will give more credits to them and include detailed discussions in the revised version.***\n- The exploration in this paper is orthogonal to previous explorations on Mamba, and ***our work can further benefit previous works in two ways***: \n  - ***a. Previous studies on Mamba can substitute their SSM with our MLLA block***, which is proved to be more effective and efficient. \n  - ***b. The analyses in our work can help other studies design better Mamba models.*** Our work reveals some suboptimal designs of Mamba, such as the absence of attention normalization, an important component. Hence, previous works on Mamba, e.g. Zigma, can add attention normalization to their model to achieve better results. This enhancement is compatible with other explorations, such as layer-wise scan paths with 8 directions.\n- ***This paper focuses on analyzing.*** Currently we mainly conduct classification, object detection and semantic segmentation experiments, which already validate our analyses and findings. In the future, we will apply MLLA to image synthesis task to develop efficient models.\n\n---\n\n**2. Discussion with the mentioned paper.**\n\n- Thank you for pointing this out. ***The mentioned paper was made public on June 10, 2024, after the NeurIPS submission deadline of May 22, 2024.***\n- The mentioned work proposes a unified framework for efficient autoregressive sequence transformations, demonstrating various linear attention models within this framework. Despite some similarities with our work, there are fundamental distinctions:\n  - a. Our work not only reveals the close relationship between Mamba and linear attention, but more importantly, ***provides analyses and experiments to verify the effectiveness of each design.*** In contrast, the referenced work mainly develops ***a framework to include*** different linear attention models.\n  - b. ***Our analyses ultimately leads to the development of a novel linear attention model, MLLA***. In contrast, the mentioned work focuses on the development of ***efficient training algorithms for existing models.***\n- ***We will discuss with this paper in the revised manuscript.***\n\n---\n\n**3. Extension to other linear attention-based models.**\n\n- ***The exploration in this work can be extended to other linear attention-based models.***\n\n- Our work reveals that Mamba can be viewed as a special variant of vanilla linear attention. Other linear attention-based models, e.g. RWKV, xLSTM, can also be viewed as variants of vanilla linear attention. Therefore, the exploration and insights in this work can naturally extend to these models. \n\n- ***We take xLSTM as an example.*** According to Eq. 4 of our paper, linear attention can be written as: \n  $$\n  S_i=S_{i-1}+K_i^\\top V_i,\\quad  Z_i=Z_{i-1}+K_i^\\top, \\quad  y_i=Q_i S_i / Q_i Z_i\n  $$\n  Using the same notations, xLSTM can be formulated as:\n  $$\n  S_i=F_i S_{i-1}+I_i K_i^\\top V_i,\\quad  Z_i=F_i Z_{i-1}+I_i K_i^\\top, \\quad  y_i=Q_i S_i / \\text{max}\\\\{1, Q_i Z_i\\\\},\n  $$\n  where $I_i$ is input gate and $F_i$ is forget gate. Additionally, xLSTM employs multi-head design according to its paper. ***Therefore, xLSTM resembles linear attention with additional input gate $I_i$, forget gate $F_i$ and modified normalization $\\text{max}\\{1, Q_i Z_i\\}$.*** As a result, many explorations of this work can be extended to xLSTM. For instance, we can make ***bold speculations*** like:\n\n  - a. The forget gate $F_i$ is likely to play a crucial role in xLSTM.\n  - b. When applying xLSTM to vision models, the forget gate could possibly be replaced with positional encodings. Just like what we did in Table 2.\n  - c. The input gate $I_i$ may not offer significant benefits in vision tasks.\n  - d. Enhanced block designs from Mamba could potentially benefit xLSTM.\n  - e. The modified normalization $\\text{max}\\\\{1, Q_i Z_i\\\\}$ might provide greater stability compared to vanilla linear attention, warranting further exploration.\n\n- ***In conclusion, the analyses and insights of our work can extend to other linear attention-based models, helping them improve interpretability, further enhance models, etc.***", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "extra_scores": {}}, {"review_id": "gLnnTLFNpf", "reviewer": "Reviewer_dwbt", "summary": "The paper takes a deep dive into the workings of Mamba in vision related tasks and compares it to Linear Attention. They conclude that Mamba is a special form of Linear Attention and describe the role that certain parts in the architecture and give them a name that better represent their actual use. They come up with input and forget gate that control the flow of information while shortcuts are closely related to the residual connections. The authors take those learnings and apply them to linear attention  and show that those concepts do improve the linear attention mechanism up to the point where it beats mamba.", "questions": "- Why did you choose to use Swin Transformer?\n- The forget gate creates local bias and position information but also decays the previous hidden state if I understood correctly. When replaced by RoPE or similar the performance increases as shown in Table2. Does this mean that the local bias and the decay can hinder performance?", "limitations": "The authors mention the limitations of their work, especially that is it no exhaustive.", "rating": 7, "confidence": 3, "soundness": 4, "presentation": 4, "contribution": 3, "strengths": "The authors draw clear connections between Linear Attention and Mamba which is showcased in terms of raw similarity (eq. 11 and 12). Furthermore, they underline this by showing the input gate values on two example images which helps general understanding. They demonstrate the usefulness of the explained modules in Mamba apply them to Linear Attention and show that they do improve performance.\n\nIn total a sound paper. The overall gist can be followed very nicely.", "weaknesses": "No apparent weaknesses", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "We would first like to express our appreciation for your time and insightful comments. Please find our response to your concerns in the following:\n\n---\n\n**1. Reason for using Swin Transformer.**\n\nWe offer clarification on employing Swin Transformer:\n\n- Swin Transformer is a widely used architecture in vision tasks. ***We use it as a clean and fair structure*** to validate the effectiveness of each special design of Mamba.\n- Notably, the core operation of Swin Transformer, shifted window attention, is replaced with global linear attention to from our baseline model. Therefore, ***we only employ the macro structure of Swin***—such as width and depth—without employing its window-based attention mechanism.\n\n---\n\n**2. Replacing the forget gate with positional encoding.**\n\n- Thanks for the insightful question. Yes, the forget gate decays previous hidden state, thus providing local bias and position information.\n- ***Local bias and decay do not hinder performance.*** Instead, they are beneficial for the model. For example, RoPE provides long-term decay and local bias, as demonstrated in its paper [1]. As shown in Table 2 of our study, integrating RoPE into the baseline linear attention model leads to an obvious performance improvement from 77.6 to 80.0. This indicates that local bias and decay can enhance model effectiveness.\n- ***The reason why positional encodings outperform forget gate in Table 2 is that they can enjoy a global receptive field.*** As analyzed in our paper, the forget gate has to employ recurrent calculation, which restricts the receptive field of each token to the preceding sequence, resulting in a causal mode. As verified by a concurrent work, MambaOut [2], such a causal mode can lead to notable performance drop in vision models (see its Fig. 3). Therefore, while the local bias and decay of the forget gate can benefit the model, its causal mode hinders performance. In contrast, positional encodings enable the model to benefit from both local bias and a global receptive field at the same time, thus yielding better results than the forget gate.\n\n[1] Roformer: Enhanced transformer with rotary position embedding. Neurocomputing.\n\n[2] MambaOut: Do We Really Need Mamba for Vision? arXiv:2405.07992.", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "extra_scores": {}}, {"review_id": "ph6O0qYSba", "reviewer": "Reviewer_XBcf", "summary": "This paper presents a thorough analysis of the key factors contributing to the success of the S6 module in Mamba model, and introduces a new linear attention vision network, MLLA, inspired by the S6’s design. Extensive experimental results show outstanding performance, validating the effectiveness of the proposed model.", "questions": "Please see the main weaknesses.", "limitations": "Please see the main weaknesses.", "rating": 7, "confidence": 5, "soundness": 3, "presentation": 2, "contribution": 3, "strengths": "The motivation and analysis underlying this work are fascinating and perceptive, offering a profound examination of the mathematical relationships between Mamba and Linear Attention. \n\nA thorough investigation of the performance contributions of each component from S6 is conducted, with corresponding refinements made to linear attention, ultimately leading to the development of MLLA. \n\nThe proposed MLLA serves as a generic vision backbone network, which outperforms recent Mamba-based models, demonstrating its superior capabilities", "weaknesses": "I appreciate the paper's insightful analyses, but several key concerns regarding methodology and experiments need to be addressed. If the authors fully resolve these issues, I would be willing to reconsider my evaluation.\n\n**Possible inaccurate analysis of single-head attention**\n\nThe analysis of single-head attention appears to be inaccurate and unclear. Generally, multi-head attention in Transformer generates H dynamic matrices during attention computation, where H represents the number of heads. However, the paper seems to interpret S6 as a single-head module without providing sufficient evidence. The authors should explain this point from the perspective of the number of attention matrices generated. Moreover, according to Reference 1, S6 can actually produce multiple dynamic matrices instead of just one.\n\n**Unfair comparison on ImageNet-1K dataset**\n\nThe paper uses MESA as its optimizer, improving accuracy compared to AdamW. In contrast, the methods in Table 3 do not use MESA and may also be prone to overfitting. For fairness, authors should ensure that training strategies are consistent with competitors. Moreover, the authors should not hide this apparent difference in the appendix.\n\n\n**Questionable motivation for using Swin as the baseline**\n\nThe motivation for using Swin as a baseline is questionable. One important aspect of linear attention is its ability to efficiently establish global dependencies, so it is unclear why window-based linear attention is used. Additionally, the specific configuration of the baseline model, such as channels and depth, is not provided.\n\n**Unclear setting of d_state in SSM block design**\n\nIn the block design, it is unclear what value d_state of SSM is set to.\n\n\n**Insufficient experiments on downstream tasks**\n\n(1) Semantic segmentation should include tiny, small, and base models. (2) Mask R-CNN 3x should include the base model. (3) The performance comparison of MLLA-T and VMamba-T on object detection is lacking.\n\n**Unfair comparison in Table 6**\n\nThe comparison in Table 6 is unfair. The authors aim to compare the performance of different linear attention methods, but different block settings have a significant impact. The authors should use the same architecture, replacing only token mixer module.\n\n**Typo**\n\nIn line 294, 'SMM' should be 'SSM'.", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "We would first like to express our appreciation for your time and insightful comments. Please find our response to your concerns in the following:\n\n---\n\n**1. The analysis of single-head attention.**\n\nThanks for your insightful comment.\n\n- ***The concept \"head\" in our paper is the same as its original definition in multi-head attention [1], i.e. the number of groups of $Q, K$, rather than the number of dynamic matrices.*** Since there exists only one set of $C,B$ in S6 (see Eq. 11 of our paper), ***it resembles single-head linear attention.***\n- ***A head can possibly generate multiple dynamic matrices.*** In multi-head attention, one head can only generate a single dynamic matrix $QK^\\top$. However, a head of S6 can produce multiple equivalent dynamic matrices. This can be attributed to its special input gate and forget gate design. Specifically, as shown in Eq. 11 and Eq. 12 of our paper, there is only one set of $C\\in\\mathbb{R}^{N\\times d}, B\\in\\mathbb{R}^{d\\times N}$ in S6. Therefore, without considering the input gate $\\Delta_i$ and forget gate $\\hat{A}_i$, the model can produce only one dynamic attention matrix $CB\\in\\mathbb{R}^{N\\times N}$. However, the input gate $\\Delta_i$ and forget gate $\\hat{A}_i$ make things different. Specifically, $\\Delta_i\\in\\mathbb{R}^{1\\times c}$ and $\\hat{A}_i\\in\\mathbb{R}^{d\\times c}$ are not shared across channels $c$, which enables S6 to produce $c$ equivalent dynamic matrices with the single set of $C, B$. Intuitively, S6 generates one attention matrix $CB\\in\\mathbb{R}^{N\\times N}$, yet each channel filters tokens differently based on its input gate weight and introduces unique local biases with its forget gate weight, leading to varied equivalent dynamic matrices.\n- ***In conclusion, S6 uses the single-head design, but its input gate and forget gate lead to multiple equivalent dynamic matrices.*** \n- Additionally, we can introduce multi-head design to S6 by initially generating multiple sets of $C^h\\in\\mathbb{R}^{N\\times d}, B^h\\in\\mathbb{R}^{d\\times N},h=1,\\cdots,\\rm{num\\\\_heads}$, akin to multi-head attention.\n\n[1] Attention is all you need. In NeurIPS, 2017.\n\n---\n\n**2. The comparison on ImageNet-1K dataset.**\n\n***Firstly***, MESA was not utilized in ablation experiments or downstream tasks. These results already fully support the two core findings of this paper: (1) The forget gate and block design are the key designs of Mamba. (2) With the merits of these two key designs, MLLA can outperform various vision Mamba models.\n\n***Secondly***, we clarify MESA as follows:\n\n- MESA is an overfitting prevention strategy rather than an optimizer.\n- ***Without MESA, MLLA model can also achieve comparable results.*** For example, after removing MESA and increasing drop path rate—a commonly used strategy to prevent overfitting—to 0.3, MLLA-T yields 83.3 accuracy on ImageNet, which still significantly surpasses various SOTA vision Mamba model, e.g. LocalVMamba-T: 82.7, VMamba-T: 82.5, etc.\n- In our early experiments, we found MESA slightly beneficial for MLLA model, but it did not benefit other models as well and even hindered their performance.\n\n---\n\n**3. The motivation for using Swin as the baseline.**\n\n- ***Window-based attention is not used.*** The shifted window attention in Swin Transformer is replaced with global linear attention to create our baseline model. ***We only employ the macro structure of Swin***, i.e. width, depth and etc., as a clean architecture.\n- The baseline model shares the identical configuration as Swin-T, with widths = [96, 192, 384, 768] and depths = [2, 2, 6, 2].\n\n---\n\n**4. The setting of d_state in SSM block design.**\n\nThe concept of d_state is akin to the head_dim in attention. Therefore, following Swin Transformer, we set it as 32 for all the models in our study.\n\n---\n\n**5. The experiments on downstream tasks.**\n\n- MLLA's effectiveness on downstream tasks is fully validated by comprehensive COCO object detection and instance segmentation experiments. Hence, we conduct only one experiment on semantic segmentation task to save computation resources.\n\n- As requested, we provide additional results of semantic segmentation task below. \n\n  | Backbone | \\#Params | FLOPs | mIoU SS | mIoU MS |\n  | :------: | :------: | :---: | :-----: | :-----: |\n  | VMamba-T |   62M    | 949G  |  47.9   |  48.8   |\n  |  MLLA-T  |   55M    | 932G  |  48.1   |  49.0   |\n\n  Due to time and resource constraints, we couldn't provide the MLLA-S results here.\n\n- To the best of our knowledge, the result for Mask R-CNN 3x + base model is not provided by any vision Mamba models we compared with. Hence, we also omit this experiment to save computation resources.\n\n- Full comparison with VMamba-T on object detection is provided **in the PDF in general response**. MLLA-T achieves comparable results to VMamba-T in the 3x setting but slightly underperforms VMamba-T in 1x training. This can be attributed to MLLA-T having 6M fewer parameters than VMamba-T, possibly requiring longer training to converge. MLLA-S/B significantly outperform VMamba-S/B in both 1x and 3x settings.\n\n---\n\n**6. The comparison in Table 6.**\n\n- As detailed in our paper, ***the block structure is also a key design of Mamba and our MLLA.*** Hence, we provide a direct comparison with other linear attention methods in Table 6. to validate the effectiveness of our design.\n\n- Here we offer additional comparison under exactly same macro architecture, the Swin-T structure.\n\n  |       Method        | \\#Params | FLOPs | Acc. |\n  | :-----------------: | :------: | :---: | :--: |\n  |   Hydra Attention   |   29M    | 4.5G  | 80.7 |\n  | Efficient Attention |   29M    | 4.5G  | 81.0 |\n  | FLatten Transformer |   29M    | 4.5G  | 82.1 |\n  |        MLLA         |   30M    | 4.8G  | 82.6 |\n\n  MLLA shows obviously better result. It is noteworthy that we are unable to provide results for SOFT under this setting since it requires more than 1 hour to train one epoch.\n\n---\n\n**7. Typo.**\n\nThanks. It will be corrected.", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "extra_scores": {}}]

Author rebuttal:
We thank all the reviewers for their insightful and valuable comments. 

We have carefully considered the reviewers' comments and provided additional clarification to address each concern. Here, we offer general responses to all reviewers on two key issues.

---

**1. The motivation of our work.**

This work primarily focuses on ***demystifying the key factors behind Mamba’s success***, rather than developing a series of models to achieve SOTA results. ***Our analyses and verifications form the core of this work***, with MLLA models serving to validate whether the subpar linear attention can match or even surpass the high-performance of Mamba.

---

**2. Discussion with related works.**

Due to recent abundance of Mamba-related works, we may have overlooked some important related works. We appreciate the reviewers for highlighting these works. We will give more credits to them and provide detailed discussions in the revised manuscript.

---

**For detailed responses to individual reviewer comments, please refer to our separate responses to each reviewer.**

Lastly, we would like to thank the reviewers for their time and we are welcome for any further discussion.

Meta-review: The manuscript has been reviewed by several reviewers, all of whom, after rebuttal, gave positive ratings and agreed that the manuscript meets the bar of NeurIPS.

Essentially, the reviewers were happy to find that the study is well motivated and the design is well conducted. There are a few flaws but the reviewers are convinced after the rebuttal.

The AC agrees with the consensus from the reviewers and therefore commends the manuscript to be accepted. Congratulations!
Decision: Accept (poster)