BatCoder: 通过回译实现的双向代码-文档自监督学习
BatCoder: Self-Supervised Bidirectional Code-Documentation Learning via Back-Translation
AI总结:
BatCoder通过回译策略实现代码与文档的双向自监督学习,提升模型在代码生成和文档生成任务中的性能。
摘要:
训练与代码相关的大型语言模型通常依赖于高质量的代码-文档对,这些对的收集成本高且对于小众编程语言往往稀缺。我们引入了BatCoder,一种自监督强化学习框架,旨在联合优化代码生成和文档生成。BatCoder采用回译策略:首先从代码生成文档,然后将生成的文档用于重建原始代码。原始代码与重建代码之间的语义相似性作为隐式奖励,使强化学习能够提升模型在从文档生成代码和反向生成文档方面的性能。这种方法允许模型仅使用代码进行训练,大幅增加了可用的训练示例。在HumanEval和MBPP上使用7B模型评估,BatCoder实现了83.5%和81.0%的pass@1成绩,优于强大的开源基线。此外,该框架在训练语料库大小和模型容量方面表现出一致的扩展性。
英文摘要:
Training LLMs for code-related tasks typically depends on high-quality code-documentation pairs, which are costly to curate and often scarce for niche programming languages. We introduce BatCoder, a self-supervised reinforcement learning framework designed to jointly optimize code generation and documentation production. BatCoder employs a back-translation strategy: a documentation is first generated from code, and then the generated documentation is used to reconstruct the original code. The semantic similarity between the original and reconstructed code serves as an implicit reward, enabling reinforcement learning to improve the model's performance both in generating code from documentation and vice versa. This approach allows models to be trained using only code, substantially increasing the available training examples. Evaluated on HumanEval and MBPP with a 7B model, BatCoder achieved 83.5% and 81.0% pass@1, outperforming strong open-source baselines. Moreover, the framework demonstrates consistent scaling with respect to both training corpus size and model capacity.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。