Methods › General › Attention Mechanisms › Locally-Grouped Self-Attention
Locally-Grouped Self-Attention
Introduced by Xiangxiang Chu et al. in Twins: Revisiting the Design of Spatial Attention in Vision Transformers
archive 2025-07-28 Description, source and code snippet are the archive's method entry.
Locally-Grouped Self-Attention, or LSA, is a local attention mechanism used in the Twins-SVT architecture. Locally-grouped self-attention (LSA). Motivated by the group design in depthwise convolutions for efficient inference, we first equally divide the 2D feature maps into sub-windows, making self-attention communications only happen within each sub-window. This design also resonates with the multi-head design in self-attention, where the communications only occur within the channels of the same head. To be specific, the feature maps are divided into m ×n sub-windows. Without loss of generality, we assume H % m=0 and W % n=0. Each group contains (H W)/(m n) elements, and thus the computation cost of the self-attention in this window is 𝒪((H² W²)/(m² n²) d), and the total cost is 𝒪((H² W²)/(m n) d). If we let k₁=H/n and k₂=W/n, the cost can be computed as 𝒪(k₁ k₂ H W d), which is significantly more efficient when k₁ ≪H and k₂ ≪W and grows linearly with H W if k₁ and k₂ are fixed.
Although the locally-grouped self-attention mechanism is computation friendly, the image is divided into non-overlapping sub-windows. Thus, we need a mechanism to communicate between different sub-windows, as in Swin. Otherwise, the information would be limited to be processed locally, which makes the receptive field small and significantly degrades the performance as shown in our experiments. This resembles the fact that we cannot replace all standard convolutions by depth-wise convolutions in CNNs.
Papers archive 2025-07-28
2 shown of 2, newest first. Repository counts are the archive's code-links table. A Syntology line states what Syntology ran from that paper's harvested code; it is per sample and not a correctness claim.
-
Logically at Factify 2: A Multi-Modal Fact Checking System Based on Evidence Retrieval techniques and Transformer Encoder Architecture 9 Jan 2023 · 0 repositories · arXiv:2301.03127
-
Twins: Revisiting the Design of Spatial Attention in Vision Transformers 28 Apr 2021 · 9 repositories · arXiv:2104.13840Syntology ran 0 of 2 samples · 2 unverified · 2 pointer-only (licence)
Tasks archive 2025-07-28
7 tasks the archive attaches to papers tagged with this method, by distinct papers. A task without a page in the catalog is plain text.
| Task | Papers |
|---|---|
| Avg | 1 |
| Benchmarking | 1 |
| Fact Checking | 1 |
| Fact Verification | 1 |
| Image Classification | 1 |
| Retrieval | 1 |
| Semantic Segmentation | 1 |
Usage over time archive 2025-07-28
Components: the archive holds no method-to-method composition, so PwC's Components table cannot be rebuilt; the Papers list carries no Results column for the same reason (the archive does not join its leaderboard rows to method tags).
Categories archive 2025-07-28
Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections