[Paper Review] The CodRep Machine Learning on Source Code Competition
The CodRep competition introduces a novel machine learning challenge focused on predicting the correct insertion line number for code replacements in source files. Using five curated datasets of one-liner commits from open-source projects (totaling 58,069 tasks), it enables researchers and practitioners to train models on real-world code evolution with a differentiable, bounded loss function based on hyperbolic tangent of absolute line difference.
CodRep is a machine learning competition on source code data. It is carefully designed so that anybody can enter the competition, whether professional researchers, students or independent scholars, without specific knowledge in machine learning or program analysis. In particular, it aims at being a common playground on which the machine learning and the software engineering research communities can interact. The competition has started on April 14th 2018 and has ended on October 14th 2018. The CodRep data is hosted at https://github.com/KTH/CodRep-competition/.
Motivation & Objective
- To create a shared benchmark for machine learning on source code that is accessible to researchers, students, and independent scholars without requiring deep expertise in ML or program analysis.
- To foster collaboration between the machine learning and software engineering communities through a common, publicly available dataset of real code changes.
- To provide a standardized problem setting for predicting insertion locations of code lines in source files, focusing on replacement operations.
- To collect and curate a large-scale dataset of one-liner commits from academic studies, ensuring data quality and reproducibility.
- To design a robust, differentiable loss function that reflects real-world insensitivity to small line number errors in code replacement tasks.
Proposed method
- The competition tasks involve predicting the target line number in a source file where a given code line should be inserted as a replacement.
- Input data consists of pairs: (code line to insert, full source file), formatted in text files with the line on the first line and the file content on the second.
- Training labels are provided in separate solution files, with correct line numbers for each task.
- The dataset is constructed from real commits in open-source projects that were previously studied in academic literature, ensuring relevance and reproducibility.
- Data filtering excludes comment-only changes, empty lines, and multi-line replacements, retaining only single-line replacement commits in Java files.
- A custom loss function is used: tanh(|correct line − predicted line|), which bounds the error, is symmetric, continuous, and differentiable (except at 0), and penalizes large errors logarithmically.
Experimental results
Research questions
- RQ1How accurately can machine learning models predict the correct insertion line number for code replacements in real source code files?
- RQ2To what extent do different model architectures generalize across diverse open-source projects with varying code styles and structures?
- RQ3How effective is a differentiable, bounded loss function in guiding model training for code insertion prediction tasks?
- RQ4Can a shared, curated dataset of one-liner commits from real projects serve as a reliable benchmark for code evolution and code generation research?
- RQ5What is the impact of data provenance and filtering criteria on the quality and utility of code change prediction datasets?
Key findings
- The CodRep competition provides the largest known dataset of one-liner commits, totaling 58,069 prediction tasks across five curated datasets from academic projects.
- The dataset is composed of real, filtered commits from open-source projects, with 4394 tasks in Dataset1 and 18,366 in Dataset5, ensuring high relevance and reproducibility.
- The loss function tanh(|correct − predicted|) ensures bounded, symmetric, and differentiable error measurement, with minimal penalty for near-perfect predictions.
- Dataset5 was used as the hidden test set for final ranking, ensuring integrity and preventing overfitting to public data.
- The competition framework enables broad participation from diverse research communities, including students and independent scholars, without requiring specialized ML or program analysis knowledge.
- The curated data is publicly available at https://github.com/KTH/CodRep-competition/, supporting future empirical studies and model training beyond the competition.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.