[論文レビュー] Prompt Engineering or Fine-Tuning: An Empirical Assessment of LLMs for Code
この研究は、コメント生成、コード生成、およびコード翻訳を横断して、GPT-4の prompting 戦略と微調整済みLLMのベースラインを比較し、GPT-4との対話的 prompting に関する定性的なユーザー調査を含む。
The rapid advancements in large language models (LLMs) have greatly expanded the potential for automated code-related tasks. Two primary methodologies are used in this domain: prompt engineering and fine-tuning. Prompt engineering involves applying different strategies to query LLMs, like ChatGPT, while fine-tuning further adapts pre-trained models, such as CodeBERT, by training them on task-specific data. Despite the growth in the area, there remains a lack of comprehensive comparative analysis between the approaches for code models. In this paper, we evaluate GPT-4 using three prompt engineering strategies -- basic prompting, in-context learning, and task-specific prompting -- and compare it against 17 fine-tuned models across three code-related tasks: code summarization, generation, and translation. Our results indicate that GPT-4 with prompt engineering does not consistently outperform fine-tuned models. For instance, in code generation, GPT-4 is outperformed by fine-tuned models by 28.3% points on the MBPP dataset. It also shows mixed results for code translation tasks. Additionally, a user study was conducted involving 27 graduate students and 10 industry practitioners. The study revealed that GPT-4 with conversational prompts, incorporating human feedback during interaction, significantly improved performance compared to automated prompting. Participants often provided explicit instructions or added context during these interactions. These findings suggest that GPT-4 with conversational prompting holds significant promise for automated code-related tasks, whereas fully automated prompt engineering without human involvement still requires further investigation.
研究の動機と目的
- ASEタスクにおいて、基本 prompting、イン-context、タスク特化の自動 prompting 戦略を用いたGPT-4の有効性を、微調整済みLLMベースラインと比較して評価する。
- 3つのASEタスクを評価する:コメント生成(SC to NL)、コード生成(NL to SC)、およびコード翻訳(SC to SC)。
- ASEタスクにおけるGPT-4の対話的相互作用で、参加者が promptingをどのように認識し、どのように進化させるかを探る。
- 完全自動化されたprompt設計が微調整を上回るかどうかを調査し、人的介入 promptingのギャップを特定する。
提案手法
- CodeXGLUE、HumanEval、MBPPベンチマークを用いた定量的比較で、GPT-4を3つの prompting戦略で評価し、公開されている微調整ベースラインと比較する。
- 3つの prompting戦略:基本 prompting、BM25ベースの例選択を用いたイン-context学習、タスク特化の設計 prompting。
- BLEU、pass@1、ACC、およびCodeBLEUをタスク固有の評価指標として使用する。
- タスク間で公平な評価を保証するための後処理とトークン化の調整。
- 対話 prompting と prompting の進化パターンを分析するため、27名の大学院生と10名の産業実務家を対象とした定性的ユーザー研究。
実験結果
リサーチクエスチョン
- RQ1RQ1: 3つのASEタスクにおいて、異なる prompting 戦略を用いたGPT-4は、微調整ベースラインと比較してどれくらい効果的か。
- RQ2RQ2: 基本プロンプトを用いたGPT-4の有用性を、参加者はASEタスクでどのように認識するか。
- RQ3RQ3: ASEタスクのためにGPT-4と対話する際、参加者はプロンプトをどのように洗練させるか。
- RQ4RQ4: 異なるprompt進化パターンがGPT-4のASEタスクの性能に与える影響は何か。
主な発見
- 最良の prompting 戦略を用いたGPT-4は、コメント生成で平均8.33 BLEUポイント上で、1位の微調整モデルを上回った。
- コード生成では、1位の微調整モデルが、GPT-4の最良 prompting より平均で16.61および28.3 BLEUポイント上回った。
- コード翻訳ではGPT-4と微調整ベースラインが互角となり、各々が異なる翻訳タスクで相手を上回る。
- GPT-4を用いた対話 prompting は、3つのASEタスクすべてで自動 prompting 戦略に対して顕著な性能向上をもたらし、各タスクで15.8%、11.83%、16.1%の改善を達成した。
- 定性的結果は、人間が有用なフィードバック、文脈、指示を提供し、GPT-4の出力を大幅に向上させることを示しており、人間を介在させた prompting の潜在能力を強調している。
より良い研究を、今すぐ始めましょう
論文設計から論文執筆まで、研究時間を劇的に削減しましょう。
クレジットカード登録不要
このレビューはAIが作成し、人間の編集者が確認しました。