Skip to main content
QUICK REVIEW

[論文レビュー] Interactive Code Generation via Test-Driven User-Intent Formalization

Shuvendu K. Lahiri, Fakhoury, Sarah|arXiv (Cornell University)|Aug 11, 2022
Software Engineering Research被引用数 24
ひとこと要約

本論文は、対話型テスト駆動コード生成(ITDCG)をTiCoderとして実装する提案であり、生成されたテストを通じた軽量なユーザーフィードバックを用いて意図を形式化し、コード候補の絞り込み/ランク付けを行い、MBPPとHumanEvalでpass@k指標を改善する。

ABSTRACT

Large language models (LLMs) have shown great potential in automating significant aspects of coding by producing natural code from informal natural language (NL) intent. However, when interacting with LLMs, users have no guarantees that the code suggestions produced correctly satisfy the intent they provided. In fact, it is hard to define a notion of correctness since natural language can be ambiguous and lacks a formal semantics. In this paper, we propose the workflow of {\it interactive test-driven code generation}, which leverages lightweight user feedback to (a) formalize the user intent using generated tests that can be useful for debugging, and (b) produce an improved set of code suggestions by pruning and ranking candidate code suggestions. We describe a language-agnostic abstract algorithm and a concrete implementation TiCoder. We perform an automated evaluation of TiCoder on the \emph{MBPP} and \emph{HumanEval} code generation benchmarks. Our results are promising with using the OpenAI Codex LLM: our best algorithm improves the \passk{1} code generation accuracy (in absolute percentages) between $22.49\%$ to $37.71\%$ for MBPP and between $24.79\%$ to $53.98\%$ for HumanEval using between 1 to 5 simulated user queries.

研究の動機と目的

  • 軽量で実行可能な仕様として機能する生成されたテストを介して、コード生成のユーザー意図を形式化する
  • ユーザーが考慮したテストからのランタイムフィードバックを用いて、LLM生成コードの提案を絞り込み、ランク付けする
  • 言語に依存しない抽象的ITDCGアルゴリズムと具体的実装(TiCoder)を提供する
  • PythonデータセットMBPPとHumanEvalで、基盤となるLLMとしてCodexを用いてITDCGを評価する
  • 対話、プロンプト、変異、ランク付けの寄与を、純粋なLLMベースのベースラインと比較して示す

提案手法

  • テストの絞り込み、変異、ランク付けのコンポーネントでパラメータ化された、抽象的なInteractiveTestDrivenCodeGenアルゴリズムを記述する
  • CodePromptとTestPromptを用いて、問題の説明からコードとテストを生成するTiCoderを実装する
  • テスト集合を拡張するために、構文的変異(SyntacticMutateTests)と動的変異(DynMutateTests)を用いる
  • 絞り込み効果を最大化するクエリを選択するためにテストをランク付け(RankTests)し、それに応じてコード候補を絞り込むまたは保持する
  • コード提案を、何個のテストを満たすか(passing-tests)でランク付け(RankCodes)する
  • mをユーザークエリとして、pass@k@mおよびaccept@{m}指標を用いて評価する
  • オフライン評価のために、オラクル(参照実装)を用いてユーザー応答をシミュレートする

実験結果

リサーチクエスチョン

  • RQ1対話的ワークフローは、ベースラインと比較してコード提案の精度(pass@k@m)をどのように改善するか?
  • RQ2シミュレートされたユーザークエリの数が増えるにつれて、生成コードとテストの正確さはどのように向上するか?
  • RQ3デザイン選択(プロンプト、変異、ランキング)がITDCG全体の有効性に与える影響は何か?

主な発見

  • TiCoderは1つのユーザークエリでMBPPのpass@1@1が70.73%、HumanEvalが55.28%を達成し、Codexベースラインおよびいくつかのベースラインを上回る。
  • 5つのユーザークエリで、報告された設定においてMBPPで70.73%、HumanEvalで55.28%のpass@1@1を達成し、IdealRankingに近い性能に達する。
  • TiCoderは、相互作用なしのベースラインやCodexを常に上回り、MBPPとHumanEvalの両方で{k in {2,5,10}}において一貫して上回る。
  • オラクルベースの評価を用いると、ユーザークエリが増えるにつれてTiCoderはIdealRankingに近づき、テスト駆動の曖昧さ解消から substantial な利益を示している。
  • デフォルトのTiCoder設定(TestGenPrompt = pass、StaticMutateTests = single-assert、DynMutateTests = assert-rewrite-all、TestRanking = discriminative、CodeRanking = passing-tests)は、強力なpass@1@1性能のために選択された。
  • MBPPの87.12%、HumanEvalの95.73%の例について、ユーザー意図と一致するユニットテストを生成するのに平均1.7個のユーザークエリが十分である。

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

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

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

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