一句话:提出Morph,结合蜕变测试与多目标优化,蒸馏出兼顾准确率、效率与鲁棒性的代码LLM。
论文指出,知识蒸馏虽能压缩大语言模型,但压缩模型对代码微小改动(如参数名同义替换)极为敏感:在蜕变代码上误分类代码克隆的概率比原始LLM高440%,鲁棒性仅为其四分之一。为此作者提出Morph,将蜕变测试与多目标优化结合用于代码LLM的鲁棒蒸馏。Morph以预测翻转数衡量鲁棒性,高效探索模型配置空间,生成在准确率、效率与鲁棒性之间取得Pareto最优的压缩模型。作者在代码克隆检测与漏洞检测两个任务上,以CodeBERT和GraphCodeBERT为蒸馏对象,与最先进蒸馏方法AVATAR及微调未蒸馏模型对比。结果表明,相比AVATAR,Morph产出的压缩模型鲁棒性提升47%、效率提升25%(浮点运算更少),准确率持平或更高(最高+6%),模型大小相近。
Knowledge distillation compresses large language models (LLMs) into more compact and efficient versions that achieve similar accuracy on code-related tasks. However, as we demonstrate in this study, compressed models are four times less robust than the original LLMs when evaluated with metamorphic code. They exhibit a$\mathbf{4 4 0 \%}$higher probability of misclassifying code clones due to minor changes in the code fragment under analysis, such as replacing parameter names with synonyms. To address this issue, we propose Morph, a novel method that combines metamorphic testing with many-objective optimization for a robust distillation of LLMs for code. Morph efficiently explores the models' configuration space and generates Paretooptimal models that effectively balance accuracy, efficiency, and robustness to metamorphic code. Metamorphic testing measures robustness as the number of code fragments for which a model incorrectly makes different predictions between the original and their equivalent metamorphic variants (prediction flips). We evaluate Morph on two tasks-code clone and vulnerability detection-targeting CodeBERT and GraphCodeBERT for distillation. Our comparison includes Morph, the state-of-theart distillation method AVATAR, and the fine-tuned non-distilled LLMs. Compared to Avatar, Morph produces compressed models that are (i) 47 % more robust, (ii) 25 % more efficient (fewer floating-point operations), while maintaining (iii) equal or higher accuracy (up to$+6 \%$), and (iv) similar model size.
DOI 原文 ·
@inproceedings{paperbot8700,
title = {Metamorphic-Based Many-Objective Distillation of LLMs for Code-Related Tasks},
author = {Annibale Panichella},
booktitle = {ICSE},
year = {2025},
doi = {10.1109/icse55347.2025.00230}
}