SecRL-Prune:基于结构化强化学习的代码大模型剪枝以保留对抗性代码变异
SecRL-Prune: Structured Reinforcement Learning-Based Pruning of CodeLLMs for Preserving Adversarial Code Mutation
AI总结:
提出SecRL-Prune框架,通过强化学习对代码大模型进行结构化剪枝,在压缩10-30%时仍保持代码变异能力,导致恶意软件检测率显著下降。
摘要:
大型代码语言模型(CodeLLMs)能够生成和重写程序,实现保留功能的代码变异,这可能被用于创建多样化的恶意软件变种并逃避基于签名的检测。一个关键的安全问题是这种变异能力是否能在模型压缩后存活,这将使得在有限硬件预算下部署成为可能。我们提出了SecRL-Prune,一个针对CodeLLMs的结构化剪枝框架,作用于前馈(MLP/FFN)通道。从预训练的教师模型开始,它使用强化学习学习逐层剪枝策略,奖励为教师-学生KL散度。为了提高效率,我们缓存教师模型的前P个预测一次,并将剪枝后的学生模型与此紧凑目标进行比较,避免教师和学生同时驻留在GPU内存中。我们在HumanEval上使用pass@k评估执行正确性,使用var@k评估代码多样性,在三个7B CodeLLMs上以10-30%的压缩率进行评估。在激进剪枝下,SecRL-Prune始终比最近的结构化剪枝基线保留更高的pass@k和var@k。在真实恶意软件样本的案例研究中,来自20%剪枝模型的语义保持变异显著减少了检测。这些结果表明,代码变异能力可以在显著的结构化剪枝后存活,突显了压缩CodeLLMs的安全相关性。
英文摘要:
Large code language models (CodeLLMs) can generate and rewrite programs, enabling functionality-preserving code mutation that may be used to create diverse malware variants and evade signature-based detection. A key security question is whether this mutation capability survives model compression, which would make deployment feasible under limited hardware budgets. We propose SecRL-Prune, a structured pruning framework for CodeLLMs that operates on feed-forward (MLP/FFN) channels. Starting from a pretrained teacher, it learns a layer-wise pruning policy with reinforcement learning using a teacher-student KL-divergence reward. To improve efficiency, we cache the teacher's top-P predictions once and compare the pruned student against this compact target, avoiding simultaneous teacher-student residency in GPU memory. We evaluate SecRL-Prune on HumanEval using pass@k for execution correctness and var@k for code diversity across three 7B CodeLLMs at 10-30% compression. SecRL-Prune consistently preserves higher pass@k and var@k than recent structured pruning baselines under aggressive pruning. In a case study on real malware samples, semantics-preserving mutations from 20%-pruned models substantially reduced detections. These results show that code mutation capability can survive significant structured pruning, highlighting the security relevance of compressed CodeLLMs.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。