Skip to main content
QUICK REVIEW

[論文レビュー] CodeSearchNet Challenge: Evaluating the State of Semantic Code Search

Hamel Husain, Ho-Hsiang Wu|arXiv (Cornell University)|Sep 20, 2019
Software Engineering Research被引用数 417
ひとこと要約

The paper introduces the CodeSearchNet Corpus and a CodeSearchNet Challenge with 99 natural-language queries and expert relevance annotations to evaluate semantic code search across six programming languages, and presents baseline neural and IR models with an accompanying leaderboard.

ABSTRACT

Semantic code search is the task of retrieving relevant code given a natural language query. While related to other information retrieval tasks, it requires bridging the gap between the language used in code (often abbreviated and highly technical) and natural language more suitable to describe vague concepts and ideas. To enable evaluation of progress on code search, we are releasing the CodeSearchNet Corpus and are presenting the CodeSearchNet Challenge, which consists of 99 natural language queries with about 4k expert relevance annotations of likely results from CodeSearchNet Corpus. The corpus contains about 6 million functions from open-source code spanning six programming languages (Go, Java, JavaScript, PHP, Python, and Ruby). The CodeSearchNet Corpus also contains automatically generated query-like natural language for 2 million functions, obtained from mechanically scraping and preprocessing associated function documentation. In this article, we describe the methodology used to obtain the corpus and expert labels, as well as a number of simple baseline solutions for the task. We hope that CodeSearchNet Challenge encourages researchers and practitioners to study this interesting task further and will host a competition and leaderboard to track the progress on the challenge. We are also keen on extending CodeSearchNet Challenge to more queries and programming languages in the future.

研究の動機と目的

  • Provide a large, realistic dataset for semantic code search by pairing code with documentation.
  • Define a standardized evaluation task (CodeSearchNet Challenge) with expert relevance labels.
  • Offer baseline models and an evaluation protocol to track progress in code search research.
  • Highlight challenges and insights to guide future improvements in neural and IR approaches.

提案手法

  • Assemble the CodeSearchNet Corpus by scraping open-source repositories and pairing functions with processed documentation.
  • Preprocess data with filtering rules to produce realistic training pairs and remove uninformative or duplicate items.
  • Define the CodeSearchNet Challenge with 99 natural-language queries and expert-labeled relevant results across six languages.
  • Develop baseline code search models using neural encoders (NBoW, 1D-CNN, biRNN, self-attention) and a joint embedding objective to map code and queries into a shared vector space.
  • Index all functions with Annoy for fast approximate nearest-neighbor search and compare against an ElasticSearch baseline.
  • Evaluate using mean reciprocal rank (MRR) on a training task and normalized discounted cumulative gain (NDCG) on the broader corpus (Within and All).

実験結果

リサーチクエスチョン

  • RQ1How large and noisy can a code-search corpus be while still enabling effective training of neural models?
  • RQ2What baseline methods (neural and traditional IR) perform best for semantic code search under the CodeSearchNet setup?
  • RQ3How well do joint code-query embeddings rank relevant code snippets for natural-language queries across multiple languages?
  • RQ4What are the practical challenges and limitations of current code search methods and datasets?
  • RQ5How do evaluation metrics like MRR and NDCG reflect performance on both annotated and full corpora?

主な発見

  • The CodeSearchNet Corpus contains about 6.5 million functions across six languages, with roughly 2.3 million function-documentation pairs.
  • Baseline neural models achieve varying performance, with self-attention and simple bag-of-words approaches showing strong results depending on the task and setting.
  • ElasticSearch remains a competitive baseline for keyword-based code search, highlighting the challenge of leveraging semantics beyond lexical matching.
  • NDCG results differ when evaluated on the annotated subset (Within) versus the full corpus (All), underscoring annotation limitations and dataset noise.
  • Inter-annotator agreement on relevance is moderate, indicating subjective judgments due to ambiguity and context in code search tasks.
  • Qualitative observations point to issues such as code quality, query ambiguity, project-specific code, and the importance of context and directional correctness in matching queries to code.

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

論文設計から論文執筆まで、研究時間を劇的に削減しましょう。

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

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