Sliceformer: Make Multi-head Attention as Simple as Sorting in Discriminative Tasks
Not on the map. Why?
Abstract (arXiv)
As one of the most popular neural network modules, Transformer plays a central role in many fundamental deep learning models, e.g., the ViT in computer vision and the BERT and GPT in natural language processing. The effectiveness of the Transformer is often attributed to its multi-head attention (MHA) mechanism. In this study, we discuss the limitations of MHA, including the high computational complexity due to its ``query-key-value'' architecture and the numerical issue caused by its softmax operation. Considering the above problems and the recent development tendency of the attention layer, we propose an effective and efficient surrogate of the Transformer, called Sliceformer. Our Sliceformer replaces the classic MHA mechanism with an extremely simple ``slicing-sorting'' operation, i.e., projecting inputs linearly to a latent space and sorting them along different feature dimensions (or equivalently, called channels). For each feature dimension, the sorting operation implicitly generates an implicit attention map with sparse, full-rank, and doubly-stochastic structures. We consider different implementations of the slicing-sorting operation and analyze their impacts on the Sliceformer. We test the Sliceformer in the Long-Range Arena benchmark, image classification, text classification, and molecular property prediction, demonstrating its advantage in computational complexity and universal effectiveness in discriminative tasks. Our Sliceformer achieves comparable or better performance with lower memory cost and faster speed than the Transformer and its variants. Moreover, the experimental results reveal that applying our Sliceformer can empirically suppress the risk of mode collapse when representing data. The code is available at urlhttps://github.com/SDS-Lab/sliceformer.
Key facts. Cited by 1 paper in the map (data through 14 Oct 2026). Builds on 33 of its 43 references that are in the map. First posted on arXiv 26 Oct 2023.
Builds on
33 of 43 references.
References · 33
- 2017Attention Is All You Needcited by 60,361
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,399
- 2020Language Models are Few-Shot Learnerscited by 32,419
- 2020An Image is Worth 16x16 Words: Transformers for Image Recognition at Scalecited by 30,186
- 2021Swin Transformer: Hierarchical Vision Transformer using Shifted Windowscited by 12,139
- 2020Longformer: The Long-Document Transformercited by 3,413
- 2019XLNet: Generalized Autoregressive Pretraining for Language Understandingcited by 2,811
- 2021Efficiently Modeling Long Sequences with Structured State Spacescited by 2,465
- 2020Informer: Beyond Efficient Transformer for Long Sequence Time-Series Forecastingcited by 2,169
- 2020Transformers are RNNs: Fast Autoregressive Transformers with Linear Attentioncited by 2,022
- 2019Transformer-XL: Attentive Language Models Beyond a Fixed-Length Contextcited by 1,850
- 2021ViViT: A Video Vision Transformercited by 1,620
21 more
- 2020Rethinking Attention with Performerscited by 1,601
- 2019Generating Long Sequences with Sparse Transformerscited by 1,546
- 2020Linformer: Self-Attention with Linear Complexitycited by 1,474
- 2020Point Transformercited by 1,470
- 2021MLP-Mixer: An all-MLP Architecture for Visioncited by 1,446
- 2022Simplified State Space Layers for Sequence Modelingcited by 788
- 2020Long Range Arena: A Benchmark for Efficient Transformerscited by 700
- 2021Attention is Not All You Need: Pure Attention Loses Rank Doubly Exponentially with Depthcited by 419
- 2021OGB-LSC: A Large-Scale Challenge for Machine Learning on Graphscited by 329
- 2021Do Transformers Really Perform Bad for Graph Representation?cited by 320
- 2021Mesh Graphormercited by 265
- 2020Sparse Sinkhorn Attentioncited by 251
- 2020Transformer Hawkes Processcited by 235
- 2019Transformer Dissection: A Unified Understanding of Transformer's Attention via the Lens of Kernelcited by 213
- 2022cosFormer: Rethinking Softmax in Attentioncited by 213
- 2020Synthesizer: Rethinking Self-Attention in Transformer Modelscited by 205
- 2022Mega: Moving Average Equipped Gated Attentioncited by 179
- 2021Sinkformers: Transformers with Doubly Stochastic Attentioncited by 138
- 2021Visformer: The Vision-friendly Transformercited by 137
- 2018ListOps: A Diagnostic Dataset for Latent Tree Learningcited by 129
- 2018Learning long-range spatial dependencies with horizontal gated-recurrent unitscited by 98
Built on by
Citing papers per year: 2025: 1.
1 paper.