ChatPaper.aiChatPaper

Sobre a Expressividade da Atenção Softmax: Uma Perspectiva de Redes Neurais Recorrentes

On the Expressiveness of Softmax Attention: A Recurrent Neural Network Perspective

July 31, 2025
Autores: Gabriel Mongaras, Eric C. Larson
cs.AI

Resumo

Desde sua introdução, a atenção softmax tornou-se a base das arquiteturas modernas de transformadores devido à sua expressividade e escalabilidade em uma ampla gama de tarefas. No entanto, a principal desvantagem da atenção softmax é o requisito de memória quadrática e a complexidade computacional em relação ao comprimento da sequência. Ao substituir a não linearidade softmax, a atenção linear e métodos semelhantes foram introduzidos para evitar o gargalo quadrático da atenção softmax. Apesar dessas formas lineares de atenção serem derivadas da formulação original da softmax, elas geralmente ficam atrás em termos de precisão em tarefas subsequentes. Embora a forte intuição sobre a não linearidade softmax no produto interno entre consultas e chaves sugira que ela possui propriedades desejáveis em comparação com outras não linearidades, a questão de por que essa discrepância existe ainda permanece sem resposta. Este trabalho demonstra que a atenção linear é uma aproximação da atenção softmax ao derivar a forma recorrente da atenção softmax. Usando essa forma, cada parte da atenção softmax pode ser descrita na linguagem das redes neurais recorrentes (RNNs). Descrever a atenção softmax como uma RNN permite a ablação dos componentes da atenção softmax para entender a importância de cada parte e como elas interagem. Dessa forma, nosso trabalho ajuda a explicar por que a atenção softmax é mais expressiva do que suas contrapartes.
English
Since its introduction, softmax attention has become the backbone of modern transformer architectures due to its expressiveness and scalability across a wide range of tasks. However, the main drawback of softmax attention is the quadratic memory requirement and computational complexity with respect to the sequence length. By replacing the softmax nonlinearity, linear attention and similar methods have been introduced to avoid the quadratic bottleneck of softmax attention. Despite these linear forms of attention being derived from the original softmax formulation, they typically lag in terms of downstream accuracy. While strong intuition of the softmax nonlinearity on the query and key inner product suggests that it has desirable properties compared to other nonlinearities, the question of why this discrepancy exists still remains unanswered. This work demonstrates that linear attention is an approximation of softmax attention by deriving the recurrent form of softmax attention. Using this form, each part of softmax attention can be described in the language of recurrent neural networks (RNNs). Describing softmax attention as an RNN allows for the ablation of the components of softmax attention to understand the importance of each part and how they interact. In this way, our work helps explain why softmax attention is more expressive than its counterparts.
PDF62August 1, 2025