arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2110.02523cs.CL
收藏

KNN-BERT:使用KNN分类器微调预训练模型

KNN-BERT: Fine-Tuning Pre-Trained Models with KNN Classifier

School of Computer Science, Fudan University(复旦大学计算机科学技术学院);Shanghai Key Laboratory of Intelligent Information Processing, Fudan University(复旦大学上海市智能信息处理重点实验室)

Linyang Li, Demin Song, Ruotian Ma, Xipeng Qiu, Xuanjing Huang

摘要:

预训练模型被广泛用于微调下游任务,线性分类器通过交叉熵损失进行优化,这可能面临鲁棒性和稳定性问题。这些问题可以通过学习表示来改善,这些表示在进行预测时关注同一类中的相似性和不同类中的矛盾。在本文中,我们利用K-最近邻分类器进行预训练模型的微调。对于这个KNN分类器,我们引入了一个有监督的动量对比学习框架来学习有监督的下游任务的聚类表示。大量的文本分类任务和鲁棒性测试的实验表明,通过将KNN与传统的微调过程中,我们可以获得显着的提高清洁的准确性在丰富的源和Few-Shot设置,可以提高对对抗攻击的鲁棒性。\footnote{all codes is available at https://github.com/LinyangLee/KNN-BERT}

英文摘要:

Pre-trained models are widely used in fine-tuning downstream tasks with linear classifiers optimized by the cross-entropy loss, which might face robustness and stability problems. These problems can be improved by learning representations that focus on similarities in the same class and contradictions in different classes when making predictions. In this paper, we utilize the K-Nearest Neighbors Classifier in pre-trained model fine-tuning. For this KNN classifier, we introduce a supervised momentum contrastive learning framework to learn the clustered representations of the supervised downstream tasks. Extensive experiments on text classification tasks and robustness tests show that by incorporating KNNs with the traditional fine-tuning process, we can obtain significant improvements on the clean accuracy in both rich-source and few-shot settings and can improve the robustness against adversarial attacks. \footnote{all codes is available at https://github.com/LinyangLee/KNN-BERT}

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