Transferable Post-hoc Calibration on Pretrained Transformers in Noisy Text Classification

Authors

  • Jun Zhang Tsinghua University National Innovation Institute of Defense Technology, Chinese Academy of Military Science
  • Wen Yao National Innovation Institute of Defense Technology, Chinese Academy of Military Science
  • Xiaoqian Chen National Innovation Institute of Defense Technology, Chinese Academic of Military Science
  • Ling Feng Tsinghua University

DOI:

https://doi.org/10.1609/aaai.v37i11.26632

Keywords:

SNLP: Adversarial Attacks & Robustness, SNLP: Text Classification

Abstract

Recent work has demonstrated that pretrained transformers are overconfident in text classification tasks, which can be calibrated by the famous post-hoc calibration method temperature scaling (TS). Character or word spelling mistakes are frequently encountered in real applications and greatly threaten transformer model safety. Research on calibration under noisy settings is rare, and we focus on this direction. Based on a toy experiment, we discover that TS performs poorly when the datasets are perturbed by slight noise, such as swapping the characters, which results in distribution shift. We further utilize two metrics, predictive uncertainty and maximum mean discrepancy (MMD), to measure the distribution shift between clean and noisy datasets, based on which we propose a simple yet effective transferable TS method for calibrating models dynamically. To evaluate the performance of the proposed methods under noisy settings, we construct a benchmark consisting of four noise types and five shift intensities based on the QNLI, AG-News, and Emotion tasks. Experimental results on the noisy benchmark show that (1) the metrics are effective in measuring distribution shift and (2) transferable TS can significantly decrease the expected calibration error (ECE) compared with the competitive baseline ensemble TS by approximately 46.09%.

Downloads

Published

2023-06-26

How to Cite

Zhang, J., Yao, W., Chen, X., & Feng, L. (2023). Transferable Post-hoc Calibration on Pretrained Transformers in Noisy Text Classification. Proceedings of the AAAI Conference on Artificial Intelligence, 37(11), 13940-13948. https://doi.org/10.1609/aaai.v37i11.26632

Issue

Section

AAAI Technical Track on Speech & Natural Language Processing