Efficient Streaming Language Models with Attention Sinks

AI-generated keywords: StreamingLLM

AI-generated Key Points

  • Challenges of deploying Large Language Models (LLMs) in streaming applications:
  • Extensive memory consumption during decoding stage
  • Inability of popular LLMs to generalize to longer texts than training sequence length
  • Introduction of StreamingLLM framework:
  • Analyzes "attention sink" phenomenon
  • Enables LLMs trained with finite length attention window to generalize to infinite sequence lengths without fine-tuning
  • Benefits and capabilities of StreamingLLM:
  • Enables stable and efficient language modeling with up to 4 million tokens or more
  • Placeholder token as dedicated attention sink improves streaming deployment
  • Performance improvement compared to sliding window recomputation baseline: up to 22.2x speedup in streaming settings
  • Discussion of related work in three main areas: Length Extrapolation, Context Window Extension, and Improving LLMs' Utilization of Long Text
  • Existing methodologies do not achieve infinite length extrapolation necessary for streaming applications
  • Efficient framework for deploying LLMs in streaming applications by addressing memory consumption and generalization challenges
Also access our AI generated: Comprehensive summary, Lay summary, Blog-like article; or ask questions about this paper to our AI assistant.

Authors: Guangxuan Xiao, Yuandong Tian, Beidi Chen, Song Han, Mike Lewis

License: CC BY 4.0

Abstract: Deploying Large Language Models (LLMs) in streaming applications such as multi-round dialogue, where long interactions are expected, is urgently needed but poses two major challenges. Firstly, during the decoding stage, caching previous tokens' Key and Value states (KV) consumes extensive memory. Secondly, popular LLMs cannot generalize to longer texts than the training sequence length. Window attention, where only the most recent KVs are cached, is a natural approach -- but we show that it fails when the text length surpasses the cache size. We observe an interesting phenomenon, namely attention sink, that keeping the KV of initial tokens will largely recover the performance of window attention. In this paper, we first demonstrate that the emergence of attention sink is due to the strong attention scores towards initial tokens as a ``sink'' even if they are not semantically important. Based on the above analysis, we introduce StreamingLLM, an efficient framework that enables LLMs trained with a finite length attention window to generalize to infinite sequence lengths without any fine-tuning. We show that StreamingLLM can enable Llama-2, MPT, Falcon, and Pythia to perform stable and efficient language modeling with up to 4 million tokens and more. In addition, we discover that adding a placeholder token as a dedicated attention sink during pre-training can further improve streaming deployment. In streaming settings, StreamingLLM outperforms the sliding window recomputation baseline by up to 22.2x speedup. Code and datasets are provided at https://github.com/mit-han-lab/streaming-llm.

Submitted to arXiv on 29 Sep. 2023

Ask questions about this paper to our AI assistant

You can also chat with multiple papers at once here.

AI assistant instructions?

Results of the summarizing process for the arXiv paper: 2309.17453v1

The paper discusses the challenges of deploying Large Language Models (LLMs) in streaming applications, particularly in multi-round dialogue where long interactions are expected. The two major challenges identified are the extensive memory consumption during the decoding stage when caching previous tokens' Key and Value states (KV), and the inability of popular LLMs to generalize to longer texts than the training sequence length. To address these challenges, the authors propose a framework called StreamingLLM. They first analyze the phenomenon of "attention sink," which refers to strong attention scores towards initial tokens as a "sink" even if they are not semantically important. Based on this analysis, they introduce StreamingLLM, which enables LLMs trained with a finite length attention window to generalize to infinite sequence lengths without any fine-tuning. The authors demonstrate that StreamingLLM can enable LLMs such as Llama-2, MPT, Falcon, and Pythia to perform stable and efficient language modeling with up to 4 million tokens or more. They also discover that adding a placeholder token as a dedicated attention sink during pre-training further improves streaming deployment. In terms of performance, StreamingLLM outperforms the sliding window recomputation baseline by up to 22.2x speedup in streaming settings. The authors provide code and datasets for their framework. The paper also discusses related work in three main areas: Length Extrapolation, Context Window Extension, and Improving LLMs' Utilization of Long Text. While progress has been made in these areas, none of the existing methodologies achieve infinite length extrapolation necessary for streaming applications. Overall, this paper presents an efficient framework for deploying LLMs in streaming applications by addressing memory consumption and generalization challenges. The proposed StreamingLLM framework demonstrates improved performance compared to existing baselines and provides insights into attention sink phenomena in language models.
Created on 13 Nov. 2023

Assess the quality of the AI-generated content by voting

Score: 0

Why do we need votes?

Votes are used to determine whether we need to re-run our summarizing tools. If the count reaches -10, our tools can be restarted.

Similar papers summarized with our AI tools

Navigate through even more similar papers through a

tree representation

Look for similar papers (in beta version)

By clicking on the button above, our algorithm will scan all papers in our database to find the closest based on the contents of the full papers and not just on metadata. Please note that it only works for papers that we have generated summaries for and you can rerun it from time to time to get a more accurate result while our database grows.

Disclaimer: The AI-based summarization tool and virtual assistant provided on this website may not always provide accurate and complete summaries or responses. We encourage you to carefully review and evaluate the generated content to ensure its quality and relevance to your needs.