用执行反馈提升代码质量,让大模型生成更安全可维护的代码。
Improving LLM-Generated Code Quality with GRPO
- 基于代码质量多维度评估库设计新奖励机制
- 相较传统方法,代码质量提升显著且通过专家盲评验证
- 适合关注代码安全性与可维护性的开发团队使用
大型语言模型在代码生成中应用日益广泛。现有训练方法通常以单元测试通过率为奖励信号,聚焦代码功能正确性,但忽略了可维护性、质量和安全性等重要方面。本文提出一个全面的代码质量量化库,并将其作为奖励引入GRPO框架。实验表明,该方法显著提升了生成代码的质量,结果经专家盲评确认,有效改善了代码的可读性、健壮性和安全性。
原文摘要 · Abstract (English)
Large Language Models (LLMs) are gaining widespread use for code generation. Recent training procedures use execution feedback as a reward signal, typically focusing on the functional correctness of the code, using unit test pass rate as a reward signal. However, this reward signal fails to capture notions of maintainability, quality and safety of the code produced. We address this under-explored area and develop a comprehensive library to quantify various aspects of code quality, and use it as a reward in GRPO. We find GRPO increases code quality according to this measure, which is confirmed by expert, blinded human annotators.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。