Skip to main content
QUICK REVIEW

[Paper Review] COSET: A Benchmark for Evaluating Neural Program Embeddings

Ke Wang, Mihai Christodorescu|arXiv (Cornell University)|May 27, 2019
Software Engineering ResearchComputer Science20 references23 citations
TL;DR

This paper introduces CoSet, a benchmark framework for evaluating neural program embeddings by combining a diverse dataset of 85,000 source-code programs with semantics-preserving program transformations. It enables standardized evaluation of model accuracy and stability, revealing that DyPro outperforms other models in semantic understanding, while static models like TreeLSTM and APNN are more sensitive to syntactic variations despite lower accuracy.

ABSTRACT

Neural program embedding can be helpful in analyzing large software, a task that is challenging for traditional logic-based program analyses due to their limited scalability. A key focus of recent machine-learning advances in this area is on modeling program semantics instead of just syntax. Unfortunately evaluating such advances is not obvious, as program semantics does not lend itself to straightforward metrics. In this paper, we introduce a benchmarking framework called COSET for standardizing the evaluation of neural program embeddings. COSET consists of a diverse dataset of programs in source-code format, labeled by human experts according to a number of program properties of interest. A point of novelty is a suite of program transformations included in COSET. These transformations when applied to the base dataset can simulate natural changes to program code due to optimization and refactoring and can serve as a "debugging" tool for classification mistakes. We conducted a pilot study on four prominent models: TreeLSTM, gated graph neural network (GGNN), AST-Path neural network (APNN), and DYPRO. We found that COSET is useful in identifying the strengths and limitations of each model and in pinpointing specific syntactic and semantic characteristics of programs that pose challenges.

Motivation & Objective

  • To standardize the evaluation of neural program embeddings, which currently lack consistent benchmarks for semantic understanding.
  • To address the challenge of measuring how well models capture program semantics beyond syntax, especially given the absence of universal metrics.
  • To provide a debugging tool for identifying specific program characteristics that cause model misclassification.
  • To evaluate model stability under common code transformations such as refactoring and optimization.
  • To compare state-of-the-art models in terms of accuracy, robustness, and generalization across semantic and syntactic variations.

Proposed method

  • CoSet constructs a dataset of 85,000 source-code programs from diverse programmers solving ten well-defined coding problems, each labeled with semantic properties like running time, pre/post-conditions, and loop invariants.
  • The framework includes a suite of 15 standard program transformations—such as variable renaming, loop restructuring, and control-flow reordering—that preserve program semantics while altering syntax.
  • Models are evaluated on a classification task using labeled program properties, with performance measured via prediction accuracy and stability under transformations.
  • Stability is quantified by measuring the percentage of predictions that change when transformations are applied to the same program.
  • The framework supports delta debugging by applying transformations iteratively to isolate the source of misclassification in model predictions.
  • A pilot study evaluates four models—TreeLSTM, GGNN, APNN, and DyPro—on both accuracy and transformation robustness using the CoSet dataset and transformation suite.

Experimental results

Research questions

  • RQ1How accurately can neural program embeddings capture program semantics compared to syntax-only models?
  • RQ2How stable are different neural program embedding models under semantics-preserving code transformations such as refactoring and optimization?
  • RQ3Which program characteristics—such as variable types, logging statements, or API usage—most commonly lead to model misclassification?
  • RQ4How do dynamic models (e.g., DyPro) compare to static models (e.g., TreeLSTM, GGNN, APNN) in semantic understanding and robustness to syntactic changes?
  • RQ5Can the CoSet framework effectively isolate the root causes of model failures through systematic transformation analysis?

Key findings

  • DyPro achieved the highest accuracy in semantic prediction, with 0.0% prediction change under all semantics-preserving transformations, indicating superior stability and semantic understanding.
  • TreeLSTM showed the highest stability among static models, with only 7.2% of predictions changing under transformations, while APNN was the most sensitive, with up to 27.7% prediction changes.
  • GGNN and APNN, relying on static features, achieved lower accuracy but scaled better to long-running or complex programs, unlike DyPro, which struggled with very large programs.
  • The framework successfully identified model weaknesses, including poor handling of variable types, confusion around logging statements, and limited representation of API semantics.
  • CoSet’s transformation suite enabled effective debugging: for example, it revealed that renaming variables or reordering loops often misled static models despite preserved semantics.
  • Overall, CoSet demonstrated its ability to distinguish model strengths and weaknesses, providing a consistent, reproducible benchmark for future neural program embedding research.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.