SandHouse
Pages and contents

SEMA

0\. Metadata

Field
Value
⋮⋮
Authors
Tran, Xue, Zhang
⋮⋮
Year
2026
⋮⋮
Link / arXiv
https://arxiv.org/pdf/2506.08297
⋮⋮
Code
https://github.com/nhatthanhtran/SEMA
⋮⋮
My relevance (1-5)
5
⋮⋮
Tags
#ssm #transformer #video #mamba #sema

1\. Main Idea

The authors introduce a scalable architecture that computes the traditional attention mechanism QKTwithin a small spatial window, then performs an average over the rest of the tokens. This is computationally efficient and avoids the “dispersion” property that the authors define rigorously.

2\. Problem

Softmax attention algorithms scale quadratically with context windows. Mamba provides a performant linear scaling state space model, but performance tends to degrade at downstream tasks involving high pixel image and video understanding. SEMA proposes a Mamba inspired linear attention mechanism that shows competitive performance on machine learning tasks.

3\. Background

ΦNormalized Attention

Let x∈ℝn, ϕ:ℝ→ℝ+. Define Φ:ℝn→[0,1]n as

Φ(x)=[ϕ(x1)∑i=1nϕ(xi),... ,ϕ(xn)∑i=1nϕ(xi)]

Observe that when ϕ(x)=exp⁡(x)⟹Φ(x)=Softmax(x).

We can define a generalized attention mechanism, ΦNormalized Attention. Let K,Q,V∈ℝn×dbe the key, query, value matrices. Let ψk,ψq:ℝd→ℝdand ϕ:ℝ→ℝ+be continuous. The general Φ Normalized Attention mechanism is as follows.

AΦ(Q,K,V):=[∑l=1nϕ(ψq(q1)ψk(kl)T)vl∑j=1nϕ(ψq(q1)ψk(kj)T)⋮∑l=1nϕ(ψq(qn)ψk(kl)T)vl∑j=1nϕ(ψq(qn)ψk(kj)T)].

If ψq,ψk are identity and ϕ(x)=exp⁡(x)then this is vanilla softmax full attention. If ψq=ψk=ELU(x)+1 and ϕ(x)=x, then this is linear attention.

Dispersion

For a query qithe generalized attention assigns the key kjthe weight

αijϕ(ψq(qi)ψk(kj)⊤)∑ℓ=1nϕ(ψq(qi)ψk(kℓ)⊤)

Under the paper's topological assumptions that the input feature space is bounded/compact and the attention functions are continuous, for every ϵ>0, there exists a sufficiently large sequence length n such that

αij<ϵfor every query-key pair (i,j)

More specifically, each normalized attention coefficient scales as αij=Θ(1n). Therefore, as the number of keys increases, no individual key can retain a fixed nonzero fraction of a query's attention. The distribution becomes increasingly diffuse, or dispersed. This does not mean that all finite n weights are exactly equal, it means that every individual weight approaches zero at approximately the 1/n scale.

Mamba is an architecture that does not disperse. To see this, we can write a simplified Mamba recurrence asht=A‾tht−1+B‾txt,  yt=Ctht+Dxt. Expanding the recurrence gives

ht=∑j=1t(∏r=j+1tA‾r)B‾jxj.

Mamba does not normalize all previous token contributions using a denominator that grows with sequence length. Instead, older information is selectively forgotten through products of the transition factors \\(\\bar A_r\\). Adding more tokens after position t also does not alter yt. Mamba therefore exhibits recurrent forgetting rather than normalized-attention dispersion.

The SEMA architecture is intentionally designed to avoid the dispersion property of vanilla softmax attention.

4\. Method

SEMA combines local window attention with a global value average

SEMA(Q,K,V)=∑j∈J(i)exp⁡(qikj⊤)∑ℓ∈J(i)exp⁡(qikℓ⊤)vj+1n∑j=1nvj

The first term in the equation is commonly denoted AΦ(Q,K,V,w).

The local attention does not disperse as the full sequence grows because each query attends only to a fixed-size windowJ(i). Its normalization denominator contains a fixed number of keys rather than all n keys. The global branch intentionally uses arithmetic averaging. This equation directly approximates the diffuse, low-frequency global component that full attention approaches in the large-token regime. SEMA therefore preserves selective local processing through window attention while supplying global information through a cheap broadcast average.