Pretrained Transformers Improve Out-of-Distribution Robustness
Written for the Research library (claude-opus-5-5) from the paper text, in our own words: the license "arXiv — non-exclusive licence to distribute" does not allow redistributing the text itself. Original — arxiv.org/pdf/2004.06100
Summary
NLP models are usually evaluated on test data from the same distribution as their training data, so it is unclear how they cope when writing style, topic or vocabulary changes. Hendrycks et al. build a robustness benchmark by re-splitting seven existing datasets along their metadata (cuisine, product category, genre, news source) or by pairing related corpora. The benchmark covers sentiment, entailment, reading comprehension and semantic similarity. They compare thirteen models: bag-of-words, word2vec and GloVe encoders (averaging, LSTM, ConvNet), DocQA, and pretrained Transformers (BERT, RoBERTa, ALBERT, DistilBERT). Robustness is measured in two ways: accuracy under distribution shift, and the ability to flag anomalous inputs using the classifier's top softmax probability. Pretrained Transformers lose much less performance on shifted data and consistently beat chance at anomaly detection, which older models often fail to do. Making models larger does not shrink the gap, distillation tends to hurt, and broader pretraining data helps. The work matters because in-distribution scores, including those used to validate compressed models, can hide weaknesses that appear in deployment.
Key points
- Benchmark splits. The benchmark draws on these datasets and splits:
- SST-2 ↔ IMDb.
- Yelp, split by cuisine: American, Chinese, Italian and Japanese.
- Amazon, split into clothing categories plus Music and Movies, with 50,000 reviews per category.
- STS-B, split by source: MSRpar, Headlines, MSRvid and Images.
- ReCoRD, split into CNN and Daily Mail.
- MNLI, split by genre: Telephone, Face-to-Face and Letters.
- STS-B shift. On STS-B, an LSTM's score fell by more than 35% under shift, while RoBERTa's score slightly rose.
- MNLI stability. When BERT Base is fine-tuned only on MNLI's Telephone genre, its accuracy holds steady across genres: 81.4% IID, 82.3% on Letters and 80.8% on Face-to-Face.
- OOD detection. Detection was scored with FAR95 for SST-2 classifiers, using 20 Newsgroups, Multi30K, RTE, SNLI and WMT16 as outlier sources. Non-pretrained models were near or below chance, with false alarm rates close to 100% on 20 Newsgroups.
- Model scale and pretraining data. Bigger BERT and ALBERT variants did not narrow the IID/OOD gap, and DistilBERT was less robust. RoBERTa, pretrained on more data, outperformed BERT Large. Data volume alone does not explain the advantage, though: GloVe saw about 840B tokens, whereas BERT saw about 3B.
Cited by
- On the Opportunities and Risks of Foundation Models
- Weak-to-Strong Generalization: Eliciting Strong Capabilities With Weak Supervision
- Trustworthy LLMs: a Survey and Guideline for Evaluating Large Language Models' Alignment
- Recent Advances in Natural Language Processing via Large Pre-Trained Language Models: A Survey
- LILA: A Unified Benchmark for Mathematical Reasoning
- Learning Transferable Visual Models From Natural Language Supervision
- Robust Speech Recognition via Large-Scale Weak Supervision
- Prompting GPT-3 To Be Reliable
- Using DeepSpeed and Megatron to Train Megatron-Turing NLG 530B, A Large-Scale Generative Language Model
- DecodingTrust: A Comprehensive Assessment of Trustworthiness in GPT Models
Cite
@misc{hendrycks2020pretrained,
title = {{Pretrained Transformers Improve Out-of-Distribution Robustness}},
author = {Hendrycks, Dan and Liu, Xiaoyuan and Wallace, Eric and Dziedzic, Adam and Krishnan, Rishabh and Song, Dawn},
year = {2020},
doi = {10.48550/arxiv.2004.06100},
eprint = {2004.06100},
archivePrefix = {arXiv},
url = {https://doi.org/10.48550/arxiv.2004.06100}
}References
- John Blitzer, Mark Dredze, and Fernando Pereira. 2007. Biographies, bollywood, boom-boxes and blenders: Domain adaptation for sentiment classification. In ACL. find
- Samuel R. Bowman, Gabor Angeli, Christopher Potts, and Christopher D. Manning. 2015. A large annotated corpus for learning natural language inference. In EMNLP. find
- Zheng Cai, Lifu Tu, and Kevin Gimpel. 2017. Pay attention to the ending: Strong neural baselines for the roc story cloze task. In ACL. find
- Dallas Card, Michael Zhang, and Noah A. Smith. 2018. Deep weighted averaging classifiers. In FAT. find
- Daniel Cer, Mona Diab, Eneko Agirre, Inigo Lopez-Gazpio, and Lucia Specia. 2017. SemEval-2017 Task 1: Semantic textual similarity-multilingual and cross-lingual focused evaluation. In SemEval. find
- Christopher Clark and Matt Gardner. 2018. Simple and effective multi-paragraph reading comprehension. In ACL. find our card
- Ido Dagan, Oren Glickman, and Bernardo Magnini. 2005. The PASCAL recognising textual entailment challenge. In Machine Learning Challenges Workshop. find
- Hal Daumé III. 2007. Frustratingly easy domain adaptation. In ACL. find
- Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: pre-training of deep bidirectional transformers for language understanding. In NAACL-HLT. find
- Desmond Elliott, Stella Frank, Khalil Sima’an, and Lucia Specia. 2016. Multi30k: Multilingual english-german image descriptions. In ACL. find our card
- Andrew Emmott, Shubhomoy Das, Thomas G. Dietterich, Alan Fern, and Weng-Keen Wong. 2015. A meta-analysis of the anomaly detection problem. find
- Shi Feng, Eric Wallace, and Jordan Boyd-Graber. 2019. Misleading failures of partial-input baselines. In ACL. find
- Shi Feng, Eric Wallace, II Grissom, Mohit Iyyer, Pedro Rodriguez, and Jordan Boyd-Graber. 2018. Pathologies of neural models make interpretations difficult. In EMNLP. find
- Adam Fisch, Alon Talmor, Robin Jia, Minjoon Seo, Eunsol Choi, and Danqi Chen. 2019. Proceedings of the 2nd workshop on machine reading for question answering. In MRQA Workshop. find
- Daniel Fried, Nikita Kitaev, and Dan Klein. 2019. Cross-domain generalization of neural constituency parsers. In ACL. find our card
- Prakhar Ganesh, Yao Chen, Xin Lou, Mohammad Ali Khan, Yin Yang, Deming Chen, Marianne Winslett, Hassan Sajjad, and Preslav Nakov. 2020. Compressing large-scale transformer-based models: A case study on BERT. ArXiv, abs/2002.11985. find
- Matt Gardner, Joel Grus, Mark Neumann, Oyvind Tafjord, Pradeep Dasigi, Nelson F. Liu, Matthew Peters, Michael Schmitz, and Luke S. Zettlemoyer. 2018. AllenNLP: a deep semantic natural language processing platform. In Workshop for NLP Open Source Software. find our card
- Justin Gilmer, Ryan P. Adams, Ian J. Goodfellow, David Andersen, and George E. Dahl. 2018. Motivating the rules of the game for adversarial example research. ArXiv, abs/1807.06732. — [arXiv:1807.06732](https://arxiv.org/abs/1807.06732) find
- Suchin Gururangan, Swabha Swayamdipta, Omer Levy, Roy Schwartz, Samuel R. Bowman, and Noah A. Smith. 2018. Annotation artifacts in natural language inference data. In NAACL-HLT. find
- Zellig S Harris. 1954. Distributional structure. Word. find
- Ruining He and Julian J. McAuley. 2016. Ups and downs: Modeling the visual evolution of fashion trends with one-class collaborative filtering. In WWW. find
- Dan Hendrycks and Thomas Dietterich. 2019. Benchmarking neural network robustness to common corruptions and perturbations. In ICLR. find
- Dan Hendrycks and Kevin Gimpel. 2016. Gaussian error linear units (GELUs). arXiv preprint arXiv:1606.08415. find
- Dan Hendrycks and Kevin Gimpel. 2017. A baseline for detecting misclassified and out-of-distribution examples in neural networks. In ICLR. find
- Dan Hendrycks, Kimin Lee, and Mantas Mazeika. 2019a. Using pre-training can improve model robustness and uncertainty. ICML. find
- Dan Hendrycks, Mantas Mazeika, and Thomas G. Dietterich. 2019b. Deep anomaly detection with outlier exposure. ICLR. find
- Dan Hendrycks, Mantas Mazeika, Saurav Kadavath, and Dawn Song. 2019c. Using self-supervised learning can improve model robustness and uncertainty. In NeurIPS. find
- Dan Hendrycks, Norman Mu, Ekin D. Cubuk, Barret Zoph, Justin Gilmer, and Balaji Lakshminarayanan. 2020. AugMix: A simple data processing method to improve robustness and uncertainty. ICLR. find
- Dan Hendrycks, Kevin Zhao, Steven Basart, Jacob Steinhardt, and Dawn Song. 2019d. Natural adversarial examples. ArXiv, abs/1907.07174. — [arXiv:1907.07174](https://arxiv.org/abs/1907.07174) find
- Sepp Hochreiter and Jürgen Schmidhuber. 1997. Long short-term memory. In Neural Computation. find
- Robin Jia and Percy Liang. 2017. Adversarial examples for evaluating reading comprehension systems. In EMNLP. find our card
- Zhenzhong Lan, Mingda Chen, Sebastian Goodman, Kevin Gimpel, Piyush Sharma, and Radu Soricut. 2020. ALBERT: a lite BERT for self-supervised learning of language representations. In ICLR. find
- Ken Lang. 1995. NewsWeeder: Learning to filter Netnews. In ICML. find
- Kimin Lee, Honglak Lee, Kibok Lee, and Jinwoo Shin. 2018. Training confidence-calibrated classifiers for detecting out-of-distribution samples. In ICLR. find
- Zhuohan Li, Eric Wallace, Sheng Shen, Kevin Lin, Kurt Keutzer, Dan Klein, and Joseph E Gonzalez. 2020. Train large, then compress: Rethinking model size for efficient training and inference of transformers. ArXiv, abs/2002.11794. — [arXiv:2002.11794](https://arxiv.org/abs/2002.11794) find
- Nelson F Liu, Roy Schwartz, and Noah A Smith. 2019a. Inoculation by fine-tuning: A method for analyzing challenge datasets. In NAACL. find
- Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. 2019b. RoBERTa: A robustly optimized BERT pretraining approach. ArXiv, abs/1907.11692. find
- Andrew L Maas, Raymond E Daly, Peter T Pham, Dan Huang, Andrew Y Ng, and Christopher Potts. 2011. Learning word vectors for sentiment analysis. In ACL. find our card
- Julian J. McAuley, Christopher Targett, Qinfeng Shi, and Anton van den Hengel. 2015. Image-based recommendations on styles and substitutes. In SIGIR. find
- Tomas Mikolov, Ilya Sutskever, Kai Chen, Greg S Corrado, and Jeff Dean. 2013. Distributed representations of words and phrases and their compositionality. In NIPS. find
- Sewon Min, Eric Wallace, Sameer Singh, Matt Gardner, Hannaneh Hajishirzi, and Luke Zettlemoyer. 2019. Compositional questions do not necessitate multi-hop reasoning. In ACL. find
- Aakanksha Naik, Abhilasha Ravichander, Norman Sadeh, Carolyn Rose, and Graham Neubig. 2018. Stress test evaluation for natural language inference. In COLING. find
- A. Emin Orhan. 2019. Robustness properties of facebook’s ResNeXt WSL models. ArXiv, abs/1907.07640. — [arXiv:1907.07640](https://arxiv.org/abs/1907.07640) find
- Jeffrey Pennington, Richard Socher, and Christopher D. Manning. 2014. GloVe: Global vectors for word representation. In EMNLP. find
- Joaquin Quionero-Candela, Masashi Sugiyama, Anton Schwaighofer, and Neil D. Lawrence. 2009. Dataset shift in machine learning. find
- Marco Tulio Ribeiro, Sameer Singh, and Carlos Guestrin. 2018. Semantically equivalent adversarial rules for debugging NLP models. In ACL. find
- Victor Sanh, Lysandre Debut, Julien Chaumond, and Thomas Wolf. 2019. DistilBERT, a distilled version of bert: smaller, faster, cheaper and lighter. In NeurIPS EMC 2 Workshop. find
- Sheng Shen, Zhen Dong, Jiayu Ye, Linjian Ma, Zhewei Yao, Amir Gholami, Michael W Mahoney, and Kurt Keutzer. 2020. Q-BERT: Hessian based ultra low precision quantization of BERT. find
- Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D Manning, Andrew Ng, and Christopher Potts. 2013. Recursive deep models for semantic compositionality over a sentiment treebank. In EMNLP. find
- Antonio Torralba and Alexei A. Efros. 2011. Unbiased look at dataset bias. CVPR. find
- Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. In NIPS. find
- Eric Wallace, Shi Feng, Nikhil Kandpal, Matthew Gardner, and Sameer Singh. 2019. Universal adversarial triggers for attacking and analyzing NLP. In EMNLP. find
- Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R. Bowman. 2019. GLUE: A multitask benchmark and analysis platform for natural language understanding. In ICLR. find
- John Wieting, Mohit Bansal, Kevin Gimpel, and Karen Livescu. 2016. Towards universal paraphrastic sentence embeddings. In ICLR. find our card
- Adina Williams, Nikita Nangia, and Samuel R Bowman. 2018. A broad-coverage challenge corpus for sentence understanding through inference. In NAACL-HLT. find
- Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pier-ric Cistac, Tim Rault, Rémi Louf, Morgan Funtowicz, and Jamie Brew. 2019. HuggingFace’s Transformers: State-of-the-art natural language processing. ArXiv, abs/1910.03771. find our card
- Cihang Xie and Alan L. Yuille. 2020. Intriguing properties of adversarial training at scale. In ICLR. find
- Qizhe Xie, Eduard H. Hovy, Minh-Thang Luong, and Quoc V. Le. 2020. Self-training with noisy student improves imagenet classification. In CVPR. find
- Dani Yogatama, Cyprien de Masson d’Autume, Jerome Connor, Tomás Kociský, Mike Chrzanowski, Lingpeng Kong, Angeliki Lazaridou, Wang Ling, Lei Yu, Chris Dyer, and Phil Blunsom. 2019. Learning and evaluating general linguistic intelligence. ArXiv, abs/1901.11373. find
- Sheng Zhang, Xiaodong Liu, Jingjing Liu, Jianfeng Gao, Kevin Duh, and Benjamin Van Durme. 2018. ReCoRD: bridging the gap between human and machine commonsense reading comprehension. arXiv, abs/1810.12885. find our card