Enhancing BERT Performance: Multi-teacher Adversarial Distillation with Clean and Robust Guidance
摘要
The BERT model has slow inference speed due to the massive parameters, and it is susceptible to adversarial attacks due to lack of robustness. Knowledge distillation tackles the first issue by compressing the model, while adversarial training resolves the second issue by incorporating disturbances into training. However, existing knowledge distillation methods often struggle to balance between model accuracy and robustness. To address this, we propose a multi-teacher adversarial distillation approach for the BERT model. Our approach employs a clean teacher, providing soft labels to guide the student model in learning the clean samples, and a robust teacher, which employs adversarial training and semi-supervised learning to guide the student model in learning adversarial samples. Additionally, we introduce adaptive loss weights, which enable the student model to focus on the more challenging knowledge during training process. We validate the effectiveness of our proposed approach through experiments with various adversarial attack methods. On the typical text classification dataset IMDB, we improve the robust accuracy of the student DistilBERT model from 19.78 to 35.17, while maintaining a high clean accuracy of 93.17.