MetaLA: Unified Optimal Linear Approximation to Softmax Attention Map

Various linear complexity models, such as Linear Transformer (LinFormer), State Space Model (SSM), and Linear RNN (LinRNN), have been proposed to replace the conventional softmax attention in Transformer structures. However, the optimal design of these linear models is still an open question. In this work, we attempt to answer this question by finding the best linear approximation to softmax attention from a theoretical perspective. We start by unifying existing linear complexity models as the linear attention form and then identify three conditions for the optimal linear attention design: 1) Dynamic memory ability; 2) Static approximation ability; 3) Least parameter approximation. We find that none of the current linear models meet all three conditions, resulting in suboptimal performance. Instead, we propose Meta Linear Attention (MetaLA) as a solution that satisfies these conditions. Our experiments on Multi-Query Associative Recall (MQAR) task, language modeling, image classification, and Long-Range Arena (LRA) benchmark demonstrate that MetaLA is more effective than the existing linear models.

Paper

References (90)

Scroll for more · 38 remaining

Similar papers

Peer review

Reviewer LW2x6/10 · confidence 4/52024-06-28

Summary

Proposes a unifying view of recent linear attention/SSM/linear RNN methods and compares these models to Softmax Attention. Proposes MetaLA to address the shortcomings of the prior methods in approximating Softmax attention. Performs experiments on MQAR, language modeling, image classification and LRA.

Strengths

- Addresses an important and relevant topic of analyzing efficient sequence models that attempt to replace Softmax Attention - Systematically comparing and unifying the formulations of the various linear attentions and linear RNNs/SSMs is useful - The tables classifying similarities and differences of the models are nice - The theoretical results in the appendix appear to be sound - The experiments performed suggest promising results

Weaknesses

