ChatPaper.aiChatPaper

Sull'Espressività dell'Attenzione Softmax: Una Prospettiva delle Reti Neurali Ricorrenti

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

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

Abstract

Dalla sua introduzione, l'attenzione softmax è diventata la spina dorsale delle moderne architetture transformer grazie alla sua espressività e scalabilità su un'ampia gamma di compiti. Tuttavia, il principale svantaggio dell'attenzione softmax è il requisito di memoria quadratico e la complessità computazionale rispetto alla lunghezza della sequenza. Sostituendo la non linearità softmax, sono state introdotte l'attenzione lineare e metodi simili per evitare il collo di bottiglia quadratico dell'attenzione softmax. Nonostante queste forme lineari di attenzione derivino dalla formulazione originale della softmax, in genere risultano inferiori in termini di accuratezza nei compiti downstream. Sebbene una forte intuizione sulla non linearità softmax applicata al prodotto interno tra query e chiavi suggerisca che essa abbia proprietà desiderabili rispetto ad altre non linearità, la questione del perché esista questa discrepanza rimane ancora senza risposta. Questo lavoro dimostra che l'attenzione lineare è un'approssimazione dell'attenzione softmax derivando la forma ricorrente dell'attenzione softmax. Utilizzando questa forma, ogni parte dell'attenzione softmax può essere descritta nel linguaggio delle reti neurali ricorrenti (RNN). Descrivere l'attenzione softmax come una RNN consente di effettuare un'ablazione delle componenti dell'attenzione softmax per comprenderne l'importanza e il modo in cui interagiscono. In questo modo, il nostro lavoro aiuta a spiegare perché l'attenzione softmax è più espressiva rispetto alle sue controparti.
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.
PDF22August 1, 2025