仿冒难题:代码语言模型能否理解其错误生成的细微之处?
The Counterfeit Conundrum: Can Code Language Models Grasp the Nuances of Their Incorrect Generations?
AI总结:
本文研究代码语言模型对可编译但错误的“仿冒”程序的理解,揭示误判正确、错误预测执行和修复困难三类失败模式及相关性质。
摘要:
尽管语言模型越来越擅长代码生成,但它们仍会频繁生成错误程序。其中许多程序显然是错误的,但另一些则更隐蔽,并能通过较弱的正确性检查,例如能够编译。在本研究中,我们聚焦于这些仿冒样本:从语言模型采样得到的程序,它们 1)具有足够高的对数概率,能够在中等温度下被生成;并且 2)通过弱正确性检查。总体而言,我们通过三种明显的失败模式发现,大多数模型对仿冒品的理解非常肤浅。首先,模型会错误地将它们分类为正确。其次,模型在推理仿冒品的执行行为方面表现较差,并且常常像它们是正确程序一样预测其执行结果。第三,当要求模型修复仿冒品时,模型成功修复一个仿冒品的可能性往往甚至低于从头采样一个正确程序。仿冒品还具有非常出人意料的性质:首先,对于模型更容易解决的问题,其仿冒程序并不一定更容易被发现,且在执行和修复上只略微更容易。其次,来自给定模型的仿冒品对该模型自身造成的困惑,与其对其他模型造成的困惑相同。最后,强模型和弱模型都能够生成同样挑战所有模型的仿冒样本。基于我们的发现,我们建议在依赖模型理解其自身样本时应小心谨慎,尤其是在没有纳入外部反馈的情况下。
英文摘要:
While language models are increasingly more proficient at code generation, they still frequently generate incorrect programs. Many of these programs are obviously wrong, but others are more subtle and pass weaker correctness checks such as being able to compile. In this work, we focus on these counterfeit samples: programs sampled from a language model that 1) have a high enough log-probability to be generated at a moderate temperature and 2) pass weak correctness checks. Overall, we discover that most models have a very shallow understanding of counterfeits through three clear failure modes. First, models mistakenly classify them as correct. Second, models are worse at reasoning about the execution behaviour of counterfeits and often predict their execution results as if they were correct. Third, when asking models to fix counterfeits, the likelihood of a model successfully repairing a counterfeit is often even lower than that of sampling a correct program from scratch. Counterfeits also have very unexpected properties: first, counterfeit programs for problems that are easier for a model to solve are not necessarily easier to detect and only slightly easier to execute and repair. Second, counterfeits from a given model are just as confusing to the model itself as they are to other models. Finally, both strong and weak models are able to generate counterfeit samples that equally challenge all models. In light of our findings, we recommend that care and caution be taken when relying on models to understand their own samples, especially when no external feedback is incorporated.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。