Rethinking Attention: Polynomial Alternatives to Softmax in Transformers

Hemanth Saratchandran, Jianqiao Zheng, Yiping Ji, Wenbo Zhang, Simon Lucey
10/24/2024
cs.LGcs.CVstat.ML

No confident code implementation found for this paper.

Abstract

This paper questions whether the strong performance of softmax attention in transformers stems from producing a probability distribution over inputs. Instead, we argue that softmax's effectiveness lies in its implicit regularization of the Frobenius norm of the attention matrix, which stabilizes training. Motivated by this, we explore alternative activations, specifically polynomials, that achieve a similar regularization effect. Our theoretical analysis shows that certain polynomials can serve as effective substitutes for softmax, achieving strong performance across transformer applications despite violating softmax's typical properties of positivity, normalization, and sparsity. Extensive experiments support these findings, offering a new perspective on attention mechanisms.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{saratchandran2024rethinking,
  title  = {Rethinking Attention: Polynomial Alternatives to Softmax in Transformers},
  author = {Hemanth Saratchandran and Jianqiao Zheng and Yiping Ji and Wenbo Zhang and Simon Lucey},
  year   = {2024},
  eprint = {2410.18613},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2410.18613v3}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2410.18613.svg)](https://codeofpaper.com/paper/2410.18613)

Discussion