Towards Enhancing In-Context Learning for Code Generation

要約

タイトル:コード生成のためのインコンテキスト学習の強化に向けて

要約:

– インコンテキスト学習(ICL)と事前学習された言語モデル(PTLM)は、コード生成で大きな成功を収めています。
– しかし、既存の研究では、自然言語生成のためのICL技術を再利用しており、コード生成の独自の特徴を無視しています。
– AceCoderという名前の新しいICLアプローチを提案しました。AceCoderは、プログラムを作成するための前段階の中間プレリミナリー(たとえば、テストケース、API)を出力し、そのプレリミナリーを元に次のコード生成を誘導することで、PTLMが要件を理解するのを助けます。
– AceCoderは、Codexなどの6つのPTLMに適用され、3つの公開ベンチマークで評価されました。結果は、AceCoderがPTLMのパフォーマンスを大幅に向上させることを示しています。
– AceCoderは、さまざまなサイズ(1Bから175B)とさまざまな言語(Python、Java、JavaScriptなど)のPTLMに効果的です。
– AceCoderを評価するには、Pass@kを使用します。Pass@1の場合、AceCoderは、既存のICLと比較して最大79.7%、ファインチューニングされたモデルと比較して最大171%優れています。
– AceCoderは、複数の中間プレリミナリーの選択肢を調査し、生成されたプログラムを3つの側面で手動的に評価し、AceCoderの優越性を証明します。
– 最後に、開発者にとってICLに関する洞察について議論します。

要約(オリジナル)

In-context learning (ICL) with pre-trained language models (PTLMs) has shown great success in code generation. ICL does not require training. PTLMs take as the input a prompt consisting of a few requirement-code examples and a new requirement, and output a new program. However, existing studies simply reuse ICL techniques for natural language generation and ignore unique features of code generation. We refer to these studies as standard ICL. Inspired by observations of the human coding process, we propose a novel ICL approach for code generation named AceCoder. Compared to standard ICL, AceCoder has two novelties. (1) Example retrieval. It retrieves similar programs as examples and learns programming skills (e.g., algorithms, APIs) from them. (2) Guided Code Generation. It encourages PTLMs to output an intermediate preliminary (e.g., test cases, APIs) before generating programs. The preliminary can help PTLMs understand requirements and guide the next code generation. We apply AceCoder to six PTLMs (e.g., Codex) and evaluate it on three public benchmarks using the Pass@k. Results show that AceCoder can significantly improve the performance of PTLMs on code generation. (1) In terms of Pass@1, AceCoder outperforms standard ICL by up to 79.7% and fine-tuned models by up to 171%. (2) AceCoder is effective in PTLMs with different sizes (e.g., 1B to 175B) and different languages (e.g., Python, Java, and JavaScript). (3) We investigate multiple choices of the intermediate preliminary. (4) We manually evaluate generated programs in three aspects and prove the superiority of AceCoder. (5) Finally, we discuss some insights about ICL for practitioners.

arxiv情報

著者 Jia Li,Yunfei Zhao,Yongmin Li,Ge Li,Zhi Jin
発行日 2023-03-31 02:57:15+00:00
arxivサイト arxiv_id(pdf)

提供元, 利用サービス

arxiv.jp, OpenAI

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