Skip to main content
QUICK REVIEW

[論文レビュー] AceCoder: Utilizing Existing Code to Enhance Code Generation

Jia Li, Yunfei Zhao|arXiv (Cornell University)|Mar 31, 2023
Software Engineering Research被引用数 16
ひとこと要約

AceCoder はガイド付きコード生成と例の取得をプロンプトに導入し、MBPP、MBJP、MBJSP のベンチマークで複数のLLMと言語におけるコード生成の正確性を大幅に向上させます。

ABSTRACT

Large Language Models (LLMs) have shown great success in code generation. LLMs take as the input a prompt and output the code. A key question is how to make prompts (i.e., Prompting Techniques). Existing prompting techniques are designed for natural language generation and have low accuracy in code generation. In this paper, we propose a new prompting technique named AceCoder. Our motivation is that code generation meets two unique challenges (i.e., requirement understanding and code implementation). AceCoder contains two novel mechanisms (i.e., guided code generation and example retrieval) to solve these challenges. (1) Guided code generation asks LLMs first to analyze requirements and output an intermediate preliminary (e.g., test cases). The preliminary is used to clarify requirements and tell LLMs "what to write". (2) Example retrieval selects similar programs as examples in prompts, which provide lots of relevant content (e.g., algorithms, APIs) and teach LLMs "how to write". We apply AceCoder to three LLMs (e.g., Codex) and evaluate it on three public benchmarks using the Pass@k. Results show that AceCoder can significantly improve the performance of LLMs on code generation. (1) In terms of Pass@1, AceCoder outperforms the state-of-the-art baseline by up to 56.4% in MBPP, 70.7% in MBJP, and 88.4% in MBJSP. (2) AceCoder is effective in LLMs with different sizes (i.e., 6B to 13B) and different languages (i.e., Python, Java, and JavaScript). (3) Human evaluation shows human developers prefer programs from AceCoder.

研究の動機と目的

  • コード生成における要件理解とコード実装という二つの固有の課題のため、専門的なプロンプト付与の必要性を動機づける。
  • ガイド付きコード生成と例取得という AceCoder の二つの機構を提案し、これらの課題に対処する。
  • 公的ベンチマークと人間評価を用いて、複数のLLMと言語に渡る有効性を示す。
  • 各 AceCoder モジュールの貢献を示すアブレーションと設計洞察を提供する。

提案手法

  • BM25 via Lucene を用いたコーパスからの同様の <requirement, code> ペアの取得。
  • n-gram の重複を減らすことで retrieved examples をフィルタリングするセレクタ(アルゴリズム 1)と decay ベースのスコアリングループ。
  • retrieved programs を <requirement, preliminary, code> の三つ組に変換するアナライザ(例から preliminaries を抽出(例:テストケース))。
  • Prompt 構築は三つ組の例をプロンプトに注入し、LLM がまず preliminaries(例:テストケース)を生成し、その後最終コードを生成する。
  • 三段階のコード生成で、LLM が構築されたプロンプトを用いて preliminaries を出力し、その後コードを出力する。
  • MBPP(Python)、MBJP(Java)、MBJSP(JavaScript)各ベース LLM(CodeGeeX-13B、CodeGen-6B、InCoder-6B)で Pass@k(k=1,3,5)を評価。

実験結果

リサーチクエスチョン

  • RQ1RQ1: AceCoder はコード生成の既存プロンプティング技術より正確か?
  • RQ2RQ2: AceCoder は取得ベースのベースラインと比較してどうか?
  • RQ3RQ3: 人間の開発者は AceCoder 生成コードを好むか?
  • RQ4RQ4: 三つの AceCoder モジュール(Retriever、Selector、Analyzer)の貢献は?
  • RQ5RQ5: 三つのモジュールのデザイン選択はどれが性能を最大化する?

主な発見

ベースモデルプロンプト設計MBPP Pass@1MBPP Pass@3MBPP Pass@5MBJP Pass@1MBJP Pass@3MBJP Pass@5MBJSP Pass@1MBJSP Pass@3MBJSP Pass@5
CodeGeeX-13BZero-shot prompting5.2013.8019.404.4611.9718.260.200.200.41
CodeGeeX-13BCoT prompting12.6023.4030.2014.4028.1933.6711.3521.1025.96
CodeGeeX-13BFew-shot prompting20.4030.6036.0016.6326.1734.4811.1619.8825.56
CodeGeeX-13BAceCoder26.7436.4341.1328.3836.7941.5421.0331.4436.04
CodeGen-6BZero-shot prompting10.4019.4024.4014.8125.7631.448.7219.6722.92
CodeGen-6BCoT prompting13.0021.0026.0013.5925.3531.2411.5620.0824.54
CodeGen-6BFew-shot prompting14.6024.0030.2018.2530.0234.689.9419.8823.12
CodeGen-6BAceCoder22.8334.5840.1622.4534.2740.9616.4527.3132.16
InCoder-6BZero-shot prompting4.2011.4016.202.235.889.133.655.888.11
InCoder-6BCoT prompting3.9910.6515.311.834.467.101.222.034.67
InCoder-6BFew-shot prompting12.8022.8028.2010.9523.5326.1712.7822.5227.79
InCoder-6BAceCoder20.1631.4434.1016.3729.8934.7415.9727.1330.65
  • AceCoder は Pass@1 で最先端ベースラインを上回り、MBPPで最大 56.4%、MBJPで 70.7%、MBJSPで 88.4% 上回る。
  • AceCoder は Pass@1 で取得ベースラインを最大 13.1%、MBPP 23.44%、MBJSP 15.8% 上回る。
  • AceCoder は 6B から 13B までの LLMS サイズと Python、Java、JavaScript の間で改善をもたらす。
  • 人間の評価では、開発者は正確性、コードの匂い、保守性の点で AceCoder 生成プログラムを好む。
  • アブレーションにより三つのモジュール(Retriever、Selector、Analyzer)すべてが性能向上に寄与することが示され、設計されたバリアントと比較した。

より良い研究を、今すぐ始めましょう

論文設計から論文執筆まで、研究時間を劇的に削減しましょう。

クレジットカード登録不要

このレビューはAIが作成し、人間の編集者が確認しました。