提出CodeGarrison模型,有效识别代码模型中的恶意污染样本。
Poisoned Source Code Detection in Code Models
- 基于代码嵌入的混合深度学习模型,检测污染代码样本
- 对四种攻击方法检测准确率达93.5%,未知攻击下平均85.6%准确率
- 适合关注代码模型安全性的研究人员与开发者
深度学习模型在源代码相关任务中日益流行,但其黑箱特性带来了潜在风险。其中一种风险是投毒攻击:攻击者故意在训练集中注入恶意样本,诱导模型在特定场景下产生错误预测。为保护代码模型免受此类攻击,我们提出CodeGarrison(CG),一种基于代码嵌入的混合深度学习模型,用于识别被污染的代码样本。我们在DAMP、MHM、ALERT及新提出的CodeFooler四种攻击生成的样本上评估了CG,并与当前最优方法ONION对比。结果表明,CG在检测准确率上显著优于ONION,达到93.5%。此外,针对未知攻击,CG在上述四类攻击中平均识别准确率为85.6%,展现出良好的鲁棒性。
原文摘要 · Abstract (English)
Deep learning models have gained popularity for conducting various tasks involving source code. However, their black-box nature raises concerns about potential risks. One such risk is a poisoning attack, where an attacker intentionally contaminates the training set with malicious samples to mislead the model's predictions in specific scenarios. To protect source code models from poisoning attacks, we introduce CodeGarrison (CG), a hybrid deep-learning model that relies on code embeddings to identify poisoned code samples. We evaluated CG against the state-of-the-art technique ONION for detecting poisoned samples generated by DAMP, MHM, ALERT, as well as a novel poisoning technique named CodeFooler. Results showed that CG significantly outperformed ONION with an accuracy of 93.5%. We also tested CG's robustness against unknown attacks, achieving an average accuracy of 85.6% in identifying poisoned samples across the four attacks mentioned above.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。