Efficient Streaming Language Models with Attention Sinks
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
Authors: Guangxuan Xiao, Yuandong Tian, Beidi Chen, Song Han, Mike Lewis
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.
Ask questions about this paper to our AI assistant
You can also chat with multiple papers at once here.
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.
The previous summary was created more than a year ago and can be re-run (if necessary) by clicking on the Run button below.
Similar papers summarized with our AI tools
Navigate through even more similar papers through a
tree representationLook 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.