Papers › Improving Transformer Models by Reordering their Sublayers

Improving Transformer Models by Reordering their Sublayers

10 Nov 2019ACL 2020 6arXiv:1911.03864archive 2025-07-28

Ofir Press, Noah A. Smith, Omer Levy

Multilayer transformer networks consist of interleaved self-attention and feedforward sublayers. Could ordering the sublayers in a different pattern lead to better performance? We generate randomly ordered transformers and train them with the language modeling objective. We observe that some of these models are able to achieve better performance than the interleaved baseline, and that those successful variants tend to have more self-attention at the bottom and more feedforward sublayers at the top. We propose a new transformer pattern that adheres to this property, the sandwich transformer, and show that it improves perplexity on multiple word-level and character-level language modeling benchmarks, at no cost in parameters, memory, or training time. However, the sandwich reordering pattern does not guarantee performance gains across every task, as we demonstrate on machine translation models. Instead, we suggest that further exploration of task-specific sublayer reorderings is needed in order to unlock additional gains.

PaperPDFConference PDFCode

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

Code

ofirpress/sandwich_transformer mentioned in paperpytorchNOASSERTION report
JunnYu/x-transformers-paddle mentioned on GitHubjaxApache-2.0 report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

Not run by Syntology. Nothing on this page verifies that the listed code works.

Tasks

Language ModelingLanguage ModellingMachine TranslationTranslation

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Language Modelling WikiText-103 Sandwich Transformer Number of params 247M #28 of 89 Archive leaderboard report
Language Modelling WikiText-103 Sandwich Transformer Test perplexity 17.96 #28 of 89 Archive leaderboard report
Language Modelling enwik8 Sandwich Transformer (adaptive span) Bit per Character (BPC) 0.968 #7 of 42 Archive leaderboard report
Language Modelling enwik8 Sandwich Transformer (adaptive span) Number of params 209M #7 of 42 Archive leaderboard report

Ranks are positions in the archive's leaderboards as they stood at the 2025-07-28 snapshot. Results published since then are not among these rows, so a rank here is not a current standing.

Methods

Introduced by this paper: Sandwich Transformer

Adaptive MaskingAdaptive Span TransformerAttentionAttention DropoutDense ConnectionsDropoutEmbedding DropoutL1 RegularizationLayer NormalizationLinear LayerMulti-Head AttentionReLUResidual ConnectionSandwich TransformerSoftmax

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections