PulseExploreJournal ClubDebatesTrendingResearchersJournals
Instagram
HomeExploreJournal ClubTrending
Synapse
⌘+K
Synapse
September 23, 20250 citationsOpen Access

Improving Code LLM Robustness to Prompt Perturbations via Layer-Aware Model Editing

View Full Paper
SLShuhan LiuXHXing HuKHKe-Qiang Huang

Key Points

  • CREME improves Pass@1 accuracy by 63% on perturbed prompts while keeping accuracy deviations within 1%.
  • Experimental evaluation on popular benchmarks reveals that specific layers are more sensitive to prompt perturbations.
  • The proposed parameter editing occurs in identified robustness-sensitive layers, enhancing performance under prompt variations.
  • Insights into layer sensitivity across architectures provide a foundation for future robustness strategies in language models.

Abstract

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 (Code 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.

Ask AI
Helpful
Bookmark
Share
View Full Paper

Cite This Study

Liu et al. (2025) studied this question.

synapsesocial.com/papers/68d4757f31b076d99fa6cdb8https://doi.org/10.48550/arxiv.2507.16407
Ask AI
Helpful
Bookmark
Share
View Full Paper