Conference paper Open Access

# A Structural Model for Contextual Code Changes

Brody, Shaked; Alon, Uri; Yahav, Eran

### Dublin Core Export

<?xml version='1.0' encoding='utf-8'?>
<oai_dc:dc xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
<dc:creator>Brody, Shaked</dc:creator>
<dc:creator>Alon, Uri</dc:creator>
<dc:creator>Yahav, Eran</dc:creator>
<dc:date>2020-09-18</dc:date>
<dc:description>We address the problem of predicting edit completions based on a learned model that was trained on past edits.
Given a code snippet that is partially edited, our goal is to predict a completion of the edit for the rest of the
snippet. We refer to this task as the EditCompletion task and present a novel approach for tackling it. The
main idea is to directly represent structural edits. This allows us to model the likelihood of the edit itself, rather
than learning the likelihood of the edited code. We represent an edit operation as a path in the program’s Abstract
Syntax Tree (AST), originating from the source of the edit to the target of the edit. Using this representation, we
present a powerful and lightweight neural model for the EditCompletion task.

We conduct a thorough evaluation, comparing our approach to a variety of representation and modeling
approaches that are driven by multiple strong models such as LSTMs, Transformers, and neural CRFs. Our
experiments show that our model achieves 28% relative gain over state-of-the-art sequential models and 2×
higher accuracy than syntactic models that learn to generate the edited code instead of modeling the edits
directly. We make our code, dataset, and trained models publicly available.</dc:description>
<dc:identifier>https://zenodo.org/record/4036303</dc:identifier>
<dc:identifier>10.5281/zenodo.4036303</dc:identifier>
<dc:identifier>oai:zenodo.org:4036303</dc:identifier>
<dc:relation>doi:10.5281/zenodo.4036302</dc:relation>
<dc:rights>info:eu-repo/semantics/openAccess</dc:rights>
<dc:subject>Programming Languages</dc:subject>
<dc:subject>Machine Learning</dc:subject>
<dc:title>A Structural Model for Contextual Code Changes</dc:title>
<dc:type>info:eu-repo/semantics/conferencePaper</dc:type>
<dc:type>publication-conferencepaper</dc:type>
</oai_dc:dc>

73
16
views