Agent Attention: On the Integration of Softmax and Linear Attention

AI-generated keywords: Attention Module

AI-generated Key Points

The license of the paper does not allow us to build upon its content and the key points are generated using the paper metadata rather than the full article.

  • Agent Attention is a new attention paradigm in Transformers that balances computational efficiency and representation power.
  • It introduces agent tokens that act as agents for query tokens, aggregating information from key and value tokens and broadcasting it back to the query tokens.
  • By designing the number of agent tokens to be smaller than the number of query tokens, Agent Attention achieves higher efficiency compared to Softmax attention while still preserving global context modeling capability.
  • Agent Attention is equivalent to a generalized form of linear attention, seamlessly integrating both Softmax attention and highly efficient linear attention.
  • Extensive experiments validate the effectiveness of Agent Attention in various vision tasks such as image classification, object detection, semantic segmentation, and image generation.
  • In high-resolution scenarios, Agent Attention outperforms other methods due to its linear attention nature.
  • When applied to Stable Diffusion for image generation without additional training, Agent Attention accelerates generation and substantially improves image quality.
  • The code for implementing Agent Attention is available on GitHub.
Also access our AI generated: Comprehensive summary, Lay summary, Blog-like article; or ask questions about this paper to our AI assistant.

Authors: Dongchen Han, Tianzhu Ye, Yizeng Han, Zhuofan Xia, Shiji Song, Gao Huang

Abstract: The attention module is the key component in Transformers. While the global attention mechanism offers high expressiveness, its excessive computational cost restricts its applicability in various scenarios. In this paper, we propose a novel attention paradigm, Agent Attention, to strike a favorable balance between computational efficiency and representation power. Specifically, the Agent Attention, denoted as a quadruple $(Q, A, K, V)$, introduces an additional set of agent tokens $A$ into the conventional attention module. The agent tokens first act as the agent for the query tokens $Q$ to aggregate information from $K$ and $V$, and then broadcast the information back to $Q$. Given the number of agent tokens can be designed to be much smaller than the number of query tokens, the agent attention is significantly more efficient than the widely adopted Softmax attention, while preserving global context modelling capability. Interestingly, we show that the proposed agent attention is equivalent to a generalized form of linear attention. Therefore, agent attention seamlessly integrates the powerful Softmax attention and the highly efficient linear attention. Extensive experiments demonstrate the effectiveness of agent attention with various vision Transformers and across diverse vision tasks, including image classification, object detection, semantic segmentation and image generation. Notably, agent attention has shown remarkable performance in high-resolution scenarios, owning to its linear attention nature. For instance, when applied to Stable Diffusion, our agent attention accelerates generation and substantially enhances image generation quality without any additional training. Code is available at https://github.com/LeapLabTHU/Agent-Attention.

Submitted to arXiv on 14 Dec. 2023

Ask questions about this paper to our AI assistant

You can also chat with multiple papers at once here.

The license of the paper does not allow us to build upon its content and the AI assistant only knows about the paper metadata rather than the full article.

AI assistant instructions?

Results of the summarizing process for the arXiv paper: 2312.08874v2

This paper's license doesn't allow us to build upon its content and the summarizing process is here made with the paper's metadata rather than the article.

, , , , The attention module is a crucial component in Transformers, but its high computational cost limits its practicality in many scenarios. To address this issue, the authors propose a new attention paradigm called Agent Attention. This approach strikes a balance between computational efficiency and representation power by introducing agent tokens into the conventional attention module. These tokens act as agents for the query tokens, aggregating information from key and value tokens and broadcasting it back to the query tokens. By designing the number of agent tokens to be smaller than the number of query tokens, Agent Attention achieves higher efficiency compared to Softmax attention while still preserving global context modeling capability. Interestingly, the authors demonstrate that Agent Attention is equivalent to a generalized form of linear attention, seamlessly integrating both Softmax attention and highly efficient linear attention. Extensive experiments with various vision Transformers and tasks such as image classification, object detection, semantic segmentation, and image generation validate the effectiveness of Agent Attention. Notably, in high-resolution scenarios, Agent Attention outperforms other methods due to its linear attention nature. Furthermore, when applied to Stable Diffusion for image generation without additional training, Agent Attention accelerates generation and substantially improves image quality. The code for implementing Agent Attention is available on GitHub. In summary,<br> this paper introduces Agent Attention as a novel attention paradigm that balances computational efficiency and representation power in Transformers.<br> Its integration of Softmax and linear attention enables efficient global context modeling across diverse vision tasks with remarkable performance in high-resolution scenarios.
Created on 05 Feb. 2024

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.

The license of this specific paper does not allow us to build upon its content and the summarizing tools will be run using the paper metadata rather than the full article. However, it still does a good job, and you can also try our tools on papers with more open licenses.

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.