PreprintCited by 13Software Engineering ResearchSoftware Testing and Debugging TechniquesTeaching and Learning Programming

SmartPaste: Learning to Adapt Source Code

Open access
Allamanis, Miltiadis, Brockschmidt, Marc·2017·arXiv

Abstract

Deep Neural Networks have been shown to succeed at a range of natural language tasks such as machine translation and text summarization. While tasks on source code (ie, formal languages) have been considered recently, most work in this area does not attempt to capitalize on the unique opportunities offered by its known syntax and structure. In this work, we introduce SmartPaste, a first task that requires to use such information. The task is a variant of the program repair problem that requires to adapt a given (pasted) snippet of code to surrounding, existing source code. As first solutions, we design a set of deep neural models that learn to represent the context of each variable location and variable usage in a data flow-sensitive way. Our evaluation suggests that our models can learn to solve the SmartPaste task in many cases, achieving 58.6% accuracy, while learning meaningful representation of variable usages.

Integrity signals

Registry

DataCite · 10.48550/arxiv.1705.07867

Cites

14 of 14 references verified0 citation errors · 0 not checkable

Statistics

Recomputing p-values needs the paper’s full text.

Claims the paper makes

We couldn’t retrieve this paper’s full text, so its claims and self-check weren’t run. The registry and citation checks still apply.

Claims other papers make about this one

Each is checked against this paper’s own text: does it say what the citing paper says it does?

  • Code completion models are typically trained on data collected from existing codebases but then deployed more generally across other codebases, which may have different distributions of API usages.

    “These models are typically trained on data collected from existing codebases but then deployed more generally across other codebases, which may have different distributions of API usages (Nita and Notkin, 2010; Proksch et al., 2016; Allamanis and Brockschmidt, 2017).”

    From WILDS: A Benchmark of in-the-Wild Distribution Shifts (2020) · cites this paper as Allamanis and Brockschmidt, 2017

  • Distribution shifts across codebases require systems to adapt to factors such as project content, coding conventions, or library/API usage.

    “One major challenge is the shifts across codebases (which our Py150-wilds dataset focuses on), where systems need to adapt to factors such as project content, coding conventions, or library or API usage in each codebase (Nita and Notkin, 2010; Allamanis and Brockschmidt, 2017).”

    From WILDS: A Benchmark of in-the-Wild Distribution Shifts (2020) · cites this paper as Allamanis and Brockschmidt, 2017

  • As programming tools like code completion are expected to be used across codebases in real applications, it is important for models to learn generalizable representations of code and extrapolate well on unseen codebases.

    “As programming tools like code completion are expected to be used across codebases in real applications (Nita and Notkin, 2010; Allamanis and Brockschmidt, 2017), it is important for models to learn generalizable representations of code and extrapolate well on unseen codebases.”

    From WILDS: A Benchmark of in-the-Wild Distribution Shifts (2020) · cites this paper as Allamanis and Brockschmidt, 2017

Cites

Flagged first, then by citations

2 of the 16 references couldn’t be matched to a known paper.

Cited by

Sorted by citations

Authors
Allamanis, M., & Brockschmidt, M.
Venue
arXiv
Publisher
arXiv
Published
2017
ISSN
2331-8422 (ISSN-L)
OpenAlex
W2616956063
Cited by
13
References
16
Citations by year
2024: 1 · 2023: 2 · 2021: 3 · 2020: 1 · 2019: 2 · 2018: 3 · 2017: 1
Type
posted content
Language
en
Open access
Locations
  • arXiv (Cornell University) (submittedVersion)
  • arXiv (Cornell University)
Topics
  • Physical Sciences › Computer Science › Information Systems › Software Engineering Research
  • Physical Sciences › Computer Science › Software › Software Testing and Debugging Techniques
  • Physical Sciences › Computer Science › Computer Science Applications › Teaching and Learning Programming
Keywords
program adaptation, program repair, data flow analysis

About these checks

Registry, retraction, Cites and statistics results are computed, not judged, with one exception: a printed reference that no index lists is read once by a model before it counts as a citation error. Claims are extracted by a model and kept only when their quote appears verbatim in the text; each cited source is then checked, with a model’s help, for whether it says what the claim relies on. Those verdicts can be wrong — read the claim’s quote and the cited source before relying on one.

Statistics and arithmetic are recomputed, not judged.

Confidence bands are shown only for fields calibrated on our annotated test set. None is calibrated yet, so no band is shown.

What counts as a claim ›How we measure confidence ›How we check this ›

Are you an author, or do you see a problem with this page? Request a review