{"url":"/method/multi-head-linear-attention","slug":"multi-head-linear-attention","name":"Multi-Head Linear Attention","full_name":"Multi-Head Linear Attention","full_name_withheld":false,"description_markdown":"**Multi-Head Linear Attention** is a type of linear multi-head self-attention module, proposed with the [Linformer](https://paperswithcode.com/method/linformer) architecture. The main idea is to add two linear projection matrices $E\\_{i}, F\\_{i} \\in \\mathbb{R}^{n\\times{k}}$ when computing key and value. We first project the original $\\left(n \\times d\\right)$-dimensional key and value layers $KW\\_{i}^{K}$ and $VW\\_{i}^{V}$ into $\\left(k\\times{d}\\right)$-dimensional projected key and value layers. We then compute a $\\left(n\\times{k}\\right)$ dimensional context mapping $\\bar{P}$ using scaled-dot product attention:\r\n\r\n$$ \\bar{\\text{head}\\_{i}} = \\text{Attention}\\left(QW^{Q}\\_{i}, E\\_{i}KW\\_{i}^{K}, F\\_{i}VW\\_{i}^{V}\\right) $$\r\n\r\n$$ \\bar{\\text{head}\\_{i}} = \\text{softmax}\\left(\\frac{QW^{Q}\\_{i}\\left(E\\_{i}KW\\_{i}^{K}\\right)^{T}}{\\sqrt{d\\_{k}}}\\right) \\cdot F\\_{i}VW\\_{i}^{V} $$\r\n\r\nFinally, we compute context embeddings for each head using $\\bar{P} \\cdot \\left(F\\_{i}{V}W\\_{i}^{V}\\right)$.","description_state":"present","introduced_year":null,"introduced_by":{"title":"Linformer: Self-Attention with Linear Complexity","paper":"/paper/linformer-self-attention-with-linear","first_author":"Sinong Wang","n_authors":5,"url_abs":null,"archive_paper_url":"https://paperswithcode.com/paper/linformer-self-attention-with-linear"},"source":{"url":"https://arxiv.org/abs/2006.04768v3","title":"Linformer: Self-Attention with Linear Complexity","url_on_a_paper_host":true},"code_snippet_url":"https://github.com/tatp22/linformer-pytorch/blob/3f71fe757ea8c19135880414e707701b24de27f1/linformer_pytorch/linformer_pytorch.py#L173","code_snippet_url_on_a_code_host":true,"categories":[{"area":"General","area_id":"general","collection":"Attention Modules","url":"/methods/category/attention-modules","pwc_aliases":[]}],"n_papers_tagged":24,"archive_num_papers":24,"papers_newest_first":[{"paper":null,"title":"FaceLiVT: Face Recognition using Linear Vision Transformer with Structural Reparameterization For Mobile Device","date":"2025-06-12","arxiv_id":"2506.10361","n_code_links":0,"syntology":null},{"paper":null,"title":"CacheFormer: High Attention-Based Segment Caching","date":"2025-04-18","arxiv_id":"2504.13981","n_code_links":0,"syntology":null},{"paper":null,"title":"HIIF: Hierarchical Encoding based Implicit Image Function for Continuous Super-resolution","date":"2024-12-04","arxiv_id":"2412.03748","n_code_links":0,"syntology":null},{"paper":null,"title":"LinFormer: A Linear-based Lightweight Transformer Architecture For Time-Aware MIMO Channel Prediction","date":"2024-10-28","arxiv_id":"2410.21351","n_code_links":0,"syntology":null},{"paper":"/paper/joint-fine-tuning-and-conversion-of","title":"Joint Fine-tuning and Conversion of Pretrained Speech and Language Models towards Linear Complexity","date":"2024-10-09","arxiv_id":"2410.06846","n_code_links":1,"syntology":{"ran":5,"of":5,"unverified":0,"pointer_only":0}},{"paper":null,"title":"GLMHA A Guided Low-rank Multi-Head Self-Attention for Efficient Image Restoration and Spectral Reconstruction","date":"2024-10-01","arxiv_id":"2410.00380","n_code_links":0,"syntology":null},{"paper":"/paper/attention-as-a-hypernetwork","title":"Attention as a Hypernetwork","date":"2024-06-09","arxiv_id":"2406.05816","n_code_links":1,"syntology":{"ran":1,"of":1,"unverified":0,"pointer_only":0}},{"paper":null,"title":"Sumformer: Universal Approximation for Efficient Transformers","date":"2023-07-05","arxiv_id":"2307.02301","n_code_links":0,"syntology":null},{"paper":"/paper/road-barlow-twins-redundancy-reduction-for","title":"RedMotion: Motion Prediction via Redundancy Reduction","date":"2023-06-19","arxiv_id":"2306.10840","n_code_links":3,"syntology":{"ran":1,"of":1,"unverified":0,"pointer_only":1}},{"paper":null,"title":"UMat: Uncertainty-Aware Single Image High Resolution Material Capture","date":"2023-05-25","arxiv_id":"2305.16312","n_code_links":0,"syntology":null},{"paper":"/paper/mpcvit-searching-for-mpc-friendly-vision","title":"MPCViT: Searching for Accurate and Efficient MPC-Friendly Vision Transformer with Heterogeneous Attention","date":"2022-11-25","arxiv_id":"2211.13955","n_code_links":1,"syntology":null},{"paper":null,"title":"Treeformer: Dense Gradient Trees for Efficient Attention Computation","date":"2022-08-18","arxiv_id":"2208.09015","n_code_links":0,"syntology":null},{"paper":null,"title":"Rethinking Attention Mechanism in Time Series Classification","date":"2022-07-14","arxiv_id":"2207.07564","n_code_links":0,"syntology":null},{"paper":null,"title":"Linearizing Transformer with Key-Value Memory","date":"2022-03-23","arxiv_id":"2203.12644","n_code_links":0,"syntology":null},{"paper":"/paper/sketching-as-a-tool-for-understanding-and","title":"Sketching as a Tool for Understanding and Accelerating Self-attention for Long Sequences","date":"2021-12-10","arxiv_id":"2112.05359","n_code_links":1,"syntology":null},{"paper":null,"title":"Greenformers: Improving Computation and Memory Efficiency in Transformer Models via Low-Rank Approximation","date":"2021-08-24","arxiv_id":"2108.10808","n_code_links":0,"syntology":null},{"paper":"/paper/vision-xformers-efficient-attention-for-image","title":"Vision Xformers: Efficient Attention for Image Classification","date":"2021-07-05","arxiv_id":"2107.02239","n_code_links":2,"syntology":null},{"paper":"/paper/styleformer-transformer-based-generative","title":"Styleformer: Transformer based Generative Adversarial Networks with Style Vector","date":"2021-06-13","arxiv_id":"2106.07023","n_code_links":3,"syntology":{"ran":4,"of":4,"unverified":0,"pointer_only":0}},{"paper":null,"title":"Self-supervised Depth Estimation Leveraging Global Perception and Geometric Smoothness Using On-board Videos","date":"2021-06-07","arxiv_id":"2106.03505","n_code_links":0,"syntology":null},{"paper":null,"title":"A Practical Survey on Faster and Lighter Transformers","date":"2021-03-26","arxiv_id":"2103.14636","n_code_links":0,"syntology":null},{"paper":null,"title":"Multi-Head Linear Attention Generative Adversarial Network for Thin Cloud Removal","date":"2020-12-20","arxiv_id":"2012.10898","n_code_links":0,"syntology":null},{"paper":null,"title":"Revisiting Linformer with a modified self-attention with linear complexity","date":"2020-12-16","arxiv_id":"2101.10277","n_code_links":0,"syntology":null},{"paper":null,"title":"Efficient Transformers: A Survey","date":"2020-09-14","arxiv_id":"2009.06732","n_code_links":0,"syntology":null},{"paper":"/paper/linformer-self-attention-with-linear","title":"Linformer: Self-Attention with Linear Complexity","date":"2020-06-08","arxiv_id":"2006.04768","n_code_links":3,"syntology":{"ran":3,"of":4,"unverified":1,"pointer_only":2}}],"papers_shown":24,"tasks":[{"task":"/task/knowledge-distillation","name":"Knowledge Distillation","papers":3},{"task":"/task/language-modelling","name":"Language Modelling","papers":3},{"task":"/task/classification-1","name":"Classification","papers":2},{"task":null,"name":"GPU","papers":2},{"task":"/task/language-modeling","name":"Language Modeling","papers":2},{"task":"/task/prediction","name":"Prediction","papers":2},{"task":"/task/survey","name":"Survey","papers":2},{"task":"/task/abstractive-text-summarization","name":"Abstractive Text Summarization","papers":1},{"task":"/task/active-learning","name":"Active Learning","papers":1},{"task":"/task/autonomous-driving","name":"Autonomous Driving","papers":1},{"task":"/task/cloud-removal","name":"Cloud Removal","papers":1},{"task":"/task/data-augmentation","name":"Data Augmentation","papers":1},{"task":"/task/deblurring","name":"Deblurring","papers":1},{"task":"/task/decoder","name":"Decoder","papers":1},{"task":"/task/depth-estimation","name":"Depth Estimation","papers":1},{"task":"/task/face-recognition","name":"Face Recognition","papers":1},{"task":null,"name":"Generative Adversarial Network","papers":1},{"task":"/task/image-classification","name":"Image Classification","papers":1},{"task":"/task/image-generation","name":"Image Generation","papers":1},{"task":"/task/image-restoration","name":"Image Restoration","papers":1}],"tasks_shown":20,"n_tasks":48,"usage_by_year":[{"year":"2020","papers":4},{"year":"2021","papers":6},{"year":"2022","papers":4},{"year":"2023","papers":3},{"year":"2024","papers":5},{"year":"2025","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/multi-head-linear-attention"},"syntology_read_at":"2026-09-24T18:15:14+00:00"}