Lune

EMNLP Findings2024

CodeFort: Robust Training for Code Generation Models

Yuhao Zhang, Shiqi Wang, Haifeng Qian, Zijian Wang, Mingyue Shang, Linbo Liu, Sanjay Krishna Gouda, Baishakhi Ray, Murali Krishna Ramanathan, Xiaofei Ma, Anoop Deoras

Abstract

Code generation models are not robust to small perturbations, which often lead to incorrect generations and significantly degrade the performance of these models. Although improving the robustness of code generation models is crucial to enhancing user experience in real-world applications, existing research efforts do not address this issue. To fill this gap, we propose CodeFort, a framework to improve the robustness of code generation models, generalizing a large variety of code perturbations to enrich the training data and enabling various robust training strategies, mixing data augmentation, batch augmentation, adversarial logits pairing, and contrastive learning, all carefully designed to support high-throughput training. Extensive evaluations show that we increase the average robust pass rates of baseline CodeGen models from 14.79 to 21.74. Notably, we decrease the robustness drop rate from 95.02% to 54.95% against code-syntax perturbations.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

1 top-tier paper has cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Quantifying Memorization Advantage in Code LLMs cites WizardCoder: Empowering Code Large Language Models with Evol-Instruct
  • InCoder: A Generative Model for Code Infilling and Synthesis cites The Curious Case of Neural Text Degeneration
  • Natural Attack for Pre-trained Models of Code cites Adversarial examples for models of code
  • WizardCoder: Empowering Code Large Language Models with Evol-Instruct cites InCoder: A Generative Model for Code Infilling and Synthesis
  • WizardCoder: Empowering Code Large Language Models with Evol-Instruct cites Natural Attack for Pre-trained Models of Code
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers1

  1. Quantifying Memorization Advantage in Code LLMsAlberick Euraste Djire, Abdoul Kader Kaboré, Jordan Samhi, Earl Barr et al.ICSE 2026

Builds on15

  1. The Curious Case of Neural Text DegenerationAri Holtzman, Jan Buys, Li Du, Maxwell Forbes et al.ICLR 2020 · 4,112 citations
  2. WizardCoder: Empowering Code Large Language Models with Evol-InstructZiyang Luo, Can Xu, Pu Zhao, Qingfeng Sun et al.ICLR 2024 · 945 citations
  3. Adversarial examples for models of codeNoam Yefet, Uri Alon, Eran YahavOOPSLA 2020 · 162 citations
  4. Natural Attack for Pre-trained Models of CodeZhou Yang, Jieke Shi, Junda He, David LoICSE 2022 · 150 citations
  5. InCoder: A Generative Model for Code Infilling and SynthesisDaniel Fried, Armen Aghajanyan, Jessy Lin, Sida Wang et al.ICLR 2023 · 140 citations

Related papers

  1. ContraBERT: Enhancing Code Pre-trained Models via Contrastive LearningShangqing Liu, Bozhi Wu, Xiaofei Xie, Guozhu Meng et al.ICSE 2023 · 56 citations
  2. ReCode: Robustness Evaluation of Code Generation ModelsShiqi Wang, Zheng Li, Haifeng Qian, Chenghao Yang et al.ACL 2023 · 32 citations
  3. RoPGen: Towards Robust Code Authorship Attribution via Automatic Coding Style TransformationZhen Li, Qian (Guenevere) Chen, Chen Chen, Yayi Zou et al.ICSE 2022 · 39 citations
  4. CREME: Robustness Enhancement of Code LLMs via Layer-Aware Model EditingShuhan Liu, Xing Hu, Kerui Huang, Xiaohu Yang et al.ICSE 2026
  5. Code Difference Guided Adversarial Example Generation for Deep Code ModelsZhao Tian, Junjie Chen, Zhi JinASE 2023 · 27 citations
Dusk over the sea between two cliffs drawn in fine vertical lines