What’s Wrong with Your Code Generated by Large Language Models? An Extensive Study

要約

コード生成における大規模言語モデル (LLM) の開発の増加は、研究者の間で大きな注目を集めています。
LLM ベースのコード生成能力を強化するために、現在の取り組みは主に高品質のデータセットの収集と多様なトレーニング テクノロジーの活用に向けられています。
しかし、これらの既存の方法の限界と境界を調査する包括的な研究が著しく不足しています。
このギャップを埋めるために、私たちは、一般的に使用される 3 つのベンチマークで、3 つの主要なクローズドソース LLM と 4 つの人気のあるオープンソース LLM のパフォーマンスを評価する広範な実証研究を実施しました。
生成されたコードの長さ、循環的複雑さ、および API 番号を評価した私たちの調査により、これらの LLM は、より複雑な問題に対して適切なコードを生成する際に課題に直面しており、正規のソリューションと比較して、短いながらもより複雑なコードを生成する傾向があることが明らかになりました。
さらに、3 つのカテゴリと 12 のサブカテゴリを含む不正なコードのバグ分類法を開発し、一般的なバグ タイプの根本原因を分析しました。
さらに、現実世界のプロジェクトにおける LLM のパフォーマンスをより深く理解するために、140 のコード生成タスクで構成される現実世界のベンチマークを手動で作成しました。
私たちの分析では、実際のシナリオと既存のベンチマークの間のバグ分布の明確な違いが浮き彫りになっています。
最後に、自己批判を導入し、LLM がバグの種類とコンパイラのフィードバックに基づいて生成されたコードを批判および修正できるようにする、トレーニング不要の新しい反復手法を提案します。
実験結果は、私たちのアプローチがバグを大幅に軽減し、2 回の反復後に合格率を 29.2% 増加できることを示しており、LLM がより複雑な問題を処理できる大きな可能性を示しています。

要約(オリジナル)

The increasing development of large language models (LLMs) in code generation has drawn significant attention among researchers. To enhance LLM-based code generation ability, current efforts are predominantly directed towards collecting high-quality datasets and leveraging diverse training technologies. However, there is a notable lack of comprehensive studies examining the limitations and boundaries of these existing methods. To bridge this gap, we conducted an extensive empirical study evaluating the performance of three leading closed-source LLMs and four popular open-source LLMs on three commonly used benchmarks. Our investigation, which evaluated the length, cyclomatic complexity and API number of the generated code, revealed that these LLMs face challenges in generating successful code for more complex problems, and tend to produce code that is shorter yet more complicated as compared to canonical solutions. Additionally, we developed a taxonomy of bugs for incorrect codes that includes three categories and 12 sub-categories, and analyze the root cause for common bug types. Furthermore, to better understand the performance of LLMs in real-world projects, we manually created a real-world benchmark comprising 140 code generation tasks. Our analysis highlights distinct differences in bug distributions between actual scenarios and existing benchmarks. Finally, we propose a novel training-free iterative method that introduces self-critique, enabling LLMs to critique and correct their generated code based on bug types and compiler feedback. Experimental results demonstrate that our approach can significantly mitigate bugs and increase the passing rate by 29.2% after two iterations, indicating substantial potential for LLMs to handle more complex problems.

arxiv情報

著者 Shihan Dou,Haoxiang Jia,Shenxi Wu,Huiyuan Zheng,Weikang Zhou,Muling Wu,Mingxu Chai,Jessica Fan,Caishuang Huang,Yunbo Tao,Yan Liu,Enyu Zhou,Ming Zhang,Yuhao Zhou,Yueming Wu,Rui Zheng,Ming Wen,Rongxiang Weng,Jingang Wang,Xunliang Cai,Tao Gui,Xipeng Qiu,Qi Zhang,Xuanjing Huang
発行日 2024-07-08 17:27:17+00:00
arxivサイト arxiv_id(pdf)

提供元, 利用サービス

arxiv.jp, Google

カテゴリー: cs.CL, cs.SE パーマリンク