О выразительности Softmax Attention: перспектива рекуррентных нейронных сетей
On the Expressiveness of Softmax Attention: A Recurrent Neural Network Perspective
July 31, 2025
Авторы: Gabriel Mongaras, Eric C. Larson
cs.AI
Аннотация
С момента своего появления softmax-внимание стало основой современных архитектур трансформаторов благодаря своей выразительности и масштабируемости в широком спектре задач. Однако главным недостатком softmax-внимания является квадратичное требование к памяти и вычислительная сложность, зависящая от длины последовательности. Для устранения квадратичного узкого места softmax-внимания были предложены линейное внимание и аналогичные методы, заменяющие softmax-нелинейность. Несмотря на то, что эти линейные формы внимания выводятся из оригинальной softmax-формулировки, они, как правило, уступают в точности на последующих этапах. Хотя интуитивное понимание softmax-нелинейности на внутреннем произведении запроса и ключа предполагает, что она обладает желаемыми свойствами по сравнению с другими нелинейностями, вопрос о том, почему существует это расхождение, остается без ответа. В данной работе демонстрируется, что линейное внимание является аппроксимацией softmax-внимания, путем вывода рекуррентной формы softmax-внимания. Используя эту форму, каждый компонент softmax-внимания может быть описан в терминах рекуррентных нейронных сетей (RNN). Описание softmax-внимания как RNN позволяет проводить абляцию компонентов softmax-внимания для понимания важности каждой части и их взаимодействия. Таким образом, наша работа помогает объяснить, почему softmax-внимание более выразительно, чем его аналоги.
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.