评估AI生成的C++、Fortran、Go、Java、Julia、Matlab、Python、R和Rust代码
Evaluating AI-generated code for C++, Fortran, Go, Java, Julia, Matlab, Python, R, and Rust
AI总结:
本文通过数值积分、共轭梯度和并行热方程三个任务,评估ChatGPT 3.5/4在九种语言中生成科学计算代码的编译、性能与准确性。
摘要:
本研究评估了ChatGPT 3.5和4版本在多种编程语言中生成代码的能力。我们的目标是评估这些AI模型生成科学程序的有效性。为此,我们要求ChatGPT生成三个不同的代码:一个简单的数值积分程序、一个共轭梯度求解器,以及一个基于一维模板的并行热方程求解器。分析重点是代码的编译、运行时性能和准确性。虽然两个版本的ChatGPT都成功创建了可编译和运行的代码(在一定帮助下),但对AI而言,某些语言比其他语言更易于使用(可能是由于所用训练集的规模)。并行代码——即使是我们选择在此研究的简单示例——对AI来说也难以正确生成。
英文摘要:
This study evaluates the capabilities of ChatGPT versions 3.5 and 4 in generating code across a diverse range of programming languages. Our objective is to assess the effectiveness of these AI models for generating scientific programs. To this end, we asked ChatGPT to generate three distinct codes: a simple numerical integration, a conjugate gradient solver, and a parallel 1D stencil-based heat equation solver. The focus of our analysis was on the compilation, runtime performance, and accuracy of the codes. While both versions of ChatGPT successfully created codes that compiled and ran (with some help), some languages were easier for the AI to use than others (possibly because of the size of the training sets used). Parallel codes -- even the simple example we chose to study here -- also difficult for the AI to generate correctly.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。