arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2405.01567cs.SEcs.AI
收藏

CodeFort:面向代码生成模型的鲁棒性训练

CodeFort: Robust Training for Code Generation Models

AWS AI Labs

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

AI总结:

针对代码生成模型抗扰动鲁棒性不足的问题,提出支持多种扰动泛化与鲁棒训练策略的CodeFort框架,显著提升了基线模型的鲁棒通过率并降低鲁棒性下降率。

摘要:

代码生成模型对微小扰动不具备鲁棒性,这类扰动通常会导致生成结果错误,大幅降低模型性能。尽管提升代码生成模型的鲁棒性对优化实际应用中的用户体验至关重要,但现有研究尚未解决该问题。为填补这一空白,我们提出CodeFort——一种提升代码生成模型鲁棒性的框架,它通过泛化多种代码扰动来丰富训练数据,并支持多种鲁棒训练策略,包括数据增强、批次增强、对抗logits配对和对比学习,所有策略均经过精心设计以支持高吞吐量训练。大量评估结果表明,我们将基线CodeGen模型的平均鲁棒通过率从14.79提升至21.74;在代码语法扰动下,鲁棒性下降率从95.02%显著降至54.95%。

英文摘要:

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. We notably decrease the robustness drop rate from 95.02% to 54.95% against code-syntax perturbations.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