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 Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

Code

google-research/google-research officialmentioned in papertf report
JunnYu/x-transformers-paddle mentioned on GitHubjaxApache-2.0 report
aivolcano/BERT_MRC_CLS mentioned on GitHubpytorch report
cloneofsimo/RealFormer-pytorch mentioned on GitHubpytorch report
jaketae/realformer 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

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