arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2108.10168cs.AI
收藏

CGEM:一种基于GPT-3的代码自动生成度量模型

CGEMs: A Metric Model for Automatic Code Generation using GPT-3

B M S College of Engineering(B M S工程学院)

Aishwarya Narasimhan, Krishna Prasad Agara Venkatesha Rao, Veena M B

摘要:

如今,人工智能技术几乎在每个行业和各行各业都展现出自己的优势。从文本生成,文本摘要,聊天机器人,NLP正在被广泛使用。一个这样的范例是自动代码生成。AI可以生成任何东西;因此输出空间是不受约束的。自动驾驶汽车行驶1亿英里以验证其安全性,但无法编写测试来监控和覆盖不受约束的空间。验证AI生成内容的解决方案之一是约束问题并将其从抽象转换为现实,这可以通过使用理论证明或使用Monte-Carlo模拟方法验证无约束算法来实现。在这种情况下,我们使用后一种方法来测试/验证统计上显著数量的样本。验证AI生成的代码的假设是这项工作的主要动机,为了知道AI生成的代码是否可靠,提出了一个度量模型CGEM。这是一项极具挑战性的任务,因为程序可以有不同的逻辑和不同的命名约定,但是度量必须捕获程序的结构和逻辑。这类似于基于AI的文本生成、问答、翻译等中语法的重要性。在这项工作中获得的支持生成代码评估的各种指标如下:编译、NL描述到逻辑转换、所需编辑的数量、一些常用的静态代码指标和NLP指标。这些指标应用于使用OpenAI的GPT-3生成的80个代码。设计神经网络用于二进制分类(生成代码的质量可接受/不可接受)的帖子。该网络的输入是从度量中获得的特征值。该模型的分类准确率为76.92%,F1得分为55.56%。XAI增强了模型的可解释性。

英文摘要:

Today, AI technology is showing its strengths in almost every industry and walks of life. From text generation, text summarization, chatbots, NLP is being used widely. One such paradigm is automatic code generation. An AI could be generating anything; hence the output space is unconstrained. A self-driving car is driven for 100 million miles to validate its safety, but tests cannot be written to monitor and cover an unconstrained space. One of the solutions to validate AI-generated content is to constrain the problem and convert it from abstract to realistic, and this can be accomplished by either validating the unconstrained algorithm using theoretical proofs or by using Monte-Carlo simulation methods. In this case, we use the latter approach to test/validate a statistically significant number of samples. This hypothesis of validating the AI-generated code is the main motive of this work and to know if AI-generated code is reliable, a metric model CGEMs is proposed. This is an extremely challenging task as programs can have different logic with different naming conventions, but the metrics must capture the structure and logic of the program. This is similar to the importance grammar carries in AI-based text generation, Q&A, translations, etc. The various metrics that are garnered in this work to support the evaluation of generated code are as follows: Compilation, NL description to logic conversion, number of edits needed, some of the commonly used static-code metrics and NLP metrics. These metrics are applied to 80 codes generated using OpenAI's GPT-3. Post which a Neural network is designed for binary classification (acceptable/not acceptable quality of the generated code). The inputs to this network are the values of the features obtained from the metrics. The model achieves a classification accuracy of 76.92% and an F1 score of 55.56%. XAI is augmented for model interpretability.

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

↑