Proceedings

X-former Elucidator: Reviving Efficient Attention for Long Context Language Modeling

Download BibTeX Cite

Proceedings of the Thirty-Third International Joint Conference on Artificial Intelligence. Survey Track. Pages 8179-8187.

https://doi.org/10.24963/ijcai.2024/904

Abstract

Transformer-based LLMs are becoming increasingly important in various AI applications. However, apart from the success of LLMs, the explosive demand of long context handling capabilities is a key and in-time problem for both academia and industry.

Due to the limitations from the quadratic complexity of the attention mechanism, long context scenarios require much more resources for LLM development and deployment, bringing huge challenges to the underlying AI infrastructure.

Meanwhile, we observe that there is a trend of reviving previous efficient attention mechanisms to latest LLMs.

However, it still remains an open question about how to select from these diverse approaches in practice.

In this paper, we answer this question from several aspects.

First, we revisit these latest long-context LLM innovations and discuss their relationship with prior approaches with a novel and comprehensive taxonomy.

Next, we conduct a thorough evaluation over various types of workloads considering both efficiency and effectiveness.

Finally, we provide an in-depth analysis, summarize our key findings, and offer insightful suggestions on the trade-offs of designing and deploying efficient attention mechanisms for Transformer-based LLMs.

  1. [Ainslie et al., 2023] Joshua Ainslie, James Lee-Thorp, Michiel de Jong, Yury Zemlyanskiy, Federico Lebrón, and Sumit Sanghai. Gqa: Training generalized multi- query transformer models from multi-head checkpoints. In EMNLP, 2023.
  2. [Anagnostidis et al., 2023] Sotiris Anagnostidis, Dario Pavllo, Luca Biggio, Lorenzo Noci, Aurelien Lucchi, and Thomas Hoffmann. Dynamic context pruning for efficient and interpretable autoregressive transformers. In NeurIPS, 2023.
  3. [Beltagy et al., 2020] Iz Beltagy, Matthew E Peters, and Ar- man Cohan. Longformer: The long-document transformer. arXiv preprint arXiv:2004.05150, 2020.
  4. [Chevalier et al., 2023] Alexis Chevalier, Alexander Wettig, Anirudh Ajith, and Danqi Chen. Adapting language models to compress contexts. In EMNLP, 2023.
  5. [Child et al., 2019] Rewon Child, Scott Gray, Alec Radford, and Ilya Sutskever. Generating long sequences with sparse transformers. arXiv preprint arXiv:1904.10509, 2019.
  6. [Choromanski et al., 2020] Krzysztof Choromanski, Valerii Likhosherstov, David Dohan, Xingyou Song, Andreea Gane, Tamas Sarlos, Peter Hawkins, Jared Davis, Afroz Mohiuddin, Lukasz Kaiser, et al. Rethinking attention with performers. arXiv preprint arXiv:2009.14794, 2020.
  7. [Clevert et al., 2015] Djork-Arné Clevert, Thomas Un- terthiner, and Sepp Hochreiter. Fast and accurate deep network learning by exponential linear units (elus). arXiv preprint arXiv:1511.07289, 2015.
  8. [Correia et al., 2019] Gonçalo M Correia, Vlad Niculae, and André FT Martins. Adaptively sparse transformers. In EMNLP-IJCNLP, pages 2174-2184, 2019.
  9. [Ding et al., 2023] Jiayu Ding, Shuming Ma, Li Dong, Xingx- ing Zhang, Shaohan Huang, Wenhui Wang, and Furu Wei. Longnet: Scaling transformers to 1,000,000,000 tokens. arXiv:2307.02486, 2023.
  10. [Ge et al., 2023] Tao Ge, Jing Hu, Xun Wang, Si-Qing Chen, and Furu Wei. In-context autoencoder for context com- pression in a large language model. arXiv preprint arXiv:2307.06945, 2023.
  11. [Gray et al., 2017] Scott Gray, Alec Radford, and Diederik P Kingma. Gpu kernels for block-sparse weights. arXiv preprint arXiv:1711.09224, 3:2, 2017.
  12. [Gu and Dao, 2023] Albert Gu and Tri Dao. Mamba: Linear- time sequence modeling with selective state spaces. arXiv preprint arXiv:2312.00752, 2023.
  13. [Gupta et al., 2021] Ankit Gupta, Guy Dar, Shaya Goodman, David Ciprut, and Jonathan Berant. Memory-efficient trans- formers via top-k attention. In SustaiNLP@EMNLP, 2021.
  14. [Han et al., 2023] Insu Han, Rajesh Jayaram, Amin Karbasi, Vahab Mirrokni, David P Woodruff, and Amir Zandieh. Hyperattention: Long-context attention in near-linear time. arXiv preprint arXiv:2310.05869, 2023.
  15. [Jiang et al., 2023a] Albert Q Jiang, Alexandre Sablayrolles, Arthur Mensch, Chris Bamford, et al. Mistral 7b. arXiv preprint arXiv:2310.06825, 2023.
  16. [Jiang et al., 2023b] Huiqiang Jiang, Qianhui Wu, Chin-Yew Lin, Yuqing Yang, and Lili Qiu. Llmlingua: Compressing prompts for accelerated inference of large language models. arXiv preprint arXiv:2310.05736, 2023.
  17. [Jiang et al., 2023c] Huiqiang Jiang, Qianhui Wu, Xufang Luo, Dongsheng Li, Chin-Yew Lin, Yuqing Yang, and Lili Qiu. Longllmlingua: Accelerating and enhancing llms in long context scenarios via prompt compression. arXiv preprint arXiv:2310.06839, 2023.
  18. [Katharopoulos et al., 2020] Angelos Katharopoulos, Apoorv Vyas, Nikolaos Pappas, and François Fleuret. Transformers are rnns: Fast autoregressive transformers with linear attention. In ICML, 2020.
  19. [Kitaev et al., 2019] Nikita Kitaev, Lukasz Kaiser, and Anselm Levskaya. Reformer: The efficient transformer. In ICLR, 2019.
  20. [Li et al., 2023a] Longhai Li, Lei Duan, Junchen Wang, Chengxin He, Zihao Chen, Guicai Xie, Song Deng, and Zhaohang Luo. Memory-enhanced transformer for repre- sentation learning on temporal heterogeneous graphs. Data Sci. Eng., 8(2):98-111, 2023.
  21. [Li et al., 2023b] Yucheng Li, Bo Dong, Frank Guerin, and Chenghua Lin. Compressing context to enhance inference efficiency of large language models. In EMNLP, 2023.
  22. [Lingle, 2023] Lucas D Lingle. Transformer-vq: Linear- time transformers via vector quantization. arXiv preprint arXiv:2309.16354, 2023.
  23. [Liu et al., 2023a] Yuhan Liu, Hanchen Li, Kuntai Du, Ji- ayi Yao, Yihua Cheng, Yuyang Huang, Shan Lu, Michael Maire, Henry Hoffmann, Ari Holtzman, Ganesh Anantha- narayanan, and Junchen Jiang. Cachegen: Fast context loading for language model applications. arXiv preprint arXiv:2310.07240, 2023.
  24. [Liu et al., 2023b] Zichang Liu, Aditya Desai, Fangshuo Liao, Weitao Wang, Victor Xie, Zhaozhuo Xu, Anasta- sios Kyrillidis, and Anshumali Shrivastava. Scissorhands: Exploiting the persistence of importance hypothesis for llm kv cache compression at test time. In NeurIPS, 2023.
  25. [Liu et al., 2023c] Zichang Liu, Jue Wang, Tri Dao, Tianyi Zhou, Binhang Yuan, Zhao Song, Anshumali Shrivastava, Ce Zhang, Yuandong Tian, Christopher Ré, and Beidi Chen. Deja vu: Contextual sparsity for efficient llms at inference time. In ICML, pages 22137-22176. PMLR, 2023.
  26. [Miao et al., 2023a] Xupeng Miao, Xiaonan Nie, Hailin Zhang, Tong Zhao, and Bin Cui. Hetu: A highly effi- cient automatic parallel distributed deep learning system. Sci. China Inf. Sci., 66(1):117101, 2023.
  27. [Miao et al., 2023b] Xupeng Miao, Gabriele Oliaro, Zhihao Zhang, Xinhao Cheng, Hongyi Jin, Tianqi Chen, and Zhi- hao Jia. Towards efficient generative large language model serving: A survey from algorithms to systems. arXiv preprint arXiv:2312.15234, 2023.
  28. [Mohtashami and Jaggi, 2023] Amirkeivan Mohtashami and Martin Jaggi. Landmark attention: Random-access in- finite context length for transformers. arXiv preprint arXiv:2305.16300, 2023.
  29. [Mu et al., 2023] Jesse Mu, Xiang Lisa Li, and Noah Good- man. Learning to compress prompts with gist tokens. arXiv preprint arXiv:2304.08467, 2023.
  30. [mya, 2023] Technical Report. https://github.com/Hsword/ X-former-Elucidator/blob/main/Report.pdf, 2023. Link
  31. [Pagliardini et al., 2023] Matteo Pagliardini, Daniele Paliotta, Martin Jaggi, and François Fleuret. Faster causal atten- tion over large sequences through sparse flash attention. arXiv:2306.01160, 2023.
  32. [Peng et al., 2021] Hao Peng, Nikolaos Pappas, Dani Yo- gatama, Roy Schwartz, Noah A. Smith, and Lingpeng Kong. Random feature attention. In ICLR, 2021.
  33. [Peng et al., 2023] Bo Peng, Eric Alcaide, Quentin Anthony, Alon Albalak, Samuel Arcadinho, et al. Rwkv: Reinventing rnns for the transformer era. In EMNLP (Findings), 2023.
  34. [Qin et al., 2022] Zhen Qin, XiaoDong Han, Weixuan Sun, Dongxu Li, Lingpeng Kong, Nick Barnes, and Yiran Zhong. The devil in linear transformer. In EMNLP, 2022.
  35. [Roy et al., 2021] Aurko Roy, Mohammad Saffar, Ashish Vaswani, and David Grangier. Efficient content-based sparse attention with routing transformers. In TACL, 2021.
  36. [Shao et al., 2024] Yunfan Shao, Zhichao Geng, Yitao Liu, Junqi Dai, Hang Yan, Fei Yang, Li Zhe, Hujun Bao, and Xipeng Qiu. Cpt: A pre-trained unbalanced transformer for both chinese language understanding and generation. Sci. China Inf. Sci., 67(5):1-13, 2024.
  37. [Su et al., 2024] Jianlin Su, Yu Lu, Shengfeng Pan, Ahmed Murtadha, Bo Wen, and Yunfeng Liu. Roformer: Enhanced transformer with rotary position embedding. Neurocomput- ing, 2024.
  38. [Tay et al., 2020] Yi Tay, Mostafa Dehghani, Dara Bahri, and Donald Metzler. Efficient transformers: A survey. ACM Computing Surveys (CSUR), 2020.
  39. [Tay et al., 2021a] Yi Tay, Dara Bahri, Donald Metzler, Da- Cheng Juan, Zhe Zhao, and Che Zheng. Synthesizer: Re- thinking self-attention for transformer models. In ICML, pages 10183-10192. PMLR, 2021.
  40. [Tay et al., 2021b] Yi Tay, Mostafa Dehghani, Samira Abnar, Yikang Shen, Dara Bahri, Philip Pham, Jinfeng Rao, Liu Yang, Sebastian Ruder, and Donald Metzler. Long range arena : A benchmark for efficient transformers. In ICLR, 2021.
  41. [Tsai et al., 2019] Yao-Hung Hubert Tsai, Shaojie Bai, Makoto Yamada, Louis-Philippe Morency, and Ruslan Salakhutdinov. Transformer dissection: An unified under- standing for transformer's attention via the lens of kernel. In EMNLP-IJCNLP, pages 4344-4353, 2019.
  42. [Vaswani et al., 2017] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In NeurIPS 2017, pages 5998-6008, 2017.
  43. [Vyas et al., 2020] Apoorv Vyas, Angelos Katharopoulos, and François Fleuret. Fast transformers with clustered attention. In NeurIPS, 2020.
  44. [Wang and Zhang, 2013] Shusen Wang and Zhihua Zhang. Improving cur matrix decomposition and the nyström ap- proximation via adaptive sampling. JMLR, 2013.
  45. [Wang et al., 2020] Sinong Wang, Belinda Z Li, Madian Khabsa, Han Fang, and Hao Ma. Linformer: Self-attention with linear complexity. arXiv preprint arXiv:2006.04768, 2020.
  46. [Xiao et al., 2024] Guangxuan Xiao, Yuandong Tian, Beidi Chen, Song Han, and Mike Lewis. Efficient streaming language models with attention sinks. In ICLR, 2024.
  47. [Xiong et al., 2021] Yunyang Xiong, Zhanpeng Zeng, Rudra- sis Chakraborty, Mingxing Tan, Glenn Fung, Yin Li, and Vikas Singh. Nyströmformer: A nyström-based algorithm for approximating self-attention. In AAAI, 2021.
  48. [Xu et al., 2023] Peng Xu, Wei Ping, Xianchao Wu, Lawrence McAfee, Chen Zhu, Zihan Liu, Sandeep Sub- ramanian, Evelina Bakhturina, Mohammad Shoeybi, and Bryan Catanzaro. Retrieval meets long context large lan- guage models. arXiv preprint arXiv:2310.03025, 2023.
  49. [Ye et al., 2023] Zihao Ye, Ruihang Lai, Junru Shao, Tianqi Chen, and Luis Ceze. Sparsetir: Composable abstractions for sparse compilation in deep learning. In ASPLOS, 2023.
  50. [Zaheer et al., 2020] Manzil Zaheer, Guru Guruganesh, Ku- mar Avinava Dubey, Joshua Ainslie, Chris Alberti, Santi- ago Ontañón, Philip Pham, Anirudh Ravula, Qifan Wang, Li Yang, and Amr Ahmed. Big bird: Transformers for longer sequences. NeurIPS, 33:17283-17297, 2020.
  51. [Zhang et al., 2023a] Qingru Zhang, Dhananjay Ram, Cole Hawkins, Sheng Zha, and Tuo Zhao. Efficient long-range transformers: You need to attend more, but not necessarily at every layer. In EMNLP, 2023.
  52. [Zhang et al., 2023b] Zhenyu Zhang, Ying Sheng, Tianyi Zhou, Tianlong Chen, Lianmin Zheng, Ruisi Cai, Zhao Song, Yuandong Tian, Christopher Ré, Clark W. Barrett, Zhangyang Wang, and Beidi Chen. H _2 o: Heavy-hitter oracle for efficient generative inference of large language models. In NeurIPS, 2023.
  53. [Zhen et al., 2022] Q Zhen, W Sun, H Deng, D Li, Y Wei, B Lv, J Yan, L Kong, and Y Zhong. cosformer: Rethinking softmax in attention. In ICLR, 2022.
  54. [Zheng et al., 2023] Lin Zheng, Jianbo Yuan, Chong Wang, and Lingpeng Kong. Efficient attention via control variates. arXiv preprint arXiv:2302.04542, 2023.
  55. [Zhong et al., 2022] Haiting Zhong, Wei He, Lizhen Cui, Lei Liu, Zhongmin Yan, and Kun Zhao. Joint atten- tion networks with inherent and contextual preference- awareness for successive poi recommendation. Data Sci. Eng., 7(4):370-382, 2022.
  56. [Zhou et al., 2021] Haoyi Zhou, Shanghang Zhang, Jieqi Peng, Shuai Zhang, Jianxin Li, Hui Xiong, and Wancai Zhang. Informer: Beyond efficient transformer for long sequence time-series forecasting. In AAAI, 2021.

References were extracted automatically from the PDF and may contain errors.

Welcome Future Conferences AI Journal Division IJCAI Proceedings About IJCAI IJCAI Awards