Lune

ICLR2024顶会

IceFormer: Accelerated Inference with Long-Sequence Transformers on CPUs

Yuzhen Mao, Martin Ester, Ke Li

摘要

One limitation of existing Transformer-based models is that they cannot handle very long sequences as input since their self-attention operations exhibit quadratic time and space complexity. This problem becomes especially acute when Transformers are deployed on hardware platforms equipped only with CPUs. To address this issue, we propose a novel method for accelerating self-attention at inference time that works with pretrained Transformer models out-of-the-box without requiring retraining. We experiment using our method to accelerate various long-sequence Transformers, including a leading LLaMA 2-based LLM, on various benchmarks and demonstrate a speedup of 2.73 × -7.63× while retaining 98.6% -99.6% of the accuracy of the original pretrained models. The code is available on our project website at https://yuzhenmao.github.io/IceFormer/ . INTRODUCTION Transformers (Vaswani et al., 2017) have powered incredible advances in NLP, as exemplified by large language models (LLMs) such as GPT-4 and LLaMA 2. Increasingly LLMs are applied to exceptionally long input sequences, which enables many exciting applications such as long-form content creation, extended conversations, and large document search and analysis (OpenAI, 2023; Anthropic, 2023). While LLMs can be feasibly trained with expensive hardware accelerators (e.g. GPUs), they need to be deployed on commodity devices, which may only be equipped with CPUs. However, it is currently challenging to deploy LLMs on CPUs due to their high computation cost (Dice & Kogan, 2021) . A significant computational bottleneck arises from the self-attention mechanism that is integral to Transformers -both time and space complexity are quadratic in the sequence length. This problem is exacerbated in the context of LLMs, which are often used on very long sequences. To handle long input sequences, there has been substantial research into reducing the quadratic time complexity of self-attention -these methods are collectively known as efficient Transformers. However, many do not meet the needs of LLMs and are therefore difficult to apply to LLMs. An ideal acceleration method for LLMs should satisfy four criteria: (1) No retraining -the method should not require the model to be retrained, given the enormous computational expense of training LLMs; (2) Generality -the method should be applicable to a variety of LLMs, rather than just those trained with particular constraints built-in; (3) High accuracy -the method should not introduce large approximation errors, since LLMs have many attention layers and so errors from earlier layers can compound; (4) Fast inference -the method should achieve fast test-time performance. Satisfying all these criteria simultaneously is difficult, and to our knowledge no existing methods can do so. For example, Transformers with fixed attention patterns, e.g., Longformer (Beltagy et al., 2020) , require retraining the model before they can be used. Reformer (Nikita et al., 2020) requires keys to be normalized -this requirement is not met in most pretrained models. Nyströmformer (Xiong et al., 2021) and LARA (Zheng et al., 2022) do not support causal masks, which are commonly found in LLMs. Low-rank methods such as Performer (Choromanski et al., 2020) introduce substantial approximation errors, especially when they are not retrained/finetuned.

问 Lune

几分钟读透这篇 Paper,不用再花一下午。

Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。

已有 7 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。

可以从这些问题问起

Lune 可以查阅

全文 · 引用它的顶会 Paper · 相关的 Paper

获取答案

免费开始,无需绑卡

脉络

  • SparQ Attention: Bandwidth-Efficient LLM Inference 引用了 Reformer: The Efficient Transformer
  • Long Range Arena : A Benchmark for Efficient Transformers 引用了 Reformer: The Efficient Transformer
  • FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness 引用了 Long Range Arena : A Benchmark for Efficient Transformers
  • FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness 引用了 Reformer: The Efficient Transformer
  • ArkVale: Efficient Generative LLM Inference with Recallable Key-Value Eviction 引用了 SparQ Attention: Bandwidth-Efficient LLM Inference
  • ArkVale: Efficient Generative LLM Inference with Recallable Key-Value Eviction 引用了 FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness
  • ArkVale: Efficient Generative LLM Inference with Recallable Key-Value Eviction 引用了 H2O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language Models
  • ArkVale: Efficient Generative LLM Inference with Recallable Key-Value Eviction 引用了 Reformer: The Efficient Transformer
  • H2O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language Models 引用了 FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness
  • H2O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language Models 引用了 Reformer: The Efficient Transformer
  • Nyströmformer: A Nyström-based Algorithm for Approximating Self-Attention 引用了 Long Range Arena : A Benchmark for Efficient Transformers
  • Nyströmformer: A Nyström-based Algorithm for Approximating Self-Attention 引用了 Reformer: The Efficient Transformer
  • RetrievalAttention: Accelerating Long-Context LLM Inference via Vector Retrieval 引用了 SparQ Attention: Bandwidth-Efficient LLM Inference
  • RetrievalAttention: Accelerating Long-Context LLM Inference via Vector Retrieval 引用了 FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness
  • RetrievalAttention: Accelerating Long-Context LLM Inference via Vector Retrieval 引用了 H2O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language Models
  • RetrievalAttention: Accelerating Long-Context LLM Inference via Vector Retrieval 引用了 Reformer: The Efficient Transformer
  • RetrievalAttention: Accelerating Long-Context LLM Inference via Vector Retrieval 引用了 MInference 1.0: Accelerating Pre-filling for Long-Context LLMs via Dynamic Sparse Attention
  • MInference 1.0: Accelerating Pre-filling for Long-Context LLMs via Dynamic Sparse Attention 引用了 RetrievalAttention: Accelerating Long-Context LLM Inference via Vector Retrieval
  • IceCache: Memory-Efficient KV-cache Management for Long-Sequence LLMs 引用了 ArkVale: Efficient Generative LLM Inference with Recallable Key-Value Eviction
  • IceCache: Memory-Efficient KV-cache Management for Long-Sequence LLMs 引用了 H2O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language Models
  • IceCache: Memory-Efficient KV-cache Management for Long-Sequence LLMs 引用了 Reformer: The Efficient Transformer
  • MInference 1.0: Accelerating Pre-filling for Long-Context LLMs via Dynamic Sparse Attention 引用了 SparQ Attention: Bandwidth-Efficient LLM Inference
  • MInference 1.0: Accelerating Pre-filling for Long-Context LLMs via Dynamic Sparse Attention 引用了 Reformer: The Efficient Transformer
