Rethinking Attention: Exploring Shallow Feed-Forward Neural Networks as an Alternative to Attention Layers in Transformers

Vukasin Bozic, Danilo Dordevic, Daniele Coppola, Joseph Thommes, Sidak Pal Singh
11/17/2023
25 citations
cs.CLcs.LG
transformer-attention

No official code found. Best implementation: kyegomez/ShallowFF (12 stars, Python, MIT, last commit 2026-04-13).

Abstract

This work presents an analysis of the effectiveness of using standard shallow feed-forward networks to mimic the behavior of the attention mechanism in the original Transformer model, a state-of-the-art architecture for sequence-to-sequence tasks. We substitute key elements of the attention mechanism in the Transformer with simple feed-forward networks, trained using the original components via knowledge distillation.

Show full abstract

Our experiments, conducted on the IWSLT2017 dataset, reveal the capacity of these "attentionless Transformers" to rival the performance of the original architecture. Through rigorous ablation studies, and experimenting with various replacement network types and sizes, we offer insights that support the viability of our approach. This not only sheds light on the adaptability of shallow feed-forward networks in emulating attention mechanisms but also underscores their potential to streamline complex architectures for sequence-to-sequence tasks.

View on arXivView PDF

Code Implementations(1)

kyegomez/ShallowFFCommunity68%
MIT

Zeta implemantion of "Rethinking Attention: Exploring Shallow Feed-Forward Neural Networks as an Alternative to Attention Layers in Transformers"

121Python, MakefileNov 20, 20237 months agoMIT
artificial-intelligenceattentionattention-is-all-you-needattention-mechanismattention-mechanisms+5 more

Similar Papers

Cite this paper

@article{bozic2023rethinking,
  title  = {Rethinking Attention: Exploring Shallow Feed-Forward Neural Networks as an Alternative to Attention Layers in Transformers},
  author = {Vukasin Bozic and Danilo Dordevic and Daniele Coppola and Joseph Thommes and Sidak Pal Singh},
  year   = {2023},
  eprint = {2311.10642},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2311.10642v4}
}

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/2311.10642.svg)](https://codeofpaper.com/paper/2311.10642)

Discussion