How Certain is Your T ransformer? (2021)

Abstract: In this work, we consider the problem of uncertainty estimation for Transformer-based models. We investigate the applicability of uncertainty estimates based on dropout usage at the inference stage (Monte Carlo dropout). The series of experiments on natural language understanding tasks shows that the resulting uncertainty estimates improve the quality of detection of error-prone instances. Special attention is paid to the construction of computationally inexpensive estimates via Monte Carlo dropout and Determinantal Point Processes.

## introduction quantifying the uncertainty of machine learning models is an important aspect of trustworthy, reliable, and accountable natural language understanding (nlu) systems. obtaining measures of uncertainty in predictions (also known as uncertainty estimations, ue) helps to detect out-of-domain @xcite , adversarial, or error-prone instances that require special treatment. for example, such instances can be additionally checked by human experts or another more advanced system or alternatively rejected from classification @xcite . besides, uncertainty estimation is an essential component of various applications such as active learning @xcite and outlier/error detection in a dataset @xcite . many modern nlu methods take advantage of deep pre-trained models that are based on the transformer architecture @xcite (e.g., bert @xcite or electra @xcite ). obtaining reliable uncertainty estimations for such neural networks (nns) can, therefore, directly benefit a wide range of nlu tasks, yet implementing ues, in this case, is challenging due to the huge number of parameters in these deep learning models. the approximations of bayesian inference based on dropout usage at the inference stage -monte carlo (mc) dropout @xcite , provide a realizable approach to quantifying ues of deep models. however, they are usually accompanied by serious computational overhead due to the necessity of performing multiple stochastic predictions. importantly, training ensembles of independent models @xcite leads to even more prohibitive overheads. in this work, we investigate various mc dropoutbased approaches to uncertainty quantification of nlu models on the widely-used general language understanding evaluation (glue) benchmark @xcite . the main contributions of our work are two-fold: foot_0 ## related work three dominating approaches to uncertainty estimation in neural networks exist: (i) interpretation of the model's logits from the uncertainty estimation perspective @xcite , which is the basic one; (ii) ensembling, where a discrepancy between models' predictions are interpreted as a sample variance @xcite ; (iii) bayesian neural networks @xcite , which have a built-in mechanism to capture uncertainty via a single model. there are a few recent works that investigate uncertainty quantification for nlp models and use mc dropout techniques. @xcite use bayesian ues for the analysis of semantic parser predictions for correctness. @xcite propose an additional training loss component that facilitates smaller inter-class and bigger intra-class distances in the vector space of the output layer. experiments with convolutional nns on text classification datasets show that this modification helps to improve error detection using mc dropout ues. for quantifying model data uncertainty, @xcite use nns to parameterize a probability distribution (mean and variance) instead of making a prediction directly. for quantifying model uncertainty, the authors leverage the mc dropout. modeling both types of uncertainties in convolutional and recurrent nns helped them to improve the performance in regression and classification nlp tasks. @xcite apply ues to the problem of rumor verification. ## uncertainty estimation of deep transformer neural networks in this section, we describe types of dropout, uncertainty estimation methods, and the transformerbased neural classifier used in our experiments. ## conclusion in this work, we evaluated several ues for the stateof-the-art transformer model electra and the speed-oriented distilbert model in the text classification tasks. to obtain estimates, we leverage multiple stochastic passes using the mc dropout, and the dpp-based dropout proposed by @xcite . we show that by activating all dropouts in the model for stochastic predictions, one can beat the baseline deterministic uncertainty estimate by the significant margin in the binary misclassification detection task. we also demonstrate that replacing the last dropout layer with the dpp dropout can yield significant improvements over the baseline in some cases, but less than the usage of the mc dropout on all dropout layers. despite being inferior compared to the latter, the dpp dropout can provide a better trade-off between computation time and performance of error detection, which can be important for practical use cases. in future work, we are seeking to improve ues quality obtained using the dpp dropout with the help of calibration @xcite and conduct experiments on sequence tagging tasks.