Pop Quiz! Do Pre-trained Code Models Possess Knowledge of Correct API Names?

要約

CodeBERT や Codex などの事前トレーニング済みコード モデルの最近の進歩により、さまざまなダウンストリーム タスクで優れたパフォーマンスが発揮されることが示されました。
これらのコード モデル間での API 使用の正確さと曖昧さのなさは、望ましいプログラム機能を実現するために非常に重要であり、さまざまな API の完全修飾名を構造的および意味的に学習する必要があります。
最近の研究では、最先端の事前トレーニング済みコード モデルであっても、コード生成中に正しい API を提案するのに苦労していることが明らかになりました。
ただし、このような API 使用パフォーマンスの低下の理由はほとんど調査されていません。
この課題に対処するために、コード モデルを解釈する手段としてナレッジ プローブを使用することを提案します。これは、cloze スタイルのテストを使用してモデルに格納されているナレッジを測定します。
私たちの包括的な調査では、API 呼び出しと API インポートという 2 つの異なる観点から API 完全修飾名を理解するコード モデルの機能を検証します。
具体的には、現在のコード モデルは API 名の理解に苦労しており、事前トレーニング戦略が API 名の学習の品質に大きく影響していることを明らかにしました。
自然言語コンテキストがコード モデルによる Python API 名の検索を支援し、Python API 名の知識を目に見えないデータに一般化できることを実証します。
私たちの調査結果は、現在の事前トレーニングされたコード モデルの制限と機能についての洞察を提供し、事前トレーニング プロセスに API 構造を組み込むことで、自動化された API の使用とコード表現を改善できることを示唆しています。
この研究は、コード インテリジェンスの実践を前進させる重要性と将来の研究の方向性を提供します。
この作業で使用されたすべての実験結果、データ、ソース コードは \url{https://doi.org/10.5281/zenodo.7902072} で入手できます。

要約(オリジナル)

Recent breakthroughs in pre-trained code models, such as CodeBERT and Codex, have shown their superior performance in various downstream tasks. The correctness and unambiguity of API usage among these code models are crucial for achieving desirable program functionalities, requiring them to learn various API fully qualified names structurally and semantically. Recent studies reveal that even state-of-the-art pre-trained code models struggle with suggesting the correct APIs during code generation. However, the reasons for such poor API usage performance are barely investigated. To address this challenge, we propose using knowledge probing as a means of interpreting code models, which uses cloze-style tests to measure the knowledge stored in models. Our comprehensive study examines a code model’s capability of understanding API fully qualified names from two different perspectives: API call and API import. Specifically, we reveal that current code models struggle with understanding API names, with pre-training strategies significantly affecting the quality of API name learning. We demonstrate that natural language context can assist code models in locating Python API names and generalize Python API name knowledge to unseen data. Our findings provide insights into the limitations and capabilities of current pre-trained code models, and suggest that incorporating API structure into the pre-training process can improve automated API usage and code representations. This work provides significance for advancing code intelligence practices and direction for future studies. All experiment results, data and source code used in this work are available at \url{https://doi.org/10.5281/zenodo.7902072}.

arxiv情報

著者 Terry Yue Zhuo,Xiaoning Du,Zhenchang Xing,Jiamou Sun,Haowei Quan,Li Li,Liming Zhu
発行日 2023-09-14 15:46:41+00:00
arxivサイト arxiv_id(pdf)

提供元, 利用サービス

arxiv.jp, Google

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