A Prompt Learning Framework for Source Code Summarization

要約

(ソース) コードの要約は、指定されたコード スニペットに対して自然言語の要約を自動的に生成するタスクです。
このような概要は、開発者がソース コードを理解し、維持するのに役立つ重要な役割を果たします。
最近、多くの分野で大規模言語モデル (LLM) の適用が成功したことを受けて、ソフトウェア エンジニアリングの研究者もコード要約タスクを解決するために LLM を適応させようと試みています。
主な適応スキームには、指示のプロンプトとタスク指向の微調整が含まれます。
ただし、指示プロンプトには、ゼロショット学習用に作成されたプロンプトの設計や、少数ショット学習用の適切なサンプルの選択が含まれ、ユーザーは専門分野の知識を必要とし、タスク指向の微調整には多額のトレーニング コストが必要です。
この論文では、PromptCS と呼ばれるコード要約のための新しいプロンプト学習フレームワークを提案します。
PromptCS は、継続的なプロンプトを生成できるプロンプト エージェントをトレーニングして、コード要約における LLM の可能性を解き放ちます。
人間が作成した個別のプロンプトと比較して、連続プロンプトは LLM の指導の下で生成されるため、LLM が理解しやすいです。
PromptCS は、プロンプト エージェントのトレーニング時に LLM のパラメータをフリーズするため、トレーニング リソースの要件を大幅に削減できます。
複数のプログラミング言語を含む CodeSearchNet データセットで PromptCS を評価します。
結果は、PromptCS が、広く使用されている 4 つの指標すべてにおいて指示プロンプト スキームよりも大幅に優れていることを示しています。
CodeGen-Multi-2B、StarCoderBase-1B、-3B などの一部のベース LLM では、PromptCS はタスク指向の微調整スキームよりも優れたパフォーマンスを発揮します。
さらに重要なことは、PromptCS のトレーニング効率はタスク指向の微調整スキームよりも速く、大規模な LLM ではより顕著な利点があることです。
人間による評価の結果は、PromptCS がベースラインと比較してより優れた概要を生成できることを示しています。

要約(オリジナル)

(Source) code summarization is the task of automatically generating natural language summaries for given code snippets. Such summaries play a key role in helping developers understand and maintain source code. Recently, with the successful application of large language models (LLMs) in numerous fields, software engineering researchers have also attempted to adapt LLMs to solve code summarization tasks. The main adaptation schemes include instruction prompting and task-oriented fine-tuning. However, instruction prompting involves designing crafted prompts for zero-shot learning or selecting appropriate samples for few-shot learning and requires users to have professional domain knowledge, while task-oriented fine-tuning requires high training costs. In this paper, we propose a novel prompt learning framework for code summarization called PromptCS. PromptCS trains a prompt agent that can generate continuous prompts to unleash the potential for LLMs in code summarization. Compared to the human-written discrete prompt, the continuous prompts are produced under the guidance of LLMs and are therefore easier to understand by LLMs. PromptCS freezes the parameters of LLMs when training the prompt agent, which can greatly reduce the requirements for training resources. We evaluate PromptCS on the CodeSearchNet dataset involving multiple programming languages. The results show that PromptCS significantly outperforms instruction prompting schemes on all four widely used metrics. In some base LLMs, e.g., CodeGen-Multi-2B and StarCoderBase-1B and -3B, PromptCS even outperforms the task-oriented fine-tuning scheme. More importantly, the training efficiency of PromptCS is faster than the task-oriented fine-tuning scheme, with a more pronounced advantage on larger LLMs. The results of the human evaluation demonstrate that PromptCS can generate more good summaries compared to baselines.

arxiv情報

著者 Weisong Sun,Chunrong Fang,Yudu You,Yuchen Chen,Yi Liu,Chong Wang,Jian Zhang,Quanjun Zhang,Hanwei Qian,Wei Zhao,Yang Liu,Zhenyu Chen
発行日 2023-12-26 14:37:55+00:00
arxivサイト arxiv_id(pdf)

提供元, 利用サービス

arxiv.jp, Google

カテゴリー: 68-04, 68T30, cs.AI, cs.SE, I.2.2 パーマリンク