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.
| Task | Dataset | Metric | Value | Model |
|---|---|---|---|---|
| Natural Language Inference | MultiNLI | Matched | 86.28 | RealFormer |
| Natural Language Inference | MultiNLI | Mismatched | 86.34 | RealFormer |
| Semantic Textual Similarity | STS Benchmark | Pearson Correlation | 0.9011 | RealFormer |
| Semantic Textual Similarity | STS Benchmark | Spearman Correlation | 0.8988 | RealFormer |
| Semantic Textual Similarity | Quora Question Pairs | Accuracy | 91.34 | RealFormer |
| Semantic Textual Similarity | Quora Question Pairs | F1 | 88.28 | RealFormer |
| Sentiment Analysis | SST-2 Binary classification | Accuracy | 94.04 | RealFormer |
| Paraphrase Identification | Quora Question Pairs | Accuracy | 91.34 | RealFormer |
| Paraphrase Identification | Quora Question Pairs | F1 | 88.28 | RealFormer |