mlsanityData to 7 Oct 2026

AdaptivePaste: Code Adaptation through Learning Semantics-aware Variable Usage Representations

arXiv 2205.11023 ↗First posted 23 May 2022cs.SE cs.CLcited by 3

Not on the map. Why?

Abstract (arXiv)

In software development, it is common for programmers to copy-paste or port code snippets and then adapt them to their use case. This scenario motivates the code adaptation task -- a variant of program repair which aims to adapt variable identifiers in a pasted snippet of code to the surrounding, preexisting source code. However, no existing approach has been shown to effectively address this task. In this paper, we introduce AdaptivePaste, a learning-based approach to source code adaptation, based on transformers and a dedicated dataflow-aware deobfuscation pre-training task to learn meaningful representations of variable usage patterns. We evaluate AdaptivePaste on a dataset of code snippets in Python. Results suggest that our model can learn to adapt source code with 79.8% accuracy. To evaluate how valuable is AdaptivePaste in practice, we perform a user study with 10 Python developers on a hundred real-world copy-paste instances. The results show that AdaptivePaste reduces the dwell time to nearly half the time it takes for manual code adaptation, and helps to avoid bugs. In addition, we utilize the participant feedback to identify potential avenues for improvement of AdaptivePaste.

Key facts. Cited by 3 papers in the map (data through 7 Oct 2026). Builds on 24 of its 38 references that are in the map. First posted on arXiv 23 May 2022.

Builds on

24 of 38 references.

References · 24

  1. 2017Attention Is All You Needcited by 59,932
  2. 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
  3. 2019RoBERTa: A Robustly Optimized BERT Pretraining Approachcited by 13,266
  4. 2021Evaluating Large Language Models Trained on Codecited by 8,053
  5. 2019BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehensioncited by 5,874
  6. 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,286
  7. 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 890
  8. 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 732
  9. 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 600
  10. 2020IntelliCode Compose: Code Generation Using Transformercited by 225
  11. 2017Learning to Represent Programs with Graphscited by 219
  12. 2020PyMT5: multi-mode translation of natural language and Python code with transformerscited by 80
12 more
  1. 2021DOBF: A Deobfuscation Pre-Training Objective for Programming Languagescited by 68
  2. 2018DeepBugs: A Learning Approach to Name-based Bug Detectioncited by 65
  3. 2021Self-Supervised Bug Detection and Repaircited by 59
  4. 2015SourcererCC: Scaling Code Clone Detection to Big Codecited by 40
  5. 2019Neural Program Repair by Jointly Learning to Localize and Repaircited by 39
  6. 2020Generating Accurate Assert Statements for Unit Test Cases using Pretrained Transformerscited by 30
  7. 2014Learning Natural Coding Conventionscited by 28
  8. 2018A General Path-Based Representation for Predicting Program Propertiescited by 28
  9. 2021Learning to Complete Code with Sketchescited by 23
  10. 2021Long-Range Modeling of Source Code Files with eWASH: Extended Window Access by Syntax Hierarchycited by 14
  11. 2018Context2Name: A Deep Learning-Based Approach to Infer Natural Variable Names from Usage Contextscited by 11
  12. 2017SmartPaste: Learning to Adapt Source Codecited by 8

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2023: 2; 2024: 0; 2025: 0; 2026: 1.

3 papers.