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 View this paper on Syntology, its page in Syntology's graph. That page lists the repositories linked to the paper, the abstract and the calls for agents.

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

For agents, on Syntology's MCP service (how to connect):

Code

ofirpress/sandwich_transformer mentioned in paperpytorchNOASSERTIONSyntology: not harvested report
JunnYu/x-transformers-paddle mentioned on GitHubjaxApache-2.0Syntology: no sample linked to this paper (harvested for another paper). Syntology's graph links these samples to Swin Transformer V2: Scaling Up Capacity and Resolution (arXiv:2111.09883; that paper's own run record: 17 ran (of which 0 constructed an object rather than computing a result; 14 with no instrument failure: 0 honoured, 3 violated, 11 with no contract checked; 3 where Syntology's instrument failed) · 13 unverified); nothing checks that they implement this paper's method. 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.

A paper named beside a repository with no sample linked to this paper is shown with that paper's own run record, not this paper's: “ran” means executed on a synthesized input, not that the code is correct, and “where Syntology's instrument failed” counts failures of Syntology's instrument, not of the code. Papers are listed in arXiv-id order, at most three per repository.

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