arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2512.22216cs.SE
收藏

语法不够:小型Transformer模型在神经代码修复中的实证研究

Syntax Is Not Enough: An Empirical Study of Small Transformer Models for Neural Code Repair

MIT World Peace University(麻省理工学院世界和平大学)

Shaunak Samant

AI总结:

本研究通过实验证明,小型Transformer模型在修复Java错误时,虽然能生成语法正确的代码,但无法达到语义正确的修复效果。

摘要:

利用神经模型进行自动程序修复已在基准数据集上显示出有希望的结果,但实际部署仍然有限。在本研究中,我们检验小型Transformer模型是否能有意义地修复现实中的Java错误,以及语法正确性是否是语义正确性的可靠代理。我们对CodeT5-small(60.5M参数)在CodeXGLUE上的52,364个Java错误修复对进行微调,并使用AST解析评估token级性能和语法有效性。尽管模型能够顺利收敛并实现高语法正确性,在约94%的情况下生成语法有效的Java代码,但在精确匹配评估中却未能生成正确的修复,仅获得零次精确匹配。在约80%的情况下,模型会直接复制错误输入。

英文摘要:

Automated program repair using neural models has shown promising results on benchmark datasets, yet practical deployment remains limited. In this study, we examine whether a small transformer model can meaningfully repair real-world Java bugs and whether syntactic correctness is a reliable proxy for semantic correctness. We fine-tune CodeT5-small (60.5M parameters) on 52,364 Java bug-fix pairs from CodeXGLUE and evaluate both token-level performance and syntactic validity using AST parsing. While the model converges cleanly and achieves high grammatical correctness, producing syntactically valid Java code in approximately ninety-four percent of cases, it fails to generate correct repairs under exact-match evaluation, achieving zero exact matches. In approximately eighty percent of cases, the model reproduces the buggy input verbatim.

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

↑