How Important are Good Method Names in Neural Code Generation? A Model Robustness Perspective
Not on the map. Why?
Abstract (arXiv)
Pre-trained code generation models (PCGMs) have been widely applied in neural code generation which can generate executable code from functional descriptions in natural languages, possibly together with signatures. Despite substantial performance improvement of PCGMs, the role of method names in neural code generation has not been thoroughly investigated. In this paper, we study and demonstrate the potential of benefiting from method names to enhance the performance of PCGMs, from a model robustness perspective. Specifically, we propose a novel approach, named RADAR (neuRAl coDe generAtor Robustifier). RADAR consists of two components: RADAR-Attack and RADAR-Defense. The former attacks a PCGM by generating adversarial method names as part of the input, which are semantic and visual similar to the original input, but may trick the PCGM to generate completely unrelated code snippets. As a countermeasure to such attacks, RADAR-Defense synthesizes a new method name from the functional description and supplies it to the PCGM. Evaluation results show that RADAR-Attack can reduce the CodeBLEU of generated code by 19.72% to 38.74% in three state-of-the-art PCGMs (i.e., CodeGPT, PLBART, and CodeT5) in the fine-tuning code generation task, and reduce the Pass@1 of generated code by 32.28% to 44.42% in three state-of-the-art PCGMs (i.e., Replit, CodeGen, and CodeT5+) in the zero-shot code generation task. Moreover, RADAR-Defense is able to reinstate the performance of PCGMs with synthesized method names. These results highlight the importance of good method names in neural code generation and implicate the benefits of studying model robustness in software engineering.
Key facts. Cited by 11 papers in the map (data through 14 Oct 2026). First posted on arXiv 29 Nov 2022.
Builds on
No reference list yet.
Built on by
Citing papers per year: 2023: 4; 2024: 1; 2025: 3; 2026: 3.
11 papers.
- 2023Thrilled by Your Progress! Large Language Models (GPT-4) No Longer Struggle to Pass Assessments in Higher Education Programming Coursescited by 39
- 2023Large Language Models (GPT) Struggle to Answer Multiple-Choice Questions about Codecited by 32
- 2024A Deep Dive Into Large Language Model Code Generation Mistakes: What and Why?cited by 10
- 2023Turbulence: Systematically and Automatically Testing Instruction-Tuned Large Language Models for Codecited by 9
- 2025Show Me Your Code! Kill Code Poisoning: A Lightweight Method Based on Code Naturalnesscited by 8
- 2025Evaluate-and-Purify: Fortifying Code Language Models Against Adversarial Attacks Using LLM-as-a-Judgecited by 4
- 2026How Secure is Secure Code Generation? Adversarial Prompts Put LLM Defenses to the Testcited by 4
- 2023Source Code Data Augmentation for Deep Learning: A Surveycited by 3
- 2025Enhancing Large Language Models with Faster Code Preprocessing for Vulnerability Detectioncited by 0
- 2026On the Lexical Superstition of Large Language Models for Code Comprehension: Re-evaluation on Code of Low Lexical Qualitycited by 0
- 2026Natural Code Transformation Confuses Agents in Vulnerability Analysiscited by 0
- 2026Natural Code Transformation Confuses Agents in Vulnerability Analysis9 Oct 2026
- 2026On the Lexical Superstition of Large Language Models for Code Comprehension: Re-evaluation on Code of Low Lexical Quality22 Sep 2026
- 2026How Secure is Secure Code Generation? Adversarial Prompts Put LLM Defenses to the Test11 Jan 2026
- 2025Enhancing Large Language Models with Faster Code Preprocessing for Vulnerability Detection8 May 2025
- 2025Evaluate-and-Purify: Fortifying Code Language Models Against Adversarial Attacks Using LLM-as-a-Judge28 Apr 2025
- 2025Show Me Your Code! Kill Code Poisoning: A Lightweight Method Based on Code Naturalness20 Feb 2025
- 2024A Deep Dive Into Large Language Model Code Generation Mistakes: What and Why?3 Nov 2024
- 2023Turbulence: Systematically and Automatically Testing Instruction-Tuned Large Language Models for Code22 Dec 2023
- 2023Thrilled by Your Progress! Large Language Models (GPT-4) No Longer Struggle to Pass Assessments in Higher Education Programming Courses15 Jun 2023
- 2023Source Code Data Augmentation for Deep Learning: A Survey31 May 2023
- 2023Large Language Models (GPT) Struggle to Answer Multiple-Choice Questions about Code9 Mar 2023