SenseTime Research(商汤科技研究院);Australian National University(澳大利亚国立大学);OPPO Research Institute(OPPO研究院);Shanghai AI Laboratory(上海人工智能实验室);The University of Hong Kong(香港大学)
Linear transformers aim to reduce the quadratic space-time complexity of vanilla transformers. However, they usually suffer from degraded performances on various tasks and corpus. In this paper, we examine existing kernel-based linear transformers and identify two key issues that lead to such performance gaps: 1) unbounded gradients in the attention computation adversely impact the convergence of linear transformer models; 2) attention dilution which trivially distributes attention scores over long sequences while neglecting neighbouring structures. To address these issues, we first identify that the scaling of attention matrices is the devil in unbounded gradients, which turns out unnecessary in linear attention as we show theoretically and empirically. To this end, we propose a new linear attention that replaces the scaling operation with a normalization to stabilize gradients. For the issue of attention dilution, we leverage a diagonal attention to confine attention to only neighbouring tokens in early layers. Benefiting from the stable gradients and improved attention, our new linear transformer model, transNormer, demonstrates superior performance on text classification and language modeling tasks, as well as on the challenging Long-Range Arena benchmark, surpassing vanilla transformer and existing linear variants by a clear margin while being significantly more space-time efficient. The code is available at https://github.com/OpenNLPLab/Transnormer .
Shanghai AI Laboratory(上海人工智能实验室);Australian National University(澳大利亚国立大学);Northwestern Polytechnical University(西北工业大学);The University of Hong Kong(香港大学)
Transformer visualization via dictionary learning: contextualized embedding as a linear superposition of transformer factors
Facebook AI Research(脸书人工智能研究院);Berkeley AI Research (BAIR), UC Berkeley(加州大学伯克利分校伯克利人工智能研究院(BAIR));New York University(纽约大学);Redwood Center for Theoretical Neuroscience, UC Berkeley(加州大学伯克利分校雷德伍德理论神经科学中心)
LiFT: Local Search via Linear Programming for Overfitting-Controlled Transformers
Department of Management Sciences, Indian Institute of Technology Kanpur(印度理工学院坎普尔分校管理科学系);Department of Civil Engineering, Indian Institute of Technology Kanpur(印度理工学院坎普尔分校土木工程系);Operations and Decision Sciences, Indian Institute of Management Ahmedabad(印度管理学院艾哈迈达巴德分校运营与决策科学系);Brij Disa Centre for Data Science and AI, Indian Institute of Management Ahmedabad(印度管理学院艾哈迈达巴德分校Brij Disa数据科学与人工智能中心)
Multi-Layer Transformers Gradient Can be Approximated in Almost Linear Time
The University of Hong Kong(香港大学);University of Wisconsin-Madison(威斯康星大学麦迪逊分校);Tsinghua University(清华大学);The Simons Institute for the Theory of Computing at the University of California, Berkeley(加州大学伯克利分校西蒙斯理论计算研究所);University of Pennsylvania(宾夕法尼亚大学)
On the Robustness of Transformers against Context Hijacking for Linear Classification
Insititute of Data Science, The University of Hong Kong(香港大学数据科学学院);Actuarial Science, The University of Hong Kong(香港大学精算学系);Department of Computer Science, The University of Hong Kong(香港大学计算机科学系)
Relative Positional Encoding for Transformers with Linear Complexity
Inria(法国国家信息与自动化研究所);Télécom Paris(巴黎电信学院);Institut Polytechnique de Paris(巴黎理工学院);Research Center for IT Innovation, Academia Sinica(中央研究院资讯科技创新研究中心);National Taiwan University(台湾大学);Taiwan AI Labs(台湾人工智能实验室);PSL Research University(巴黎文理研究大学);École Normale Supérieure(巴黎高等师范学院)