Skip to main content
QUICK REVIEW

[論文レビュー] Evaluating Semantic Representations of Source Code

Yaza Wainakh, Moiz Rauf|arXiv (Cornell University)|Sep 25, 2019
Software Engineering Research参考文献 26被引用数 5
ひとこと要約

本稿では、500名の開発者の評価に基づくIdBenchを紹介し、ソースコードの識別子の意味的表現を評価するためのベンチマークを提示する。その結果、トップの埋め込み表現は意味的関連性をある程度うまく捉えているが、意味的類似性を適切に表現できていないことが判明し、逆に意味が反対の識別子を類似と誤認する傾向がある。これは、将来的なツールにおいて誤りを引き起こすリスクを伴う。

ABSTRACT

Learned representations of source code enable various software developer tools, e.g., to detect bugs or to predict program properties. At the core of code representations often are word embeddings of identifier names in source code, because identifiers account for the majority of source code vocabulary and convey important semantic information. Unfortunately, there currently is no generally accepted way of evaluating the quality of word embeddings of identifiers, and current evaluations are biased toward specific downstream tasks. This paper presents IdBench, the first benchmark for evaluating to what extent word embeddings of identifiers represent semantic relatedness and similarity. The benchmark is based on thousands of ratings gathered by surveying 500 software developers. We use IdBench to evaluate state-of-the-art embedding techniques proposed for natural language, an embedding technique specifically designed for source code, and lexical string distance functions, as these are often used in current developer tools. Our results show that the effectiveness of embeddings varies significantly across different embedding techniques and that the best available embeddings successfully represent semantic relatedness. On the downside, no existing embedding provides a satisfactory representation of semantic similarities, e.g., because embeddings consider identifiers with opposing meanings as similar, which may lead to fatal mistakes in downstream developer tools. IdBench provides a gold standard to guide the development of novel embeddings that address the current limitations.

研究の動機と目的

  • コード識別子埋め込みのための標準的で偏りのない評価フレームワークの欠如に対処すること。
  • 既存の埋め込み技術がソースコードにおける意味的関連性と類似性をどの程度適切に表現しているかを測定すること。
  • 現在の埋め込み表現における限界、特に意味的に反対の識別子を類似とみなしてしまう傾向を特定すること。
  • 今後のコード埋め込みの改善を導くためのゴールドスタンダードベンチマークを提供すること。

提案手法

  • 数千の識別子ペairに対して500名のソフトウェア開発者から得た意味的関連性および類似性の評価を収集すること。
  • IdBenchを、大規模かつ人手によるアノテーションを用いたコード埋め込み評価のためのベンチマークとして設計すること。
  • ベンチマーク上で、最先端の自然言語処理埋め込み、コード固有の埋め込み、および語彙的文字列距離関数を評価すること。
  • 相関に基づく指標を用いて、埋め込みの類似度スコアを人手によるアノテーション評価と比較すること。
  • 埋め込み出力と人間の判断との乖離を分析し、体系的な失敗要因を特定すること。

実験結果

リサーチクエスチョン

  • RQ1既存のコード識別子埋め込みは、開発者が評価した意味的関連性をどの程度適切に表現しているか?
  • RQ2埋め込み技術は、意味的に反対の識別子をどれほど正しく区別できないか?
  • RQ3コード固有の埋め込みは、汎用的自然言語処理埋め込みと比較して、コードの意味をどの程度適切に捉えられるか?
  • RQ4学習済み埋め込みと比較して、語彙的文字列距離関数は意味的類似性をどの程度適切に表現できるか?

主な発見

  • 最も性能の良い埋め込みは、意味的関連性に関して人間の判断と中程度の相関を示すが、類似性に関しては高い正確性に欠ける。
  • 多くの埋め込みが、意味的に逆の意味の識別子を類似と誤ってランク付けしており、将来的なツールにおける誤りのリスクを孕んでいる。
  • コード固有の埋め込みは、汎用的NLP埋め込みよりもコードの意味をより適切に捉えているが、依然として顕著な限界を示している。
  • 語彙的文字列距離関数は、学習済み埋め込みと比較して、特に意味的類似性タスクにおいて劣っている。
  • ベンチマークにより、現在の埋め込みモデルに体系的なバイアスが存在することが判明し、特に意味的反対の処理において顕著である。

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

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

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

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