What Matters in Transformers? Not All Attention is Needed
Authors: Shwai He, Guoheng Sun, Zheyu Shen, Ang Li
AI-generated Key Points
- Study conducted by Shwai He, Guoheng Sun, Zhenyu Shen, and Ang Li from the University of Maryland, College Park
- Focus on Transformer-based large language models (LLMs) and scalability
- Aim to explore redundancy variability in Transformers and propose methods for enhancing model efficiency
- Use similarity-based metric to identify redundant structures based on output similarity to inputs
- Surprising findings regarding excessive similarity of attention layers in LLMs
- Insights provide guidance for future network architecture design for creating more compact yet efficient models
- Code available at https://github.com/Shwai-He/LLM-Drop for further exploration and implementation
Abstract: Scaling Transformer-based large language models (LLMs) has demonstrated promising performance across various tasks. However, this scaling also introduces redundant structures, posing challenges for real-world deployment. Despite some recognition of redundancy in LLMs, the variability of redundancy across different structures, such as MLP and Attention layers, is under-explored. In this work, we investigate the varying redundancy across different modules within Transformers, including Blocks, MLP, and Attention layers, using a similarity-based metric. This metric operates on the premise that redundant structures produce outputs highly similar to their inputs. Surprisingly, while attention layers are essential for transformers and distinguish them from other mainstream architectures, we found that a large proportion of attention layers exhibit excessively high similarity and can be safely pruned without degrading performance, leading to reduced memory and computation costs. Additionally, we further propose a method that jointly drops Attention and MLP layers, achieving improved performance and dropping ratios. Extensive experiments demonstrate the effectiveness of our methods, e.g., Llama-3-70B maintains comparable performance even after pruning half of the attention layers. Our findings provide valuable insights for future network architecture design. The code will be released at: \url{https://github.com/Shwai-He/LLM-Drop}.
Tools for this paper
Ask questions about this paper to our AI assistant
You can also chat with multiple papers at once here.
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)
We compare the title and abstract with papers indexed in our database. For arXiv papers, we search within the same category; for DOI and other sources, we search across sources and subjects. You can rerun the search as 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.