With the advent of powerful neural language models, AI-based systems to assist developers in coding tasks are becoming widely available; Copilot is one such system. Copilot uses Codex, a large language model (LLM), to complete code conditioned on a preceding "prompt". Codex, however, is trained on public GitHub repositories, viz., on code that may include bugs and vulnerabilities. Previous studies [1], [2] show Codex reproduces vulnerabilities seen in training. In this study, we examine how prone Codex is to generate an interesting bug category, single statement bugs, commonly referred to as simple, stupid bugs or SStuBs in the MSR community. We find that Codex and similar LLMs do help avoid some SStuBs, but do produce known, verbatim SStuBs as much as 2x as likely than known, verbatim correct code. We explore the consequences of the Codex generated SStuBs and propose avoidance strategies that suggest the possibility of reducing the production of known, verbatim SStubs, and increase the possibility of producing known, verbatim fixes.
翻译:随着强大神经语言模型的出现,基于AI的编码辅助系统(如Copilot)正广泛普及。Copilot采用大型语言模型Codex,根据前置"提示"补全代码。然而,Codex基于公开GitHub仓库训练,其训练数据可能包含错误和漏洞。先前研究[1][2]表明Codex会复现训练数据中的漏洞。本研究聚焦于Codex生成单语句错误(MSR社区常称之简单愚蠢错误,SStuBs)的倾向。我们发现Codex及类似LLMs确实有助于规避部分SStuBs,但生成已知逐字SStuBs的概率是生成已知逐字正确代码的2倍。我们探讨了Codex生成SStuBs的后果,并提出规避策略:这些策略既能降低已知逐字SStuBs的产生概率,又能提升生成已知逐字修复代码的可能性。