它引用的引用它的从左到右按年份排列,引用越多,位置越高。

引用它的顶会 Paper7

  1. MInference 1.0: Accelerating Pre-filling for Long-Context LLMs via Dynamic Sparse AttentionHuiqiang Jiang, Yucheng Li, Chengruidong Zhang, Qianhui Wu 等NeurIPS 2024 · 479 次引用
  2. RetrievalAttention: Accelerating Long-Context LLM Inference via Vector RetrievalDi Liu, Meng Chen, Baotong Lu, Huiqiang Jiang 等NeurIPS 2025 · 148 次引用
  3. SparQ Attention: Bandwidth-Efficient LLM InferenceLuka Ribar, Ivan Chelombiev, Luke Hudlass-Galley, Charlie Blake 等ICML 2024 · 108 次引用
  4. ArkVale: Efficient Generative LLM Inference with Recallable Key-Value EvictionRenze Chen, Zhuofeng Wang, Beiquan Cao, Tong Wu 等NeurIPS 2024 · 56 次引用
  5. IceCache: Memory-Efficient KV-cache Management for Long-Sequence LLMsYuzhen Mao, Qitong Wang, Martin Ester, Ke LiICLR 2026 · 6 次引用

它引用的 Paper11

  1. FlashAttention: Fast and Memory-Efficient Exact Attention with IO-AwarenessTri Dao, Daniel Y. Fu, Stefano Ermon, Atri Rudra 等NeurIPS 2022 · 5,493 次引用
  2. Reformer: The Efficient TransformerNikita Kitaev, Lukasz Kaiser, Anselm LevskayaICLR 2020 · 2,878 次引用
  3. H2O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language ModelsZhenyu Zhang, Ying Sheng, Tianyi Zhou, Tianlong Chen 等NeurIPS 2023 · 1,003 次引用
  4. Long Range Arena : A Benchmark for Efficient TransformersYi Tay, Mostafa Dehghani, Samira Abnar, Yikang Shen 等ICLR 2021 · 881 次引用
  5. Nyströmformer: A Nyström-based Algorithm for Approximating Self-AttentionYunyang Xiong, Zhanpeng Zeng, Rudrasis Chakraborty, Mingxing Tan 等AAAI 2021 · 675 次引用

相关 Paper

  1. Fourier Transformer: Fast Long Range Modeling by Removing Sequence Redundancy with FFT OperatorZiwei He, Meng Yang, Minwei Feng, Jingcheng Yin 等ACL Findings 2023 · 13 次引用
  2. In-Context Former: Lightning-fast Compressing Context for Large Language ModelXiangfeng Wang, Zaiyi Chen, Tong Xu, Zheyong Xie 等EMNLP Findings 2024 · 6 次引用
  3. SageAttention: Accurate 8-Bit Attention for Plug-and-play Inference AccelerationJintao Zhang, Jia Wei, Pengle Zhang, Jun Zhu 等ICLR 2025
  4. Gated Linear Attention Transformers with Hardware-Efficient TrainingSonglin Yang, Bailin Wang, Yikang Shen, Rameswar Panda 等ICML 2024 · 390 次引用
  5. SALE : Low-bit Estimation for Efficient Sparse Attention in Long-context LLM PrefillingXiaodong Ji, Hailin Zhang, Fangcheng Fu, Bin CuiICML 2026 · 3 次引用
黄昏的海面,两侧是细线勾勒的悬崖