A Primal-Dual Framework for Transformers and Neural Networks
Tan Minh Nguyen, Tam Minh Nguyen, Nhat Ho, Andrea L. Bertozzi, Richard G. Baraniuk, Stanley J. Osher
Abstract
Self-attention is key to the remarkable success of transformers in sequence modeling tasks including many applications in natural language processing and computer vision. Like neural network layers, these attention mechanisms are often developed by heuristics and experience. To provide a principled framework for constructing attention layers in transformers, we show that the self-attention corresponds to the support vector expansion derived from a support vector regression problem, whose primal formulation has the form of a neural network layer. Using our framework, we derive popular attention layers used in practice and propose two new attentions: 1) the Batch Normalized Attention (Attention-BN) derived from the batch normalization layer and 2) the Attention with Scaled Head (Attention-SH) derived from using less training data to fit the SVR model. We empirically demonstrate the advantages of the Attention-BN and Attention-SH in reducing head redundancy, increasing the model's accuracy, and improving the model's efficiency in a variety of practical applications including image and time-series classification.
Ask Lune
Know this paper in minutes, not an afternoon.
Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.
10 top-tier papers have cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- Elliptical Attention cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
- Elliptical Attention cites Zero-Shot Text-to-Image Generation
- Elliptical Attention cites Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
- Elliptical Attention cites Primal-Attention: Self-attention through Asymmetric Kernel SVD in Primal Representation
- Elliptical Attention cites Learning Transferable Visual Models From Natural Language Supervision
- Elliptical Attention cites Unveiling the Hidden Structure of Self-Attention via Kernel Principal Component Analysis
- Unveiling the Hidden Structure of Self-Attention via Kernel Principal Component Analysis cites Elliptical Attention
- Towards Causal Foundation Model: on Duality between Optimal Balancing and Attention cites Language Models are Few-Shot Learners
- Towards Causal Foundation Model: on Duality between Optimal Balancing and Attention cites Learning Transferable Visual Models From Natural Language Supervision
- An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale cites Language Models are Few-Shot Learners
- Zero-Shot Text-to-Image Generation cites Learning Transferable Visual Models From Natural Language Supervision
- Swin Transformer: Hierarchical Vision Transformer using Shifted Windows cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
- Swin Transformer: Hierarchical Vision Transformer using Shifted Windows cites Learning Transferable Visual Models From Natural Language Supervision
- Max-Margin Token Selection in Attention Mechanism cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
- Max-Margin Token Selection in Attention Mechanism cites Zero-Shot Text-to-Image Generation
- Max-Margin Token Selection in Attention Mechanism cites Language Models are Few-Shot Learners
- Max-Margin Token Selection in Attention Mechanism cites Learning Transferable Visual Models From Natural Language Supervision
- Primal-Attention: Self-attention through Asymmetric Kernel SVD in Primal Representation cites Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
- Primal-Attention: Self-attention through Asymmetric Kernel SVD in Primal Representation cites Language Models are Few-Shot Learners
- Learning Transferable Visual Models From Natural Language Supervision cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
- Learning Transferable Visual Models From Natural Language Supervision cites Language Models are Few-Shot Learners
- Unveiling the Hidden Structure of Self-Attention via Kernel Principal Component Analysis cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
- Unveiling the Hidden Structure of Self-Attention via Kernel Principal Component Analysis cites Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
- Unveiling the Hidden Structure of Self-Attention via Kernel Principal Component Analysis cites Primal-Attention: Self-attention through Asymmetric Kernel SVD in Primal Representation
- Unveiling the Hidden Structure of Self-Attention via Kernel Principal Component Analysis cites Language Models are Few-Shot Learners
- Unveiling the Hidden Structure of Self-Attention via Kernel Principal Component Analysis cites Learning Transferable Visual Models From Natural Language Supervision
Cited by top-tier papers10
- Max-Margin Token Selection in Attention MechanismDavoud Ataee Tarzanagh, Yingcong Li, Xuechen Zhang, Samet OymakNeurIPS 2023 · 67 citations
- Primal-Attention: Self-attention through Asymmetric Kernel SVD in Primal RepresentationYingyi Chen, Qinghua Tao, Francesco Tonin, Johan A. K. SuykensNeurIPS 2023 · 42 citations
- Elliptical AttentionStefan K. Nielsen, Laziz U. Abdullaev, Rachel S. Y. Teo, Tan NguyenNeurIPS 2024 · 12 citations
- Unveiling the Hidden Structure of Self-Attention via Kernel Principal Component AnalysisRachel S. Y. Teo, Tan M. NguyenNeurIPS 2024 · 11 citations
- Towards Causal Foundation Model: on Duality between Optimal Balancing and AttentionJiaqi Zhang, Joel Jennings, Agrin Hilmkil, Nick Pawlowski et al.ICML 2024 · 9 citations
Builds on29
- Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
- Learning Transferable Visual Models From Natural Language SupervisionAlec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh et al.ICML 2021 · 47,906 citations
- Swin Transformer: Hierarchical Vision Transformer using Shifted WindowsZe Liu, Yutong Lin, Yue Cao, Han Hu et al.ICCV 2021 · 31,683 citations
- An Image is Worth 16x16 Words: Transformers for Image Recognition at ScaleAlexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn et al.ICLR 2021 · 21,477 citations
- Zero-Shot Text-to-Image GenerationAditya Ramesh, Mikhail Pavlov, Gabriel Goh, Scott Gray et al.ICML 2021 · 6,356 citations
Related papers
- Implicit Kernel AttentionKyungwoo Song, Yohan Jung, Dongjun Kim, Il-Chul MoonAAAI 2021 · 18 citations
- SLAB: Efficient Transformers with Simplified Linear Attention and Progressive Re-parameterized Batch NormalizationJialong Guo, Xinghao Chen, Yehui Tang, Yunhe WangICML 2024 · 40 citations
- FourierFormer: Transformer Meets Generalized Fourier Integral TheoremTan Nguyen, Minh Pham, Tam Nguyen, Khai Nguyen et al.NeurIPS 2022 · 59 citations
- Improving Transformers with Probabilistic Attention KeysTam Minh Nguyen, Tan Minh Nguyen, Dung D. Le, Duy Khuong Nguyen et al.ICML 2022 · 38 citations
- Dissecting the Interplay of Attention Paths in a Statistical Mechanics Theory of TransformersLorenzo Tiberi, Francesca Mignacco, Kazuki Irie, Haim SompolinskyNeurIPS 2024 · 12 citations
