CodeQueries: A Dataset of Semantic Queries over Code

Surya Prakash Sahu, Madhurima Mandal, Shikhar Bharadwaj, Aditya Kanade, Petros Maniatis +1 more
9/17/2022
cs.SEcs.CL
benchmark-dataset

Official code: spsahu-dev/codequeries-benchmark (13 stars, Python, Apache-2.0, last commit 2024-04-21).

Abstract

Developers often have questions about semantic aspects of code they are working on, e.g., "Is there a class whose parent classes declare a conflicting attribute?". Answering them requires understanding code semantics such as attributes and inheritance relation of classes.

Show full abstract

An answer to such a question should identify code spans constituting the answer (e.g., the declaration of the subclass) as well as supporting facts (e.g., the definitions of the conflicting attributes). The existing work on question-answering over code has considered yes/no questions or method-level context. We contribute a labeled dataset, called CodeQueries, of semantic queries over Python code. Compared to the existing datasets, in CodeQueries, the queries are about code semantics, the context is file level and the answers are code spans. We curate the dataset based on queries supported by a widely-used static analysis tool, CodeQL, and include both positive and negative examples, and queries requiring single-hop and multi-hop reasoning. To assess the value of our dataset, we evaluate baseline neural approaches. We study a large language model (GPT3.5-Turbo) in zero-shot and few-shot settings on a subset of CodeQueries. We also evaluate a BERT style model (CuBERT) with fine-tuning. We find that these models achieve limited success on CodeQueries. CodeQueries is thus a challenging dataset to test the ability of neural models, to understand code semantics, in the extractive question-answering setting.

View on arXivView PDF

Code Implementations(1)

Apache-2.0

Repository of the paper 'CodeQueries: A Dataset of Semantic Queries over Code' published in ISEC 2024

133Python, Jupyter NotebookSep 9, 20222 years agoApache-2.0

Similar Papers

Cite this paper

@article{sahu2022codequeries,
  title  = {CodeQueries: A Dataset of Semantic Queries over Code},
  author = {Surya Prakash Sahu and Madhurima Mandal and Shikhar Bharadwaj and Aditya Kanade and Petros Maniatis and Shirish Shevade},
  year   = {2022},
  eprint = {2209.08372},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2209.08372}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2209.08372.svg)](https://codeofpaper.com/paper/2209.08372)

Discussion