Compositional Attention: Disentangling Search and Retrieval
Not on the map. Why?
Abstract (arXiv)
Multi-head, key-value attention is the backbone of the widely successful Transformer model and its variants. This attention mechanism uses multiple parallel key-value attention blocks (called heads), each performing two fundamental computations: (1) search - selection of a relevant entity from a set via query-key interactions, and (2) retrieval - extraction of relevant features from the selected entity via a value matrix. Importantly, standard attention heads learn a rigid mapping between search and retrieval. In this work, we first highlight how this static nature of the pairing can potentially: (a) lead to learning of redundant parameters in certain tasks, and (b) hinder generalization. To alleviate this problem, we propose a novel attention mechanism, called Compositional Attention, that replaces the standard head structure. The proposed mechanism disentangles search and retrieval and composes them in a dynamic, flexible and context-dependent manner through an additional soft competition stage between the query-key combination and value pairing. Through a series of numerical experiments, we show that it outperforms standard multi-head attention on a variety of tasks, including some out-of-distribution settings. Through our qualitative analysis, we demonstrate that Compositional Attention leads to dynamic specialization based on the type of retrieval needed. Our proposed mechanism generalizes multi-head attention, allows independent scaling of search and retrieval, and can easily be implemented in lieu of standard attention heads in any network architecture.
Key facts. Cited by 12 papers in the map (data through 7 Oct 2026). Builds on 42 of its 52 references that are in the map. First posted on arXiv 18 Oct 2021.
Builds on
42 of 52 references.
References · 42
- 2017Attention Is All You Needcited by 59,932
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
- 2020An Image is Worth 16x16 Words: Transformers for Image Recognition at Scalecited by 29,915
- 2014Neural Machine Translation by Jointly Learning to Align and Translatecited by 4,530
- 2016Pointer Sentinel Mixture Modelscited by 2,992
- 2020Reformer: The Efficient Transformercited by 1,658
- 2020Rethinking Attention with Performerscited by 1,584
- 2019Generating Long Sequences with Sparse Transformerscited by 1,523
- 2019fairseq: A Fast, Extensible Toolkit for Sequence Modelingcited by 1,486
- 2020Linformer: Self-Attention with Linear Complexitycited by 1,462
- 2015Show, Attend and Tell: Neural Image Caption Generation with Visual Attentioncited by 1,421
- 2015Effective Approaches to Attention-based Neural Machine Translationcited by 1,024
30 more
- 2020Object-Centric Learning with Slot Attentioncited by 865
- 2019Analyzing Multi-Head Self-Attention: Specialized Heads Do the Heavy Lifting, the Rest Can Be Prunedcited by 844
- 2019Are Sixteen Heads Really Better than One?cited by 803
- 2020Efficient Transformers: A Surveycited by 784
- 2014Neural Turing Machinescited by 630
- 2018Universal Transformerscited by 613
- 2019Deep Equilibrium Modelscited by 603
- 2017A simple neural network module for relational reasoningcited by 345
- 2019Measuring Compositional Generalization: A Comprehensive Method on Realistic Datacited by 280
- 2020Inductive Biases for Deep Learning of Higher-Level Cognitioncited by 273
- 2019Compositionality decomposed: how do neural networks generalise?cited by 264
- 2019Recurrent Independent Mechanismscited by 219
- 2018Compositional Attention Networks for Machine Reasoningcited by 183
- 2019A Meta-Transfer Objective for Learning to Disentangle Causal Mechanismscited by 158
- 2021Investigating the Limitations of Transformers with Simple Arithmetic Taskscited by 136
- 2021The Devil is in the Detail: Simple Tricks Improve Systematic Generalization of Transformerscited by 117
- 2017The Consciousness Priorcited by 105
- 2021Coordination Among Neural Modules Through a Shared Global Workspacecited by 83
- 2020Compositional Generalization via Neural-Symbolic Stack Machinescited by 80
- 2021Neural Production Systems: Learning Rule-Governed Visual Dynamicscited by 75
- 2021Systematic Evaluation of Causal Discovery in Visual Model Based Reinforcement Learningcited by 53
- 2019Compositional Generalization for Primitive Substitutionscited by 48
- 2020Object Files and Schemata: Factorizing Declarative and Procedural Knowledge in Dynamical Systemscited by 48
- 2020Emergent Symbols through Binding in External Memorycited by 47
- 2020The EOS Decision and Length Extrapolationcited by 46
- 2018Memorize or generalize? Searching for a compositional RNN in a haystackcited by 41
- 2020Learning to Combine Top-Down and Bottom-Up Signals in Recurrent Neural Networks with Attention over Modulescited by 38
- 2021Fast and Slow Learning of Recurrent Independent Mechanismscited by 36
- 2021Transformers with Competitive Ensembles of Independent Mechanismscited by 19
- 2018Compositional Attention Networks for Interpretability in Natural Language Question Answeringcited by 1
Built on by
Citing papers per year: 2022: 4; 2023: 4; 2024: 3; 2025: 1.
12 papers.
- 2022Is a Modular Architecture Enough?cited by 35
- 2022On Neural Architecture Inductive Biases for Relational Taskscited by 26
- 2024A Complexity-Based Theory of Compositionalitycited by 13
- 2022Induced Natural Language Rationales and Interleaved Markup Tokens Enable Extrapolation in Large Language Modelscited by 10
- 2024Breaking Neural Network Scaling Laws with Modularitycited by 5
- 2023Associative Transformercited by 4
- 2023Modularity in Deep Learning: A Surveycited by 3
- 2023Layer-wise Representation Fusion for Compositional Generalizationcited by 2
- 2024Attention-based Iterative Decomposition for Tensor Product Representationcited by 2
- 2023Leveraging Synthetic Targets for Machine Translationcited by 1
- 2022A Short Survey of Systematic Generalizationcited by 0
- 2025Representing Signs as Signs: One-Shot ISLR to Facilitate Functional Sign Language Technologiescited by 0
- 2025Representing Signs as Signs: One-Shot ISLR to Facilitate Functional Sign Language Technologies27 Feb 2025
- 2024A Complexity-Based Theory of Compositionality18 Oct 2024
- 2024Breaking Neural Network Scaling Laws with Modularity9 Sep 2024
- 2024Attention-based Iterative Decomposition for Tensor Product Representation3 Jun 2024
- 2023Modularity in Deep Learning: A Survey2 Oct 2023
- 2023Associative Transformer22 Sep 2023
- 2023Layer-wise Representation Fusion for Compositional Generalization20 Jul 2023
- 2023Leveraging Synthetic Targets for Machine Translation7 May 2023
- 2022A Short Survey of Systematic Generalization22 Nov 2022
- 2022Induced Natural Language Rationales and Interleaved Markup Tokens Enable Extrapolation in Large Language Models24 Aug 2022
- 2022On Neural Architecture Inductive Biases for Relational Tasks9 Jun 2022
- 2022Is a Modular Architecture Enough?6 Jun 2022