- The general presentation of the "optimal linear approximation" and theoretical analysis is dense and confusing and obscures the contributions. - I would recommend moving the Proposition statements to the main text (the proofs can remain in the appendix). E.g. Currently I get to line 218 and am told that the key value is being dropped based on theoretical analysis performed in Appendix A2, but I would rather already have an idea of this result before getting to this point. Similarly, the "self-augmentation" change seems to come out of nowhere. - Once you have moved these Proposition statements to the Section 4, I would recommend rewriting/reorganizing Section 4 framed around these proposition statements - The MQAR analysis is weak. I would like to see more difficult versions of this task (larger vocab sizes, more retrievals, longer contexts) and an attention baseline to better understand the limitations and differences between the different methods. - I think more downstream tasks should be included that require the recall/retrieval abilities that are known to affect all these fixed state size methods (e.g. https://arxiv.org/abs/2402.01032, https://arxiv.org/abs/2402.04248, https://arxiv.org/abs/2402.18510v3 to name a few, more generally these and other works should be cited) would make the proposed approach and value of the proposed framework more convincing. This would help the reader understand how much progress as actually been made toward approximating Softmax attention with more efficient methods. Even simple needle in the haystack, passkey retrieval, or phonebook retrieval (as in the Griffin paper) would help give a better sense of this. - In the conclusion and discussion, some potential weaknesses and questions regarding the differences between Softmax attention and other methods are mentioned and proposed as future work (model capabilities, insufficient training, or eval issues). However, I would suggest some of these questions should be better explored in this work since that would help provide a better sense of how useful the proposed framework and method is.

Questions

My main questions and issues are listed above. - Line 287: typo, "Value" is misspelled in the text

Rating

6

Confidence

4

Soundness

2

Presentation

1

Contribution

2

Limitations

Sufficient

Authorsrebuttal2024-08-12

Thank you very much for your thoughtful feedback and for raising your score. We sincerely appreciate your valuable insights, and we will make sure to thoroughly discuss the gap with global attention in recall-intensive tasks as you suggested. Additionally, we will include a softmax attention baseline for the MAD tasks in the final version to enhance the comparison. Your comments have been instrumental in improving our work, and we are grateful for your time and consideration.

Reviewer XAnv8/10 · confidence 4/52024-06-28

Summary

The paper presents a theoretical analysis of existing linear attention methods such as LinFormer, SSM, and LinRNN. Building on this analysis, the authors propose a unified framework that combines the strengths of these methods. Utilizing this framework, authors develop a novel linear attention model called MetaLA. The key innovations of MetaLA include the elimination of the Key matrix, the introduction of dynamic decay for achieving dynamic memory and static approximation, and the integration of self-augmentation with short convolution. These enhancements aim to improve the approximation accuracy of softmax attention and outperform existing linear attention methods.

Strengths

- The paper presents a comprehensive unification of various linear attention models (LinFormer, SSM, LinRNN), offering a deeper understanding of their underlying mechanisms and differences. - The proposed MetaLA model is theoretically grounded based on the proposed framework. - The authors provide empirical evaluation of the MetaLA model on NLP tasks, demonstrating its effectiveness and robustness.

Weaknesses

- The only result for long sequences provided by the authors is on the LRA benchmark. This is not sufficient to justify the scalability of the method for real LLMs trained on sequences longer than 1k tokens since LRA is an artificial and non-representative benchmark. - Authors provide empirical results mainly for classification tasks. It is not clear how their model performs in the text generation scenario. - The authors neither mention nor present any experiments with low-precision formats like FP16 and BF16. Many linear attention methods fail when trained in these popular formats. - The authors do not provide any measurements or comparisons of computational efficiency and memory requirements of their method compared to softmax attention and other linear methods. - Since the authors do not provide code for the MetaLA model, it is hard to assess the practicality and ease of implementation.

Questions

- How does MetaLA perform on tasks with longer sequences compared to standard softmax attention and other linear attention mechanisms? For example, on NarrativeQA or other tasks from LongBench. - Can the authors provide more information on the setting of hyperparameters for their method, specifically whether the decay factor should be selected by the user? - Another linear attention work [1], which the authors did not cite, proposes evaluating the concentration ability of linear attention using entropy and spectral gap metrics. What is the authors' opinion on these concentration metrics in the context of the MetaLA framework analysis? [1] Linear Log-Normal Attention with Unbiased Concentration

Rating

8

Confidence

4

Soundness

3

Presentation

3

Contribution

3

Limitations

N/A

Reviewer XAnv2024-08-10

Thank you for the rebuttal. The authors have addressed my concerns regarding long sequences and numerical formats. Additionally, they provided further experimental results, comparing their method to the LLaMa2 and MAMBA models. Overall I think it's a good paper and following the additional information provided by the authors, I have decided to increase my score.

Authorsrebuttal2024-08-12

Thank you sincerely for your thoughtful feedback and for increasing your score. We are grateful that our responses and additional experiments have addressed your concerns. Your support and encouragement mean a lot to us, and we truly appreciate the time you’ve taken to review our work.

Reviewer 2RWL7/10 · confidence 2/52024-07-09

Summary

They proposed MetaLA, which solved problems of previous attention alternatives (LinRNN, SSM, LinFormer). They start to build their MetaLA by deriving general form of linear alternative of softmax attention. 1. They remove the K matrice redundant parameters and achieve better training efficiency 2. Add self-augmentation. This allows the input value to immediately affect the output depending on the query to prevent forgetting current token information. 3. Adding a convolutional layer at input X. This enhances the local interaction further, motivating Mamba and Griffin.

Strengths

Strong build-up toward their method from well-curated baselines. Their method shows high performance empirically.

Weaknesses

1. The experiment is not done with various scales. It is hard to know the effect of the scaling model and training dataset with MetaLA. 2. The performance of MetaLA is mainly shown with only benchmark scores, and there are no latency reports. Therefore, it is hard to know if this performance is Pareto optimal in the trade-off between latency and performance.

Questions

1. Is approximating softmax attention the optimal solution for sequential modeling? This paper aims to approximate the various characteristics of the computational and model aspects very well. However, I wonder if softmax attention is not the optimal solution for sequential modeling. Is there any justification for it? 2. Can you provide the code?

Rating

7

Confidence

2

Soundness

3

Presentation

4

Contribution

3

Limitations

It feels minor improvement on top of previous linear attention alternative studies.

Reviewer rbUC7/10 · confidence 3/52024-07-13

Summary

This paper discusses the development and evaluation of linear complexity models for Transformers, which aim to replace the conventional softmax attention mechanism. The authors first unify existing models including LinFormer, SSM, and LinRNN into the framework of Linear Attention. Then they establish three (actually four) criteria for optimal linear attention: (0) linear complexity, (1) dynamic memory capability, (2) static approximation ability, and (3) minimal parameter usage. This paper shows that the three existing models mentioned above do not meet all these conditions and therefore perform suboptimally. In response, they introduce a new model, Meta Linear Attention (MetaLA), designed to fulfill these criteria. MetaLA is tested across various tasks including the Multi-Query Associative Recall (MQAR) task, language modeling, image classification, and the Long-Range Arena (LRA) benchmark, where it outperforms existing linear models, demonstrating its effectiveness.

Strengths

1, This work unifies three widely-applied linear-complexity substituitions (LinFormer, SSM, LinRNN) of Transformer into the same framework, including a recurrent form and a parallel form, which enables higher-level studies and analysis. 2, This work proposes three criteria for evaluating a linear-complexity model (memory, approximation, parameter), which brings insights and targets for future developments of linear-complexity models. 3, Combining 1 and 2, this work evaluates whether each of the three existings models satisfies each criteria, and shows that every model does not fulfill all requirements. Based on this insight, they propose a MetaLA Transformer model that satisfies all three criteria and performs well in multiple tasks.

Weaknesses

(After rebuttal: The authors carefully addressed my main concerns.) -------------- Please correct me if there are any mistakes. 1, The main concern originates from the three criteria of "**optimality**" for linear attention (LA). In general, "optimality" indicates a situation that any possible method/result cannot be substantially better. However, it seems like these three criteria are all *necessary* conditions. As far as I noticed, this work has not stated whether these criteria are *sufficient* for optimality. As a consequence, even if MetaLA satisfies all three criteria, it is not proper to state that MetaLA is *optimal*. 2, The presentations could be improved, especially in Section 2. It is important to define or denote the dimensionality of not only each matrix/vector (which the authors have done) but also each function and operation (which they have not).

Questions

The authors are encouraged to disagree or discuss on my questions/comments. 1, On Page 2 Line 67, what is the mask matrix $M$ like? From the context, I guess $M$ is a lower triangular matrix with all valid elements $=1$? 2, On Page 3 Line 78 (top), why does the LinFormer consume $O(1)$ time and memory complexity? Also, would you please elaborate on the "Chunkwise algorithm" mensioned in Line 80? 3, On Page 5 Line 147, why this softmax-generated expressive attention map requires infinite states? 4, On Page 5 Line 177, what is the condition (or consequence) of "good enough" inputs? 5, On Appendix A 2.3 (and also A 2.4), it is claimed that (Q, $\Lambda_t$) can meet C0, C1, C2 with fewest parameters. Is this concept of "fewest" restricted in a certain domain of model selection? In other words, do you have a lower-bound proof showing that any model utilizing fewer parameters than (Q, $\Lambda_t$) will fail?

Rating

7

Confidence

3

Soundness

4

Presentation

3

Contribution

4

Limitations

Limitations are adequately discussed in the Section of Conclusion and Discussion.

Reviewer LW2x2024-08-10

- Thank you for your response. I appreciate the additional recall intensive experiments. Please ensure the gap with global attention that these experiments expose for recall intensive tasks are discussed thoroughly. This discussion of limitations and the additional experiments will strengthen the paper. - Please also include a softmax attention baseline for the MAD tasks in a final version to provide better comparison I have raised my score.

Reviewer 2RWL2024-08-11

Thank for for your thoughtfully written rebuttal. I gave the borderline accept because I could not fully understand this paper, therefore my reviewing confidence was pretty low. My concerns was all resolved (performance scalability and latency optimality) by general response so I want to raise my score to accept (however I am not still sure about the content of paper. E.g. equations and background theories). However, after reading the general response, now I can understand how this paper is novel and valuable in more depth. The response of my question about optimality of softmax attention is interesting. In my opinion, the softmax attention solves the problem of RNN and human intelligence which is limitation of memory and computation for each token. I think we should improve the softmax attention while maintaining it's non constant time and space complexity to achieve AGI that performs better than human. In this sense, I have a question about linear attention mechanisms. What if we increase memory space of linear attention mechanism as non constant (linear or log linear)? As far as I know, all linear attentions are strictly limit their space and time complexity as constant for each tokens. But I wonder that is it really pareto optimal if we scale it compare to quadratic attention. Do you think current implementation of linear attention can handle this? (Including this paper)

Authorsrebuttal2024-08-12

Thank you for your feedback, suggestions, and insightful discussion, which have had a positive impact on us. We continue to address your concerns below: This is an interesting question. The current linear models can match or even outperform softmax attention in most tasks while being more efficient. However, they fall short in terms of memory capacity compared to softmax attention. As we can see, there is a conflict between the increasing input sequences and the fixed memory space. Therefore, both approaches have their advantages and disadvantages, making it difficult to achieve Pareto optimality. To develop a model that balances efficiency with good memory capability, we think that relaxing the complexity of processing each token (to log-linear) could be a promising solution. This will be left for our future work.

Reviewer 2RWL2024-08-13

Thank you for kind and insightful response. I do not have any more concerns and questions anymore. It was really worth it to discuss with authors and feel honor to reviewing this paper. I also wonder what will be happened next to linear vs. quadratic attention wars. I hope your future research will reveal the parato front of these trade off soon! Again, thank you.

Reviewer rbUC2024-08-12

Thanks for the replies

The reviewer thanks the authors for your thorough and informative explanations. I am not an expert in this area, and therefore I am not able to advocate for this paper. However, I will increase my confidence from 2 to 3 as a reflection of what I have learned from your response.

Program Chairsdecision2024-09-25

Decision

Accept (oral)

© 2026 NYSGPT2525 LLC