Skip to main content
QUICK REVIEW

[論文レビュー] A Prompt Learning Framework for Source Code Summarization

Xu, Tingting, Miao, Yun|arXiv (Cornell University)|Dec 26, 2023
Software Engineering Research被引用数 4
ひとこと要約

この論文では、大規模言語モデル(LLMs)におけるソースコード要約のための効果的なプロンプトを生成する連続的プロンプトエージェントを学習するプロンプト学習フレームワーク、PromptCSを提案する。手動でのプロンプト設計の必要性を排除し、ファインチューニングと同等の最先端の性能を達成しながら、特に大規模LLMsにおいて、トレーニングコストを著しく削減し、効率性を向上させる。

ABSTRACT

(Source) code summarization is the task of automatically generating natural language summaries (also called comments) for given code snippets. 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, task-oriented (full-parameter) fine-tuning, and parameter-efficient fine-tuning (PEFT). However, instruction prompting involves designing crafted prompts and requires users to have professional domain knowledge, while task-oriented fine-tuning requires high training costs, and effective, tailored PEFT methods for code summarization are still lacking. This paper proposes an effective prompt learning framework for code summarization called PromptCS. It no longer requires users to rack their brains to design effective prompts. Instead, 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 is non-invasive to LLMs and freezes the parameters of LLMs when training the prompt agent, which can greatly reduce the requirements for training resources. Our comprehensive experimental results show that PromptCS significantly outperforms instruction prompting schemes (including zero-shot learning and few-shot learning) on all four widely used metrics, and is comparable to the task-oriented fine-tuning scheme. In some base LLMs, e.g., 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.

研究の動機と目的

  • 大規模言語モデル(LLMs)を用いたコード要約における手動プロンプト設計の課題に対処すること。これは専門知識を要し、時間がかかる。
  • コード要約におけるタスク指向のファインチューニングに伴う高い計算コストを低減すること。
  • モデルの再トレーニングなしに、パラメータを凍結した非侵襲的で、効果的なプロンプト生成が可能なアプローチを開発すること。
  • LLMsの理解とより適合するプロンプトを生成することで、コード要約の質と関連性を向上させること。
  • 連続的プロンプト学習が、ゼロショット/少数ショットインstructプロンプトティングおよび一部の状況ではファインチューニングを上回ることを示すこと。

提案手法

  • 離散的で人手で作成されたプロンプトではなく、連続的プロンプトを生成するためのプロンプトエージェントを学習することで、LLMsの内部表現とより良い整合性を図る。
  • トレーニング中にLLMパラメータを凍結するため、非侵襲的であり、リソース要件を著しく削減する。
  • 生成された要約の質に基づく損失関数を用い、LLMs自身の出力でガイドされたエンドツーエンドの最適化により、プロンプトエージェントを最適化する。
  • 勾配ベースの更新により連続的プロンプトを最適化することで、モデルが自動的に効果的なプロンプトパターンを学習できる。
  • 標準的な指標(BLEU、METEOR、ROUGE-L、SentenceBERT)を用いて、複数のプログラミング言語でCodeSearchNetデータセット上で評価される。
  • ベースラインと比較して生成された要約の質と関連性を評価するため、人間による評価が実施される。

実験結果

リサーチクエスチョン

  • RQ1トレーナブルなプロンプトエージェントは、コード要約において、手作業で設計された離散的プロンプトを上回る連続的プロンプトを生成できるか?
  • RQ2パラメータを凍結したLLMを用いたプロンプト学習は、タスク固有のファインチューニングと同等の性能を達成できるか?
  • RQ3PromptCSは、さまざまなベースLLMにおいて、特にトレーニング効率性とスケーラビリティの観点でどのように性能を発揮するか?
  • RQ4連続的プロンプトは、ゼロショットまたは少数ショットインstructプロンプトティングと比較して、コード要約の質を向上させられるか?
  • RQ5人間による評価では、このフレームワークはどのように性能を発揮するか?また、より自然で正確な要約を生成できるか?

主な発見

  • PromptCSは、BLEU、METEOR、ROUGE-L、SentenceBERTの4つの指標すべてにおいて、ゼロショットおよび少数ショットインstructプロンプトティングを顕著に上回る。
  • CodeGen-Multi-2B や StarCoderBase-1B および -3B などのベースLLMにおいて、PromptCSはタスク指向のファインチューニングをも上回る性能を示す。
  • PromptCSのトレーニング効率はファインチューニングを上回っており、パラメータの凍結のおかげで、大規模LLMにおいてより顕著な利点を示す。
  • 人間による評価により、PromptCSはベースライン手法よりも高品質な要約を生成することが確認され、関連性と自然さが向上している。
  • プロンプトエージェントがLLMに適合する連続的プロンプトを生成できる能力が、このフレームワークの成功の鍵要因である。
  • このフレームワークは、CodeSearchNetベンチマークにおける複数のプログラミング言語にわたる強力な一般化性能を示している。

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

論文の読解から最終レビューまで、研究時間を劇的に削減しましょう。

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

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