Lune

NeurIPS2022Top-tier venue

Your Transformer May Not be as Powerful as You Expect

Shengjie Luo, Shanda Li, Shuxin Zheng, Tie-Yan Liu, Liwei Wang, Di He

Abstract

Relative Positional Encoding (RPE), which encodes the relative distance between any pair of tokens, is one of the most successful modifications to the original Transformer. As far as we know, theoretical understanding of the RPE-based Transformers is largely unexplored. In this work, we mathematically analyze the power of RPE-based Transformers regarding whether the model is capable of approximating any continuous sequence-to-sequence functions. One may naturally assume the answer is in the affirmative-RPE-based Transformers are universal function approximators. However, we present a negative result by showing there exist continuous sequence-to-sequence functions that RPE-based Transformers cannot approximate no matter how deep and wide the neural network is. One key reason lies in that most RPEs are placed in the softmax attention that always generates a right stochastic matrix. This restricts the network from capturing positional information in the RPEs and limits its capacity. To overcome the problem and make the model more powerful, we first present sufficient conditions for RPE-based Transformers to achieve universal function approximation. With the theoretical guidance, we develop a novel attention module, called Universal RPE-based (URPE) Attention, which satisfies the conditions. Therefore, the corresponding URPE-based Transformers become universal function approximators. Extensive experiments covering typical architectures and tasks demonstrate that our model is parameter-efficient and can achieve superior performance to strong baselines in a wide range of applications. The code will be made publicly available at https://github.com/lsj2408/URPE . The order is decided by rolling the dice.

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.

33 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • A Complete Expressiveness Hierarchy for Subgraph GNNs via Subgraph Weisfeiler-Lehman Tests cites Do Transformers Really Perform Badly for Graph Representation?
  • Beyond Weisfeiler-Lehman: A Quantitative Framework for GNN Expressiveness cites A Complete Expressiveness Hierarchy for Subgraph GNNs via Subgraph Weisfeiler-Lehman Tests
  • Beyond Weisfeiler-Lehman: A Quantitative Framework for GNN Expressiveness cites Do Transformers Really Perform Badly for Graph Representation?
  • Do Transformers Really Perform Badly for Graph Representation? cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • Do Transformers Really Perform Badly for Graph Representation? cites Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
  • Functional Interpolation for Relative Positions improves Long Context Transformers cites Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolation
  • Functional Interpolation for Relative Positions improves Long Context Transformers cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • Functional Interpolation for Relative Positions improves Long Context Transformers cites Do Transformers Really Perform Badly for Graph Representation?
  • Functional Interpolation for Relative Positions improves Long Context Transformers cites Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
  • Swin Transformer: Hierarchical Vision Transformer using Shifted Windows cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • Graph Inductive Biases in Transformers without Message Passing cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • Graph Inductive Biases in Transformers without Message Passing cites Do Transformers Really Perform Badly for Graph Representation?
  • Graph Inductive Biases in Transformers without Message Passing cites Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
  • Towards Revealing the Mystery behind Chain of Thought: A Theoretical Perspective cites Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolation
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers33

  1. Towards Revealing the Mystery behind Chain of Thought: A Theoretical PerspectiveGuhao Feng, Bohang Zhang, Yuntian Gu, Haotian Ye et al.NeurIPS 2023 · 470 citations
  2. Graph Inductive Biases in Transformers without Message PassingLiheng Ma, Chen Lin, Derek Lim, Adriana Romero-Soriano et al.ICML 2023 · 185 citations
  3. A Complete Expressiveness Hierarchy for Subgraph GNNs via Subgraph Weisfeiler-Lehman TestsBohang Zhang, Guhao Feng, Yiheng Du, Di He et al.ICML 2023 · 84 citations
  4. Functional Interpolation for Relative Positions improves Long Context TransformersShanda Li, Chong You, Guru Guruganesh, Joshua Ainslie et al.ICLR 2024 · 66 citations
  5. Beyond Weisfeiler-Lehman: A Quantitative Framework for GNN ExpressivenessBohang Zhang, Jingchu Gai, Yiheng Du, Qiwei Ye et al.ICLR 2024 · 59 citations

Builds on20

  1. Swin Transformer: Hierarchical Vision Transformer using Shifted WindowsZe Liu, Yutong Lin, Yue Cao, Han Hu et al.ICCV 2021 · 31,683 citations
  2. 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
  3. Deberta: decoding-Enhanced Bert with Disentangled AttentionPengcheng He, Xiaodong Liu, Jianfeng Gao, Weizhu ChenICLR 2021 · 3,729 citations
  4. Do Transformers Really Perform Badly for Graph Representation?Chengxuan Ying, Tianle Cai, Shengjie Luo, Shuxin Zheng et al.NeurIPS 2021 · 1,632 citations
  5. Train Short, Test Long: Attention with Linear Biases Enables Input Length ExtrapolationOfir Press, Noah A. Smith, Mike LewisICLR 2022 · 1,168 citations

Related papers

  1. Are Transformers universal approximators of sequence-to-sequence functions?Chulhee Yun, Srinadh Bhojanapalli, Ankit Singh Rawat, Sashank J. Reddi et al.ICLR 2020 · 481 citations
  2. Exploring Transformer ExtrapolationZhen Qin, Yiran Zhong, Hui DengAAAI 2024 · 12 citations
  3. Stable, Fast and Accurate: Kernelized Attention with Relative Positional EncodingShengjie Luo, Shanda Li, Tianle Cai, Di He et al.NeurIPS 2021 · 66 citations
  4. Universal Approximation with Softmax AttentionJerry Yao-Chieh Hu, Hude Liu, Hong-Yu Chen, Weimin Wu et al.ICML 2026 · 9 citations
  5. DAPE: Data-Adaptive Positional Encoding for Length ExtrapolationChuanyang Zheng, Yihang Gao, Han Shi, Minbin Huang et al.NeurIPS 2024 · 42 citations
Dusk over the sea between two cliffs drawn in fine vertical lines