Simplifying Transformer Blocks

Bobby He, Thomas Hofmann
11/1/2023

Official code: bobby-he/simplified_transformers (296 stars, MIT, last commit 2024-12-16).

Abstract

A simple design recipe for deep Transformers is to compose identical building blocks. But standard transformer blocks are far from simple, interweaving attention and MLP sub-blocks with skip connections&normalisation layers in precise arrangements. This complexity leads to brittle architectures, where seemingly minor changes can significantly reduce training speed, or render models untrainable. In this work, we ask to what extent the standard transformer block can be simplified? Combining signal propagation theory and empirical observations, we motivate modifications that allow many block components to be removed with no loss of training speed, including skip connections, projection or value parameters, sequential sub-blocks and normalisation layers. In experiments on both autoregressive decoder-only and BERT encoder-only models, our simplified transformers emulate the per-update training speed and performance of standard transformers, while enjoying 15% faster training throughput, and using 15% fewer parameters.

View on arXivView PDF

Code Implementations(1)

MIT
29625Shell, PythonNov 1, 20231 years agoMIT

Cite this paper

@article{he2023simplifying,
  title  = {Simplifying Transformer Blocks},
  author = {Bobby He and Thomas Hofmann},
  year   = {2023},
  eprint = {2311.01906},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2311.01906},
  journal = {ICLR 2023 2023}
}

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

Discussion