一句话:提出 CREME,定位鲁棒性敏感层并做轻量参数编辑,显著提升代码 LLM 对提示扰动的鲁棒性。
论文关注代码大语言模型对提示扰动高度敏感的问题:措辞、语法或格式的微小改动即可显著降低生成代码的功能正确性。为提升实际场景下的可靠性,作者提出 CREME(CodeLLM Robustness Enhancement via Model Editing),通过对比原始提示与扰动提示的隐藏状态来识别对鲁棒性敏感的层,随后在定位到的层上进行轻量级参数编辑,以缓解性能退化。实验在 HumanEval 与 MBPP 及其扰动版本上评估,结果显示 CREME 在扰动提示上将 Pass@1 准确率提升 63%,同时在干净输入上保持稳定,准确率偏差在 ±1% 以内。进一步分析表明,鲁棒性敏感层主要集中于网络的中层与深层,且其位置随模型架构不同而变化,为后续面向鲁棒性的编辑策略提供了依据。
Large language models (LLMs) have demonstrated impressive capabilities in code generation, where the natural language prompt plays a crucial role in conveying user intent to the model. However, prior studies have shown that LLMs are highly sensitive to prompt perturbations. Minor modifications in wording, syntax, or formatting can significantly reduce the functional correctness of generated code. As perturbations frequently occur in real-world scenarios, improving the robustness of LLMs to prompt perturbations is essential for ensuring reliable performance in practical code generation. In this paper, we introduce CREME (CodeLLM Robustness Enhancement via Model Editing), a novel approach that enhances LLM robustness through targeted parameter updates. CREME first identifies robustness-sensitive layers by comparing hidden states between an original prompt and its perturbed variant. Then, it performs lightweight parameter editing at the identified layer to reduce performance degradation. We evaluate CREME on two widely used code generation benchmarks (HumanEval and MBPP) along with their perturbed counterparts. Experimental results show that CREME improves Pass@1 accuracy by 63% on perturbed prompts while maintaining stable performance on clean inputs, with accuracy deviations within ± 1%. Further analysis reveals that robustness-sensitive layers are primarily concentrated in the middle and deeper layers of the network, and their locations vary across different model architectures. These insights provide a valuable foundation for developing future robustness-oriented editing strategies.
@inproceedings{paperbot11651,
title = {CREME: Robustness Enhancement of Code LLMs via Layer-Aware Model Editing},
author = {Shuhan Liu and Xing Hu and Kerui Huang and Xiaohu Yang and David Lo and Xin Xia},
booktitle = {ICSE},
year = {2026},
doi = {10.1145/3744916.3773111}
}