Papers › Pay Attention to MLPs
Pay Attention to MLPs
Hanxiao Liu, Zihang Dai, David R. So, Quoc V. Le
Transformers have become one of the most important architectural innovations in deep learning and have enabled many breakthroughs over the past few years. Here we propose a simple network architecture, gMLP, based on MLPs with gating, and show that it can perform as well as Transformers in key language and vision applications. Our comparisons show that self-attention is not critical for Vision Transformers, as gMLP can achieve the same accuracy. For BERT, our model achieves parity with Transformers on pretraining perplexity and is better on some downstream NLP tasks. On finetuning tasks where gMLP performs worse, making the gMLP model substantially larger can close the gap with Transformers. In general, our experiments show that gMLP can scale as well as Transformers over increased data and compute.
In Syntology View this paper on Syntology, its page in Syntology's graph. That page adds which of its functions are also present in other papers' code Syntology holds, with dates, and its dated run record as JSON and a README badge. It also 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):
get_harvested_code_for_paper(arxiv_id="2105.08050")get_code(code_sha256="…")with a sample'scode_sha256from the list belowget_citation_path(paper_1="2105.08050", paper_2="…")with another paper's arXiv id or titleget_concepts_for_paper(arxiv_id="2105.08050")
Code
Syntology 44 code samples: 41 from 10 repositories linked to this paper, 3 identical to code harvested from another paper's repository. Across all 44: 34 ran (of which 15 constructed an object rather than computing a result; 31 with no instrument failure: 1 honoured, 4 violated, 26 with no contract checked; 3 where Syntology's instrument failed) · 10 unverified. Where Syntology's instrument failed: 2 where our contract draft was wrong; 1 where the contract check could not run; failures of Syntology's instrument, not of the code.
By repository: community (archive-listed): 41 samples from 10 repositories, 31 ran (28 with no instrument failure; 3 where Syntology's instrument failed); 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.
No sample is linked to this paper from 6 of its repositories that Syntology harvested for other papers:
- liuruiyang98/Jittor-MLP, community (archive-listed): harvested for another paper, listed under the repository
- lucidrains/FLASH-pytorch, community (archive-listed): harvested for another paper, listed under the repository
- martinsbruveris/tensorflow-image-models, community (archive-listed): harvested for another paper, listed under the repository
- rwightman/pytorch-image-models, community (archive-listed): harvested for another paper, listed under the repository
- labmlai/annotated_deep_learning_paper_implementations, community (archive-listed): harvested for 15 other papers, listed under the repository
- leondgarse/keras_cv_attention_models, community (archive-listed): harvested for another paper, listed under the repository
Levels written between 2026-09-22 and 2026-09-24 (UTC): the dates Syntology's graph wrote each sample's verification level, not when the code executed. 6 of the 34 samples that ran have no recorded date.
20 repositories listed; official and paper-mentioned ones first.
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
44 samples harvested: 34 ran (of which 15 constructed an object rather than computing a result; 31 with no instrument failure: 1 honoured, 4 violated, 26 with no contract checked; 3 where Syntology's instrument failed) · 10 unverified. “Where Syntology's instrument failed” counts failures of Syntology's instrument, not of the code. Syntology's record for this page has not changed since , the first build that kept a record date for it; when this build read Syntology's graph is in the build record. That date is not when the samples ran.
Licence: 11 of the 44 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.
Harvested from 10 repositories linked to this paper, official or community; the list below is grouped by repository, each group headed by its name and what it is to the paper. 3 samples are listed last, in a group without a repository. “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. A line beginning “fixture:” under a sample that ran gives the arguments Syntology's fixture called the sample with, each as name:type/rank/element kind (? where none was recorded), and the type of what the fixture's run returned, exactly as the harness recorded them; the arguments and the returned type were recorded by two separate runs of the same fixture. No output value is shown, and a returned type says nothing about whether the output was right. “Level recorded” gives the UTC date when Syntology's graph wrote the sample's verification level, not when the code executed; where the level was written before Syntology's graph kept that date, the row says “level recorded, date not recorded”. For 10 samples that ran, the graph records a signature this page does not show: for a class the fixture built without calling, the harness called the object with inputs it made up itself, so the recorded signature is the harness's probe, not the fixture's arguments. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself. “Our draft was wrong” and “the contract check could not run” are failures of Syntology's instrument, not of the code: the sample ran on Syntology's synthesized input, and then the drafted contract did not describe it, or the check itself raised an error (RAISES), lacked a dependency (DEP_MISSING) or ran out of time (TIMEOUT); hover the label for which. A metamorphic tier, where shown, is evidence of the output's shape, not that the sample implements the method.
Each sample ends with its code_sha256. A sample's code_sha256 is Syntology's identity for that exact code. It is printed in full (16 hexadecimal characters for every sample in this build), and get_code(code_sha256="…") takes it exactly as printed. An agent calls it on Syntology's MCP service (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 are grouped by repository: a repository marked official first, then by how directly the repository is tied to the paper, then in the archive's order; never by how many ran. 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 six 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; the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar); this paper's copy was not located, so its licence is not recorded; or this paper's copy is cleared, but the stored copy of the same code that Syntology serves is not. 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.
A function or class name links to its page when the name occurs in the harvested code of at least 5 papers; the name is a string, not an identity. A census tag appears when Syntology's census ran implementations with that name on one shared input per bucket: it gives how many were compared, from how many papers, and how many distinct outputs they produced, and names this sample's bucket when this sample was one of them.
36c054162a22371c · report
fixture: signature x:EagerTensor/2/float · returned EagerTensor · level recorded 2026-09-22 f9f191324f0a26fb · report
fixture: signature x:EagerTensor/3/float · returned EagerTensor · level recorded 2026-09-24 2c295e59b874c818 · report
51216a9ccabc7c3f · report
cb304156fe457ec9 · report
fixture: returned GatingMlpBlock · level recorded 2026-09-22 1356a744f3730d9c · report
fixture: signature x:Tensor/3/float · returned Tensor · level recorded 2026-09-24 5a39fbe0ee0a5529 · report
fixture: returned gMLP · level recorded 2026-09-22 2098e31f03598b8e · report
fixture: returned SpatialGatingUnit · level recorded 2026-09-22 683c46ded1adfd74 · report
fixture: returned gMLPLayer · level recorded 2026-09-22 d300d8fa28344b6c · report
fixture: returned SpatialGatingUnit · level recorded 2026-09-22 2949429d580ede4b · report
fixture: returned gMLP · level recorded 2026-09-22 3f7743323edaa181 · report
fixture: returned gMLPBlock · level recorded 2026-09-22 f84eabb818f0b01a · report
fixture: signature x:Tensor/3/float · returned Tensor · level recorded 2026-09-22 ccc79f7e78680ff2 · report
fixture: signature x:Tensor/3/float · returned Tensor · level recorded 2026-09-22 bfbcb5bb0523c7c8 · report
fixture: signature x:Tensor/4/float · returned Tensor · level recorded 2026-09-22 af39a3c7ed4a3a0c · report
fixture: signature x:Tensor/3/float · returned Tensor · level recorded 2026-09-22 census: 13 implementations from 12 papers, 10 distinct outputs across 4 buckets, one shared input per bucket g_mlp_gpt/g_mlp_gpt.py ran · metamorphic tier: invariant fingerprinted MIT (permissive) ·
400cf93bc9a76062 · report
fixture: signature x:Tensor/3/float · returned Tensor · level recorded 2026-09-22 3bb856991018170a · report
fixture: signature x:Tensor/3/float, gate_res:NoneType/0/? · returned Tensor · level recorded 2026-09-22 7a6075afb6e7a2c2 · report
fixture: signature x:Tensor/3/float, gate_res:NoneType/0/? · returned Tensor · level recorded 2026-09-22 94e83172b0355df5 · report
fixture: signature x:Tensor/3/float · returned Tensor · level recorded 2026-09-22 092c152ffc42d497 · report
fixture: signature val:int/0/int, num:int/0/int · returned tuple · level recorded, date not recorded df3be65159852cd8 · report
fixture: signature tensor:Tensor/2/float, multiple:int/0/int, dim:int/0/int, value:int/0/int · returned Tensor · level recorded, date not recorded census: 13 implementations from 12 papers, 10 distinct outputs across 4 buckets, one shared input per bucket g_mlp_pytorch/g_mlp_pytorch.py ran MIT (permissive) ·
444b2d5ae8422156 · report
fixture: returned Attention · level recorded 2026-09-22 c78c09b8919ac748 · report
fixture: returned PreShiftTokens · level recorded 2026-09-22 4b858823b3eccdd7 · report
fixture: returned Residual · level recorded 2026-09-22 6d43444c56cad017 · report
fixture: returned SpatialGatingUnit · level recorded 2026-09-22 1d39b4f9d1d36f92 · report
fixture: signature layers:list/1/callable, prob_survival:float/0/float · returned list · level recorded, date not recorded 63d8448fca0c6967 · report
fixture: returned gMLPBlock · level recorded 2026-09-22 census: 5 implementations from 5 papers, 5 distinct outputs across 4 buckets, one shared input per bucket this sample: bucket 2 of 4, arg 1: rank 2, kind float, dtype float32 g_mlp_pytorch/g_mlp_pytorch.py ran; the contract check could not run (RAISES) fingerprinted MIT (permissive) ·
2fdf59e29c6d95cc · report
fixture: signature t:Tensor/2/float, amount:int/0/int, mask:NoneType/0/? · returned Tensor · level recorded 2026-09-22 census: 13 implementations from 12 papers, 10 distinct outputs across 4 buckets, one shared input per bucket mlp_gpt_jax/mlp_gpt_jax.py unverified MIT (permissive) ·
01675e7e7c713147 · report
9cceceb3671335d7 · report
fixture: returned Residual · level recorded 2026-09-22 9c81afbca1a2169c · report
fixture: returned SpatialGatingUnit · level recorded 2026-09-22 62c69ec0b60162c6 · report
fixture: signature x:NoneType/0/? · returned bool · level recorded 2026-09-22 b9fa9cafe23e12fb · report
fixture: returned gMLP · level recorded 2026-09-22 3 samples are identical to code Syntology harvested from another paper's repository; this paper's own copy was not located, so no repository is named and no licence is recorded.
27cbea18b00696e9 · report
fixture: signature image_size:int/0/int, patch_size:int/0/int · returned int · level recorded, date not recorded census: 5 implementations from 103 papers, 1 distinct output on one shared input this sample: bucket 1 of 1, arg 1: rank 1, kind int, dtype int64 repository not located ran · violated contract licence of this copy not recorded ·
aa5486a3650902d8 · report
fixture: signature val:Tensor/1/int · returned bool · level recorded, date not recorded Method as code Syntology
What Syntology's graph records as this paper's claimed method, lifted into code: each assembly names its bricks (functions and classes), each with its own role and its own verification level. An assembly is not a check that the code implements the method correctly or reproduces the paper's results. Levels are each brick's own verification level in Syntology's graph (level 0: no recorded run), listed brick by brick and never combined into one level; “ran” means the brick executed on a synthesized input, not that its output is correct, and the instrument figure counts failures of Syntology's instrument, not of the code. Where a model read the code against the paper's claim, each assembly's label verdict is one model's judgement, kept in this page's JSON twin; it is not calibrated, so no card prints it. Siblings are assemblies lifted from this paper in the same batch for the same method: alternative readings kept side by side; none replaces or supersedes another.
11 assemblies on this paper: 11 harvested, 0 generated, listed in 1 groups (siblings lifted in one batch form one group).
11 sibling assemblies for gMLP (harvested), lifted in the same batch on 2026-09-09: alternative readings kept side by side; none replaces or supersedes another.
harvested Assembly for gMLP (graph method: gMLP). 4 bricks; individually on a fixture: 4 ran (of which 3 constructed an object rather than computing a result; 4 with no instrument failure: 0 honoured, 1 violated, 3 with no contract checked; 0 where Syntology's instrument failed) · 0 unverified. The assembly has not been run end-to-end.
one of 11 siblings
harvested Assembly for gMLP (graph method: gMLP). 3 bricks; individually on a fixture: 3 ran (of which 2 constructed an object rather than computing a result; 3 with no instrument failure: 0 honoured, 0 violated, 3 with no contract checked; 0 where Syntology's instrument failed) · 0 unverified. The assembly has not been run end-to-end.
one of 11 siblings
- gMLP entry · level 1 · ran ·
5a39fbe0ee0a5529 - GatingMlpBlock helper · level 1 · ran ·
cb304156fe457ec9 - SpatialGatingUnit helper · level 1 · ran ·
1356a744f3730d9c
harvested Assembly for gMLP (graph method: gMLP). 4 bricks; individually on a fixture: 1 ran (of which 0 constructed an object rather than computing a result; 1 with no instrument failure: 0 honoured, 1 violated, 0 with no contract checked; 0 where Syntology's instrument failed) · 3 unverified. The assembly has not been run end-to-end.
one of 11 siblings
harvested Assembly for gMLP (graph method: gMLP). 3 bricks; individually on a fixture: 3 ran (of which 3 constructed an object rather than computing a result; 3 with no instrument failure: 0 honoured, 0 violated, 3 with no contract checked; 0 where Syntology's instrument failed) · 0 unverified; every one of the 3 samples that ran constructed an object rather than computing a result. The assembly has not been run end-to-end.
one of 11 siblings
- gMLP entry · level 1 · ran ·
2949429d580ede4b - gMLPBlock model · level 1 · ran ·
3f7743323edaa181 - SpatialGatingUnit model · level 1 · ran ·
d300d8fa28344b6c
harvested Assembly for gMLP (graph method: gMLP). 2 bricks; individually on a fixture: 2 ran (of which 2 constructed an object rather than computing a result; 2 with no instrument failure: 0 honoured, 0 violated, 2 with no contract checked; 0 where Syntology's instrument failed) · 0 unverified; every one of the 2 samples that ran constructed an object rather than computing a result. The assembly has not been run end-to-end.
one of 11 siblings
- gMLPLayer entry · level 1 · ran ·
683c46ded1adfd74 - SpatialGatingUnit helper · level 1 · ran ·
2098e31f03598b8e
harvested Assembly for gMLP (graph method: gMLP). 10 bricks; individually on a fixture: 9 ran (of which 6 constructed an object rather than computing a result; 7 with no instrument failure: 0 honoured, 1 violated, 6 with no contract checked; 2 where Syntology's instrument failed) · 1 unverified. The assembly has not been run end-to-end.
one of 11 siblings
- gMLP entry · level 0 · unverified ·
0330d8c0ae7e5def - PreNorm helper · level 1 · ran ·
49d427be2e3ba462 - PreShiftTokens helper · level 1 · ran ·
c78c09b8919ac748 - Residual helper · level 1 · ran ·
4b858823b3eccdd7 - dropout_layers helper · level 1 · ran · our draft was wrong ·
1d39b4f9d1d36f92 - exists helper · level 1 · ran · violated contract ·
aa5486a3650902d8 - gMLPBlock model · level 1 · ran ·
63d8448fca0c6967 - shift helper · level 1 · ran; the contract check could not run (RAISES) ·
2fdf59e29c6d95cc - Attention helper · level 1 · ran ·
444b2d5ae8422156 - SpatialGatingUnit model · level 1 · ran ·
6d43444c56cad017
harvested Assembly for gMLP (graph method: gMLP). 4 bricks; individually on a fixture: 4 ran (of which 0 constructed an object rather than computing a result; 4 with no instrument failure: 0 honoured, 0 violated, 4 with no contract checked; 0 where Syntology's instrument failed) · 0 unverified. The assembly has not been run end-to-end.
one of 11 siblings
- gMLP entry · level 1 · ran ·
bfbcb5bb0523c7c8 - gMLPBlock model · level 1 · ran ·
af39a3c7ed4a3a0c - SpatialGatingUnit model · level 1 · ran ·
f84eabb818f0b01a - TinyAttention helper · level 1 · ran ·
ccc79f7e78680ff2
harvested Assembly for gMLP (graph method: gMLP). 7 bricks; individually on a fixture: 6 ran (of which 0 constructed an object rather than computing a result; 5 with no instrument failure: 0 honoured, 1 violated, 4 with no contract checked; 1 where Syntology's instrument failed) · 1 unverified. The assembly has not been run end-to-end.
one of 11 siblings
- gMLPBlock entry · level 0 · unverified ·
d16a844fcf910249 - Attention helper · level 1 · ran ·
400cf93bc9a76062 - CausalLocalSGU helper · level 1 · ran ·
3bb856991018170a - CausalSGU model · level 1 · ran ·
7a6075afb6e7a2c2 - LocalAttention helper · level 1 · ran ·
94e83172b0355df5 - exists helper · level 1 · ran · violated contract ·
aa5486a3650902d8 - pad_to_multiple helper · level 1 · ran · our draft was wrong ·
df3be65159852cd8
harvested Assembly for gMLP (graph method: gMLP). 10 bricks; individually on a fixture: 9 ran (of which 5 constructed an object rather than computing a result; 7 with no instrument failure: 0 honoured, 1 violated, 6 with no contract checked; 2 where Syntology's instrument failed) · 1 unverified. The assembly has not been run end-to-end.
one of 11 siblings
- gMLP entry · level 0 · unverified ·
2e5cc43cba18a48d - PreNorm helper · level 1 · ran ·
c40137bc5259e649 - PreShiftTokens helper · level 1 · ran ·
c78c09b8919ac748 - Residual helper · level 1 · ran ·
780017fa8de2327d - dropout_layers helper · level 1 · ran · our draft was wrong ·
1d39b4f9d1d36f92 - exists helper · level 1 · ran · violated contract ·
aa5486a3650902d8 - gMLPBlock model · level 1 · ran ·
63d8448fca0c6967 - shift helper · level 1 · ran; the contract check could not run (RAISES) ·
2fdf59e29c6d95cc - Attention helper · level 1 · ran ·
444b2d5ae8422156 - SpatialGatingUnit model · level 1 · ran ·
6d43444c56cad017
harvested Assembly for gMLP (graph method: gMLP). 15 bricks; individually on a fixture: 6 ran (of which 0 constructed an object rather than computing a result; 4 with no instrument failure: 0 honoured, 0 violated, 4 with no contract checked; 2 where Syntology's instrument failed) · 9 unverified. The assembly has not been run end-to-end.
one of 11 siblings
- SpatialGatingBlock entry · level 0 · unverified ·
8327f1592245fe8f - DropPath helper · level 1 · ran ·
d011b7b14c9b2500 - MLPMixerConfig helper · level 0 · unverified ·
df4d5855030fe551 - norm_layer_factory helper · level 0 · unverified ·
0ec08404721c7b91 - ModelConfig helper · level 0 · unverified ·
eb947daa2f30d007 - Affine helper · level 1 · ran ·
ad0e0b25a1519be8 - GroupNormalization helper · level 1 · ran ·
2519f1e7c2bd001c - group_normalize helper · level 1 · ran · our draft was wrong ·
861e072133edda3f - GatedBiasInitializer helper · level 0 · unverified ·
16f57f322f41be79 - GatedKernelInitializer helper · level 0 · unverified ·
9d3dcd6aa345c6da - GatedMLP model · level 0 · unverified ·
259049544dea4342 - GluMLP helper · level 0 · unverified ·
056950f79775c4f6 - MLP helper · level 1 · ran ·
bb64453aab286990 - SpatialGatingUnit model · level 0 · unverified ·
6c472614687c95f3 - act_layer_factory helper · level 1 · ran · our draft was wrong ·
0faca227d392f787
harvested Assembly for gMLP (graph method: gMLP). 6 bricks; individually on a fixture: 2 ran (of which 0 constructed an object rather than computing a result; 2 with no instrument failure: 0 honoured, 0 violated, 2 with no contract checked; 0 where Syntology's instrument failed) · 4 unverified. The assembly has not been run end-to-end.
one of 11 siblings
- gMLP entry · level 0 · unverified ·
211dccfc0c5af2fa - PreNorm helper · level 0 · unverified ·
2c295e59b874c818 - Residual helper · level 1 · ran ·
f9f191324f0a26fb - gMLPBlock model · level 0 · unverified ·
a5c1690311b9aad2 - GELU helper · level 1 · ran ·
36c054162a22371c - SpatialGatingUnit model · level 0 · unverified ·
51216a9ccabc7c3f
Each brick ends with its code_sha256, Syntology's identity for that exact code; click one to copy the get_code call that returns it. For agents, on Syntology's MCP service: assembly(arxiv_id="2105.08050") returns these assemblies with each brick's role and wiring (how to connect).
Tasks
Results from the paper archive 2025-07-28
| Task | Dataset | Model | Metric | Value | Rank at snapshot | Leaderboard | Report |
|---|---|---|---|---|---|---|---|
| Image Classification | ImageNet | gMLP-B | GFLOPs | 31.6 | #628 of 1060 | Archive leaderboard | report |
| Image Classification | ImageNet | gMLP-B | Number of params | 73M | #628 of 1060 | Archive leaderboard | report |
| Image Classification | ImageNet | gMLP-B | Top 1 Accuracy | 81.6% | #628 of 1060 | Archive leaderboard | report |
| Natural Language Inference | MultiNLI | gMLP-large | Matched | 86.2 | #27 of 67 | Archive leaderboard | report |
| Natural Language Inference | MultiNLI | gMLP-large | Mismatched | 86.5 | #27 of 67 | Archive leaderboard | report |
| Question Answering | SQuAD2.0 | gMLP-large | F1 | 78.3 | #286 of 286 | Archive leaderboard | report |
| Sentiment Analysis | SST-2 Binary classification | gMLP-large | Accuracy | 94.8 | #30 of 87 | 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: Spatial Gating Unit, gMLP
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