{"url":"/method/spatial-gating-unit","slug":"spatial-gating-unit","name":"Spatial Gating Unit","full_name":"Spatial Gating Unit","full_name_withheld":false,"description_markdown":"**Spatial Gating Unit**, or **SGU**, is a gating unit used in the [gMLP](https://paperswithcode.com/method/gmlp) architecture to captures spatial interactions. To enable cross-token interactions, it is necessary for the layer $s(\\cdot)$ to contain a contraction operation over the spatial dimension. The layer $s(\\cdot)$ is formulated as the output of linear gating:\r\n\r\n$$\r\ns(Z)=Z \\odot f\\_{W, b}(Z)\r\n$$\r\n\r\nwhere $\\odot$ denotes element-wise multiplication. For training stability, the authors find it critical to initialize $W$ as near-zero values and $b$ as ones, meaning that $f\\_{W, b}(Z) \\approx 1$ and therefore $s(Z) \\approx Z$ at the beginning of training. This initialization ensures each [gMLP](https://paperswithcode.com/method/gmlp) block behaves like a regular [FFN](https://paperswithcode.com/method/gmlp) at the early stage of training, where each token is processed independently, and only gradually injects spatial information across tokens during the course of learning.\r\n\r\nThe authors find it further effective to split $Z$ into two independent parts $\\left(Z\\_{1}, Z\\_{2}\\right)$ along the channel dimension for the gating function and for the multiplicative bypass:\r\n\r\n$$\r\ns(Z)=Z\\_{1} \\odot f\\_{W, b}\\left(Z\\_{2}\\right)\r\n$$\r\n\r\nThey also normalize the input to $f\\_{W, b}$ which empirically improved the stability of large NLP models.","description_state":"present","introduced_year":null,"introduced_by":{"title":"Pay Attention to MLPs","paper":"/paper/pay-attention-to-mlps","first_author":"Hanxiao Liu","n_authors":4,"url_abs":null,"archive_paper_url":"https://paperswithcode.com/paper/pay-attention-to-mlps"},"source":{"url":"https://arxiv.org/abs/2105.08050v2","title":"Pay Attention to MLPs","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":"Feedforward Networks","url":"/methods/category/feedforward-networks","pwc_aliases":[]}],"n_papers_tagged":9,"archive_num_papers":9,"papers_newest_first":[{"paper":null,"title":"Image Super-resolution Reconstruction Network based on Enhanced Swin Transformer via Alternating Aggregation of Local-Global Features","date":"2023-12-30","arxiv_id":"2401.00241","n_code_links":0,"syntology":null},{"paper":null,"title":"SigVIC: Spatial Importance Guided Variable-Rate Image Compression","date":"2023-03-16","arxiv_id":"2303.09112","n_code_links":0,"syntology":null},{"paper":"/paper/gswin-gated-mlp-vision-model-with","title":"gSwin: Gated MLP Vision Model with Hierarchical Structure of Shifted Window","date":"2022-08-24","arxiv_id":"2208.11718","n_code_links":0,"syntology":null},{"paper":"/paper/a-proposal-of-multi-layer-perceptron-with","title":"A Proposal of Multi-Layer Perceptron with Graph Gating Unit for Graph Representation Learning and its Application to Surrogate Model for FEM","date":"2022-07-11","arxiv_id":null,"n_code_links":1,"syntology":null},{"paper":"/paper/bag-of-words-vs-sequence-vs-graph-vs","title":"Are We Really Making Much Progress in Text Classification? A Comparative Review","date":"2022-04-08","arxiv_id":"2204.03954","n_code_links":1,"syntology":null},{"paper":"/paper/efficient-language-modeling-with-sparse-all","title":"Efficient Language Modeling with Sparse all-MLP","date":"2022-03-14","arxiv_id":"2203.06850","n_code_links":0,"syntology":null},{"paper":null,"title":"Convolutional Gated MLP: Combining Convolutions & gMLP","date":"2021-11-06","arxiv_id":"2111.03940","n_code_links":0,"syntology":null},{"paper":"/paper/cyclemlp-a-mlp-like-architecture-for-dense","title":"CycleMLP: A MLP-like Architecture for Dense Prediction","date":"2021-07-21","arxiv_id":"2107.10224","n_code_links":8,"syntology":{"ran":8,"of":15,"unverified":7,"pointer_only":1}},{"paper":"/paper/pay-attention-to-mlps","title":"Pay Attention to MLPs","date":"2021-05-17","arxiv_id":"2105.08050","n_code_links":20,"syntology":{"ran":34,"of":44,"unverified":10,"pointer_only":11}}],"papers_shown":9,"tasks":[{"task":"/task/image-classification","name":"Image Classification","papers":3},{"task":"/task/instance-segmentation","name":"Instance Segmentation","papers":2},{"task":"/task/object-detection","name":"Object Detection","papers":2},{"task":"/task/question-answering","name":"Question Answering","papers":2},{"task":"/task/semantic-segmentation","name":"Semantic Segmentation","papers":2},{"task":"/task/object-detection-1","name":"object-detection","papers":2},{"task":"/task/all","name":"All","papers":1},{"task":"/task/classification-1","name":"Classification","papers":1},{"task":"/task/common-sense-reasoning","name":"Common Sense Reasoning","papers":1},{"task":"/task/decoder","name":"Decoder","papers":1},{"task":"/task/deep-learning","name":"Deep Learning","papers":1},{"task":"/task/diversity","name":"Diversity","papers":1},{"task":"/task/graph-representation-learning","name":"Graph Representation Learning","papers":1},{"task":"/task/image-compression","name":"Image Compression","papers":1},{"task":"/task/image-super-resolution","name":"Image Super-Resolution","papers":1},{"task":"/task/in-context-learning","name":"In-Context Learning","papers":1},{"task":"/task/language-modeling","name":"Language Modeling","papers":1},{"task":"/task/language-modelling","name":"Language Modelling","papers":1},{"task":"/task/mixture-of-experts","name":"Mixture-of-Experts","papers":1},{"task":"/task/multi-label-text-classification-1","name":"Multi Label Text Classification","papers":1}],"tasks_shown":20,"n_tasks":35,"usage_by_year":[{"year":"2021","papers":3},{"year":"2022","papers":4},{"year":"2023","papers":2}],"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/spatial-gating-unit"},"syntology_read_at":"2026-09-24T18:15:14+00:00"}