arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2306.14583cs.CLcs.AIcs.SE
收藏

探索大语言模型解决编程问题的鲁棒性

Exploring the Robustness of Large Language Models for Solving Programming Problems

University of Aizu(会津大学);Tohoku University(东北大学);NTT Communication Science Laboratories(NTT通信科学实验室)

Atsushi Shirafuji, Yutaka Watanobe, Takumi Ito, Makoto Morishita, Yuki Nakamura, Yusuke Oda, Jun Suzuki

AI总结:

本文探究了CodeGen、Codex、InstructGPT和ChatGPT等大语言模型在解决编程问题时对问题描述表面修改的鲁棒性,发现早期模型对变量名等表面线索敏感,而SOTA模型鲁棒性更强,强调了精心格式化提示的重要性。

摘要:

近期,将大语言模型(LLMs)用于源代码生成引起了广泛关注。诸如Codex和ChatGPT等基于Transformer的模型已被证明在解决各类编程问题方面具备高度能力。然而,LLMs在多大程度上能够理解问题描述并据此生成程序,还是仅仅基于表面线索从训练数据中检索最相关问题的源代码,目前尚未被揭示。为探索这一研究问题,我们开展了实验以探究几种流行LLMs(即CodeGen和GPT-3.5系列模型)在解决入门级编程问题代码生成任务时的鲁棒性。实验结果表明,CodeGen和Codex对问题描述的表面修改十分敏感,并显著影响代码生成性能。此外,我们观察到Codex依赖变量名,因为随机化变量会显著降低解题率。然而,诸如InstructGPT和ChatGPT等最先进(SOTA)模型对表面修改展现出更高的鲁棒性,并在解决编程问题方面具备卓越能力。这突显了一个事实:对提供给LLMs的提示进行轻微修改可能会极大影响代码生成性能,精心格式化提示对于高质量代码生成至关重要,同时SOTA模型正对扰动变得更具鲁棒性。

英文摘要:

Using large language models (LLMs) for source code has recently gained attention. LLMs, such as Transformer-based models like Codex and ChatGPT, have been shown to be highly capable of solving a wide range of programming problems. However, the extent to which LLMs understand problem descriptions and generate programs accordingly or just retrieve source code from the most relevant problem in training data based on superficial cues has not been discovered yet. To explore this research question, we conduct experiments to understand the robustness of several popular LLMs, CodeGen and GPT-3.5 series models, capable of tackling code generation tasks in introductory programming problems. Our experimental results show that CodeGen and Codex are sensitive to the superficial modifications of problem descriptions and significantly impact code generation performance. Furthermore, we observe that Codex relies on variable names, as randomized variables decrease the solved rate significantly. However, the state-of-the-art (SOTA) models, such as InstructGPT and ChatGPT, show higher robustness to superficial modifications and have an outstanding capability for solving programming problems. This highlights the fact that slight modifications to the prompts given to the LLMs can greatly affect code generation performance, and careful formatting of prompts is essential for high-quality code generation, while the SOTA models are becoming more robust to perturbations.

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

↑