MoEKD:混合专家知识蒸馏用于鲁棒且高性能的压缩代码模型
MoEKD: Mixture-of-Experts Knowledge Distillation for Robust and High-Performing Compressed Code Models
AI总结:
本文提出MoEKD框架,通过混合专家架构实现多专家知识蒸馏,提升压缩模型的鲁棒性和性能,实验表明在漏洞检测任务中,MoEKD在对抗鲁棒性和预测性能上均优于现有基线方法。
摘要:
大型代码语言模型在多样化的软件分析任务中表现出色,但其实际应用受限于高计算需求、慢推理速度、高能耗和环境影响。知识蒸馏(KD)通过将知识从大模型转移到小模型来提供实用解决方案。尽管有效,但最近的研究表明,从单一来源蒸馏的模型即使采用鲁棒性感知蒸馏技术,也表现出退化的对抗鲁棒性。这些观察表明,单源蒸馏在同时转移高质量和鲁棒知识方面存在根本限制。为克服这一限制,我们提出了混合专家知识蒸馏(MoEKD),一种利用混合专家(MoE)架构的KD框架,使从多个专业专家更有效地、更鲁棒地将知识转移到紧凑模型中。MoEKD将蒸馏过程分解为专家和路由训练、通过学习路由机制聚合专家知识以及从聚合知识进行蒸馏。我们在CodeBERT和GraphCodeBERT模型上评估了MoEKD在漏洞检测任务中的表现。实验结果表明,MoEKD在对抗鲁棒性上提高了35.8%,在预测性能上提高了13%,相比最先进的KD基线方法,包括Compressor和AVATAR。此外,消融研究显示,聚合专家知识使超紧凑模型即使在大小减少约一半时仍能保持竞争力。总体而言,这些结果突显了多专家知识聚合在解决现有单源KD方法关键限制方面的有效性。
英文摘要:
Large language models for code have achieved strong performance across diverse software analytics tasks, yet their real-world adoption remains limited by high computational demands, slow inference speeds, significant energy consumption, and environmental impact. Knowledge distillation (KD) offers a practical solution by transferring knowledge from a large model to a smaller and more efficient model. Despite its effectiveness, recent studies show that models distilled from a single source often exhibit degraded adversarial robustness, even when robustness-aware distillation techniques are employed. These observations suggest a fundamental limitation of single-source distillation in simultaneously transferring high-quality and robust knowledge. To overcome this limitation, we propose Mixture of Experts Knowledge Distillation (MoEKD), a KD framework that leverages a Mixture of Experts (MoE) architecture to enable more effective and robust knowledge transfer from multiple specialized experts into a compact model. MoEKD decomposes the distillation process into expert and router training, aggregation of expert knowledge through a learned routing mechanism, and distillation from the aggregated knowledge. We evaluate MoEKD on the vulnerability detection task using CodeBERT and GraphCodeBERT models. Experimental results show that MoEKD not only improves adversarial robustness by up to 35.8%, but also enhances predictive performance by up to 13%, compared to state-of-the-art KD baselines, including Compressor and AVATAR. Furthermore, an ablation study demonstrates that aggregating expert knowledge enables ultra-compact models to maintain competitive performance even when their size is reduced by approximately half. Overall, these results highlight the effectiveness of multi-expert knowledge aggregation in addressing key limitations of existing single-source KD approaches.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。