Skip to main content
QUICK REVIEW

[論文レビュー] Multi-task Learning based Pre-trained Language Model for Code Completion

Fang Liu, Ge Li|arXiv (Cornell University)|Dec 29, 2020
Software Engineering Research参考文献 46被引用数 8
ひとこと要約

本論文では、変換器アーキテクチャを用いたマルチタスク学習ベースの事前学習言語モデルを提案し、トークンとその型を同時に予測することで、静的埋め込みの限界や識別子の不完全な補完という問題を解決し、コード補完を改善する。このモデルは2つの実世界のデータセットにおいて最先端の性能を達成しており、特に正しい識別子の特定と提案において顕著な優位性を示している。

ABSTRACT

Code completion is one of the most useful features in the Integrated Development Environments (IDEs), which can accelerate software development by suggesting the next probable token based on the contextual code in real-time. Recent studies have shown that statistical language modeling techniques can improve the performance of code completion tools through learning from large-scale software repositories. However, these models suffer from two major drawbacks: a) Existing research uses static embeddings, which map a word to the same vector regardless of its context. The differences in the meaning of a token in varying contexts are lost when each token is associated with a single representation; b) Existing language model based code completion models perform poor on completing identifiers, and the type information of the identifiers is ignored in most of these models. To address these challenges, in this paper, we develop a multi-task learning based pre-trained language model for code understanding and code generation with a Transformer-based neural architecture. We pre-train it with hybrid objective functions that incorporate both code understanding and code generation tasks. Then we fine-tune the pre-trained model on code completion. During the completion, our model does not directly predict the next token. Instead, we adopt multi-task learning to predict the token and its type jointly and utilize the predicted type to assist the token prediction. Experiments results on two real-world datasets demonstrate the effectiveness of our model when compared with state-of-the-art methods.

研究の動機と目的

  • ソースコードにおける文脈依存的な意味を捉えられない静的語彙埋め込みの限界を解消すること。
  • 予測時に型情報を取り入れることで、識別子の補完性能を向上させること。
  • コード理解とコード生成の両タスクをサポートする統合型の事前学習モデルを開発すること。
  • 事前学習段階でハイブリッド目的関数を用いたマルチタスク学習により、コードにおける文脈表現学習を強化すること。
  • 統合的トークンと型の予測が、IDEにおけるリアルタイムコード補完に有効であることを実証すること。

提案手法

  • モデルは、コードトークンの文脈的表現を学習するため、変換器ベースのニューラルアーキテクチャを用いる。
  • マスク言語モデル、次トークン予測、型予測の3つの目的関数を用いて、大規模なコードリポジトリで事前学習を行う。
  • マルチタスク学習を採用し、次に来るトークンとそのデータ型を同時に予測する。型予測がトークン生成をガイドする。
  • ファインチューニング段階では、トークンと型の両方の予測精度を最適化することで、コード補完に適応させる。
  • 双方向的文脈とアテンションメカニズムを活用し、コードシーケンスにおける長距離依存関係を捉える。
  • コード理解とコード生成の目的を組み合わせたハイブリッド事前学習戦略を採用し、一般化性能を向上させる。

実験結果

リサーチクエスチョン

  • RQ1統合的トークンと型の予測は、単一タスクモデルと比較してコード補完の正確性を向上させるか?
  • RQ2予測段階で型情報を組み込むことで、識別子補完のパフォーマンスが向上するか?
  • RQ3マルチタスク事前学習言語モデルは、従来の静的埋め込みベースのモデルを上回る性能を示せるか?
  • RQ4提案されたモデルは、実世界のコード補完ベンチマークでどの程度効果的か?
  • RQ5モデルは、異なるプログラミング言語やコードパターンに一般化可能か?

主な発見

  • 提案モデルは2つの実世界のコード補完データセットにおいて最先端の性能を達成し、以前のSOTA手法を上回った。
  • 識別子補完の正確性が顕著に向上し、従来の言語モデルベースのアプローチの主な限界を是正した。
  • トークンと型の統合的予測により、より正確で文脈的に適切な補完候補が得られた。
  • マルチタスク事前学習戦略により、特にレアまたは曖昧な識別子の表現学習が強化された。
  • 多様なコードパターンやプログラミング構造に対して、モデルは頑健性と一般化性能を示した。
  • アブレーションスタディの結果、型予測とマルチタスク学習の導入が性能向上に最も寄与していることが確認された。

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

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

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

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