从知识蒸馏的角度看代码语言模型的元测试:学生是否深度模仿教师?
A Metamorphic Testing Perspective on Knowledge Distillation for Language Models of Code: Does the Student Deeply Mimic the Teacher?
AI总结:
本文从元测试角度探讨代码语言模型知识蒸馏中的行为一致性问题,提出MetaCompress框架以评估学生模型对教师模型的深度模仿程度,揭示传统准确性评估的局限性。
摘要:
基于Transformer的代码语言模型在软件分析任务中表现出色,但其部署受限于高计算成本、慢推理速度和显著的环境影响。为解决这些问题,近期研究探索了通过知识蒸馏将大型代码语言模型(教师)压缩为小型模型(学生)以保持性能的方法。然而,学生模型深度模仿教师模型的预测行为和内部表示的程度仍不清楚,因为当前基于准确性的评估仅提供表面质量视图,往往无法捕捉教师与学生模型行为一致性中的更深层次差异。为此,我们实证表明,学生模型在对抗攻击下性能下降可达285%,这未被传统准确性评估所捕捉。因此,我们提出MetaCompress,一种元测试框架,通过比较教师和学生模型在一组行为保持的元测试关系下的输出,系统评估行为一致性。我们在两个广泛研究的任务上评估MetaCompress,使用三种不同的知识蒸馏技术(Compressor、AVATAR和MORPH)获得的流行代码语言模型压缩版本。结果表明,MetaCompress识别出学生模型高达62%的行为差异,强调了在知识蒸馏流程中进行行为一致性评估的必要性,并确立了MetaCompress作为测试通过知识蒸馏生成的压缩代码语言模型的实用框架。
英文摘要:
Transformer-based language models of code have achieved state-of-the-art performance across a wide range of software analytics tasks, but their practical deployment remains limited due to high computational costs, slow inference speeds, and significant environmental impact. To address these challenges, recent research has increasingly explored knowledge distillation as a method for compressing a large language model of code (the teacher) into a smaller model (the student) while maintaining performance. However, the degree to which a student model deeply mimics the predictive behavior and internal representations of its teacher remains largely unexplored, as current accuracy-based evaluation provides only a surface-level view of model quality and often fails to capture more profound discrepancies in behavioral fidelity between the teacher and student models. To address this gap, we empirically show that the student model often fails to deeply mimic the teacher model, resulting in up to 285% greater performance drop under adversarial attacks, which is not captured by traditional accuracy-based evaluation. Therefore, we propose MetaCompress, a metamorphic testing framework that systematically evaluates behavioral fidelity by comparing the outputs of teacher and student models under a set of behavior-preserving metamorphic relations. We evaluate MetaCompress on two widely studied tasks, using compressed versions of popular language models of code, obtained via three different knowledge distillation techniques: Compressor, AVATAR, and MORPH. The results show that MetaCompress identifies up to 62% behavioral discrepancies in student models, underscoring the need for behavioral fidelity evaluation within the knowledge distillation pipeline and establishing MetaCompress as a practical framework for testing compressed language models of code derived through knowledge distillation.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。