{"url":"/method/spatially-separable-self-attention","slug":"spatially-separable-self-attention","name":"Spatially Separable Self-Attention","full_name":"Spatially Separable Self-Attention","full_name_withheld":false,"description_markdown":"**Spatially Separable Self-Attention**, or **SSSA**, is an [attention module](https://paperswithcode.com/methods/category/attention-modules) used in the [Twins-SVT](https://paperswithcode.com/method/twins-svt) architecture that aims to reduce the computational complexity of [vision transformers](https://paperswithcode.com/methods/category/vision-transformer) for dense prediction tasks (given high-resolution inputs). SSSA is composed of [locally-grouped self-attention](https://paperswithcode.com/method/locally-grouped-self-attention) (LSA) and [global sub-sampled attention](https://paperswithcode.com/method/global-sub-sampled-attention) (GSA).\r\n\r\nFormally, spatially separable self-attention (SSSA) can be written as:\r\n\r\n$$\r\n\\hat{\\mathbf{z}}\\_{i j}^{l}=\\text { LSA }\\left(\\text { LayerNorm }\\left(\\mathbf{z}\\_{i j}^{l-1}\\right)\\right)+\\mathbf{z}\\_{i j}^{l-1} $$\r\n\r\n$$\\mathbf{z}\\_{i j}^{l}=\\mathrm{FFN}\\left(\\operatorname{LayerNorm}\\left(\\hat{\\mathbf{z}}\\_{i j}^{l}\\right)\\right)+\\hat{\\mathbf{z}}\\_{i j}^{l} $$\r\n\r\n$$ \\hat{\\mathbf{z}}^{l+1}=\\text { GSA }\\left(\\text { LayerNorm }\\left(\\mathbf{z}^{l}\\right)\\right)+\\mathbf{z}^{l} $$\r\n\r\n$$ \\mathbf{z}^{l+1}=\\text { FFN }\\left(\\text { LayerNorm }\\left(\\hat{\\mathbf{z}}^{l+1}\\right)\\right)+\\hat{\\mathbf{z}}^{l+1}$$\r\n\r\n$$i \\in\\{1,2, \\ldots ., m\\}, j \\in\\{1,2, \\ldots ., n\\}\r\n$$\r\n\r\nwhere LSA means locally-grouped self-attention within a sub-window; GSA is the global sub-sampled attention by interacting with the representative keys (generated by the sub-sampling functions) from each sub-window $\\hat{\\mathbf{z}}\\_{i j} \\in \\mathcal{R}^{k\\_{1} \\times k\\_{2} \\times C} .$ Both LSA and GSA have multiple heads as in the standard self-attention.","description_state":"present","introduced_year":null,"introduced_by":{"title":"Twins: Revisiting the Design of Spatial Attention in Vision Transformers","paper":"/paper/twins-revisiting-spatial-attention-design-in","first_author":"Xiangxiang Chu","n_authors":8,"url_abs":null,"archive_paper_url":"https://paperswithcode.com/paper/twins-revisiting-spatial-attention-design-in"},"source":{"url":"https://arxiv.org/abs/2104.13840v4","title":"Twins: Revisiting the Design of Spatial Attention in Vision Transformers","url_on_a_paper_host":true},"code_snippet_url":null,"code_snippet_url_on_a_code_host":false,"categories":[{"area":"General","area_id":"general","collection":"Attention Modules","url":"/methods/category/attention-modules","pwc_aliases":[]}],"n_papers_tagged":2,"archive_num_papers":2,"papers_newest_first":[{"paper":null,"title":"Logically at Factify 2: A Multi-Modal Fact Checking System Based on Evidence Retrieval techniques and Transformer Encoder Architecture","date":"2023-01-09","arxiv_id":"2301.03127","n_code_links":0,"syntology":null},{"paper":"/paper/twins-revisiting-spatial-attention-design-in","title":"Twins: Revisiting the Design of Spatial Attention in Vision Transformers","date":"2021-04-28","arxiv_id":"2104.13840","n_code_links":9,"syntology":{"ran":0,"of":2,"unverified":2,"pointer_only":2}}],"papers_shown":2,"tasks":[{"task":null,"name":"Avg","papers":1},{"task":"/task/benchmarking","name":"Benchmarking","papers":1},{"task":"/task/fact-checking","name":"Fact Checking","papers":1},{"task":"/task/fact-verification","name":"Fact Verification","papers":1},{"task":"/task/image-classification","name":"Image Classification","papers":1},{"task":"/task/retrieval","name":"Retrieval","papers":1},{"task":"/task/semantic-segmentation","name":"Semantic Segmentation","papers":1}],"tasks_shown":7,"n_tasks":7,"usage_by_year":[{"year":"2021","papers":1},{"year":"2023","papers":1}],"row_source":"methods_table","archive":{"source":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","archive_url":"https://paperswithcode.com/method/spatially-separable-self-attention"},"syntology_read_at":"2026-09-24T18:15:14+00:00"}