Papers › RealFormer: Transformer Likes Residual Attention

RealFormer: Transformer Likes Residual Attention

21 Dec 2020Findings (ACL) 2021 8arXiv:2012.11747archive 2025-07-28

Ruining He, Anirudh Ravula, Bhargav Kanagal, Joshua Ainslie

Transformer is the backbone of modern NLP models. In this paper, we propose RealFormer, a simple and generic technique to create Residual Attention Layer Transformer networks that significantly outperform the canonical Transformer and its variants (BERT, ETC, etc.) on a wide spectrum of tasks including Masked Language Modeling, GLUE, SQuAD, Neural Machine Translation, WikiHop, HotpotQA, Natural Questions, and OpenKP. We also observe empirically that RealFormer stabilizes training and leads to models with sparser attention. Source code and pre-trained checkpoints for RealFormer can be found at https://github.com/google-research/google-research/tree/master/realformer.

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

google-research/google-research officialmentioned in papertfSyntology: no sample linked to this paper (harvested for another paper). Syntology's graph links these samples to Efficient Neural Architecture Search via Parameter Sharing (arXiv:1802.03268; that paper's own run record: 18 ran (of which 10 constructed an object rather than computing a result; 12 with no instrument failure: 1 honoured, 0 violated, 11 with no contract checked; 6 where Syntology's instrument failed) · 20 unverified), Milking CowMask for Semi-Supervised Image Classification (arXiv:2003.12022; that paper's own run record: 1 ran (of which 1 constructed an object rather than computing a result; 1 with no instrument failure: 0 honoured, 0 violated, 1 with no contract checked; 0 where Syntology's instrument failed) · 1 unverified; the one sample that ran constructed an object rather than computing a result), Neural Additive Models: Interpretable Machine Learning with Neural Nets (arXiv:2004.13912; that paper's own run record: 26 ran (of which 14 constructed an object rather than computing a result; 26 with no instrument failure: 5 honoured, 0 violated, 21 with no contract checked; 0 where Syntology's instrument failed) · 7 unverified) and 21 more (every one in this page's JSON twin); nothing checks that they implement this paper's method. 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
aivolcano/BERT_MRC_CLS mentioned on GitHubpytorchSyntology: not harvested report
cloneofsimo/RealFormer-pytorch mentioned on GitHubpytorchSyntology: not harvested report
jaketae/realformer mentioned on GitHubpytorchSyntology: not harvested 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 ModellingLinguistic AcceptabilityMachine TranslationMasked Language ModelingNatural Language InferenceNatural QuestionsParaphrase IdentificationSemantic Textual SimilaritySentiment AnalysisTranslation

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Linguistic Acceptability CoLA RealFormer Accuracy 59.83% #31 of 43 Archive leaderboard report
Natural Language Inference MultiNLI RealFormer Matched 86.28 #26 of 67 Archive leaderboard report
Natural Language Inference MultiNLI RealFormer Mismatched 86.34 #26 of 67 Archive leaderboard report
Natural Language Inference QNLI RealFormer Accuracy 91.89% #27 of 43 Archive leaderboard report
Natural Language Inference RTE RealFormer Accuracy 73.7% #47 of 90 Archive leaderboard report
Paraphrase Identification Quora Question Pairs RealFormer Accuracy 91.34 #4 of 31 Archive leaderboard report
Paraphrase Identification Quora Question Pairs RealFormer F1 88.28 #4 of 31 Archive leaderboard report
Semantic Textual Similarity MRPC RealFormer Accuracy 87.01% #30 of 45 Archive leaderboard report
Semantic Textual Similarity MRPC RealFormer F1 90.91% #30 of 45 Archive leaderboard report
Semantic Textual Similarity STS Benchmark RealFormer Pearson Correlation 0.9011 #19 of 66 Archive leaderboard report
Semantic Textual Similarity STS Benchmark RealFormer Spearman Correlation 0.8988 #19 of 66 Archive leaderboard report
Sentiment Analysis SST-2 Binary classification RealFormer Accuracy 94.04 #37 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: RealFormer

Absolute Position EncodingsAdamAttentionBPEContrastive Predictive CodingDense ConnectionsDropoutETCGlobal-Local AttentionInfoNCELabel SmoothingLayer NormalizationLinear LayerMulti-Head AttentionPosition-Wise Feed-Forward LayerRealFormerRelative Position EncodingsResidual ConnectionSoftmaxTransformer

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