Papers › Primer: Searching for Efficient Transformers for Language Modeling

Primer: Searching for Efficient Transformers for Language Modeling

17 Sep 2021arXiv:2109.08668archive 2025-07-28

David R. So, Wojciech Mańke, Hanxiao Liu, Zihang Dai, Noam Shazeer, Quoc V. Le

Large Transformer models have been central to recent advances in natural language processing. The training and inference costs of these models, however, have grown rapidly and become prohibitively expensive. Here we aim to reduce the costs of Transformers by searching for a more efficient variant. Compared to previous approaches, our search is performed at a lower level, over the primitives that define a Transformer TensorFlow program. We identify an architecture, named Primer, that has a smaller training cost than the original Transformer and other variants for auto-regressive language modeling. Primer's improvements can be mostly attributed to two simple modifications: squaring ReLU activations and adding a depthwise convolution layer after each Q, K, and V projection in self-attention. Experiments show Primer's gains over Transformer increase as compute scale grows and follow a power law with respect to quality at optimal model sizes. We also verify empirically that Primer can be dropped into different codebases to significantly speed up training without additional tuning. For example, at a 500M parameter size, Primer improves the original T5 architecture on C4 auto-regressive language modeling, reducing the training cost by 4X. Furthermore, the reduced training cost means Primer needs much less compute to reach a target one-shot performance. For instance, in a 1.9B parameter configuration similar to GPT-3 XL, Primer uses 1/3 of the training compute to achieve the same one-shot performance as Transformer. We open source our models and several comparisons in T5 to help with reproducibility.

PaperPDFCodeCode Syntology ran

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

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2109.08668")

Code

Syntology Ran 3 of 3 code samples harvested from 0 repositories linked to this paper; 0 have no recorded run. Of those that ran: 1 ran · honoured contract; 2 ran · violated contract.

By repository: 3 identical to code first harvested elsewhere. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

JunnYu/x-transformers-paddle mentioned on GitHubjaxApache-2.0 report
lucidrains/FLASH-pytorch mentioned on GitHubpytorch 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

3 samples harvested; 3 ran; 1 honoured the contract we drafted; 0 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

1ran · honoured contract
2ran · violated contract

Licence: 3 of the 3 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Some samples are identical code Syntology first harvested from another repository; for those, this paper's copy is not located and its licence is not recorded. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

padding_to_multiple_of identical code first harvested elsewhere ran · honoured contract fingerprinted licence of this copy not recorded · 5f4fdf97a20b1819 · report
default identical code first harvested elsewhere ran · violated contract fingerprinted licence of this copy not recorded · 60fff7c3c400d7ff · report
exists identical code first harvested elsewhere ran · violated contract licence of this copy not recorded · aa5486a3650902d8 · report

Tasks

Language ModelingLanguage Modelling

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Language Modelling C4 Primer Perplexity 12.35 #1 of 9 Archive leaderboard report
Language Modelling C4 Primer Steps 1M #1 of 9 Archive leaderboard report
Language Modelling C4 Primer TPUv3 Hours 17.3K #1 of 9 Archive leaderboard report
Language Modelling C4 T5++ Perplexity 12.69 #3 of 9 Archive leaderboard report
Language Modelling C4 T5++ Steps 1M #3 of 9 Archive leaderboard report
Language Modelling C4 T5++ TPUv3 Hours 16.5K #3 of 9 Archive leaderboard report
Language Modelling C4 Original T5 Perplexity 13.25 #4 of 9 Archive leaderboard report
Language Modelling C4 Original T5 Steps 1M #4 of 9 Archive leaderboard report
Language Modelling C4 Original T5 TPUv3 Hours 15.7K #4 of 9 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: Primer, Squared ReLU

Absolute Position EncodingsAdafactorAdamAttentionAttention DropoutBPEConvolutionCosine AnnealingDense ConnectionsDepthwise ConvolutionDropoutGPT-3Gated Linear UnitInverse Square Root ScheduleLabel SmoothingLayer NormalizationLinear LayerLinear Warmup With Cosine AnnealingMulti-DConv-Head AttentionMulti-Head AttentionPosition-Wise Feed-Forward LayerPrimerResidual ConnectionSentencePieceSoftmaxSquared ReLUT5TransformerWeight Decay

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