Papers
Topics
Authors
Recent
Gemini 2.5 Flash
Gemini 2.5 Flash
38 tokens/sec
GPT-4o
59 tokens/sec
Gemini 2.5 Pro Pro
41 tokens/sec
o3 Pro
7 tokens/sec
GPT-4.1 Pro
50 tokens/sec
DeepSeek R1 via Azure Pro
28 tokens/sec
2000 character limit reached

Coeditor: Leveraging Contextual Changes for Multi-round Code Auto-editing (2305.18584v2)

Published 29 May 2023 in cs.SE, cs.LG, and cs.PL

Abstract: Developers often dedicate significant time to maintaining and refactoring existing code. However, most prior work on generative models for code focuses solely on creating new code, overlooking the distinctive needs of editing existing code. In this work, we explore a multi-round code auto-editing setting, aiming to predict edits to a code region based on recent changes within the same codebase. Our model, Coeditor, is a fine-tuned LLM specifically designed for code editing tasks. We represent code changes using a line diff format and employ static analysis to form large customized model contexts, ensuring the availability of appropriate information for prediction. We collect a code editing dataset from the commit histories of 1650 open-source Python projects for training and evaluation. In a simplified single-round, single-edit task, Coeditor significantly outperforms GPT-3.5 and SOTA open-source code completion models (bringing exact-match accuracy from 34.7 up to 60.4), demonstrating the benefits of incorporating editing history for code completion. In a multi-round, multi-edit setting, we observe substantial gains by iteratively conditioning on additional user edits. We have open-sourced our code, data, and model weights to encourage future research and have released a VSCode extension powered by our model for interactive IDE usage.

Definition Search Book Streamline Icon: https://streamlinehq.com
References (33)
  1. CM3: A Causal Masked Multimodal Model of the Internet. arXiv eprint arxiv:2201.07520, 2022.
  2. Unified pre-training for program understanding and generation. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp.  2655–2668, 2021.
  3. Santacoder: don’t reach for the stars! arXiv preprint arXiv:2301.03988, 2023.
  4. Longformer: The Long-Document Transformer. arXiv preprint arXiv:2004.05150, 2020.
  5. A structural model for contextual code changes. Proceedings of the ACM on Programming Languages, 4(OOPSLA):1–28, November 2020. ISSN 2475-1421. doi: 10.1145/3428283. URL https://dl.acm.org/doi/10.1145/3428283.
  6. CODIT: Code Editing with Tree-Based Neural Models. IEEE Transactions on Software Engineering, pp.  1–1, 2020. ISSN 0098-5589, 1939-3520, 2326-3881. doi: 10.1109/TSE.2020.3020502. URL http://arxiv.org/abs/1810.00314. arXiv: 1810.00314.
  7. Evaluating large language models trained on code. arXiv preprint arXiv:2107.03374, 2021.
  8. CodeBERT: A Pre-Trained Model for Programming and Natural Languages. In Findings of the Association for Computational Linguistics: EMNLP 2020, pp.  1536–1547, 2020.
  9. Incoder: A generative model for code infilling and synthesis. arXiv preprint arXiv:2204.05999, 2022.
  10. Learning to complete code with sketches. In International Conference on Learning Representations, 2021.
  11. Leveraging passage retrieval with generative models for open domain question answering. In Proceedings of the 16th Conference of the European Chapter of the Association for Computational Linguistics: Main Volume, pp. 874–880, Online, April 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.eacl-main.74. URL https://aclanthology.org/2021.eacl-main.74.
  12. Learning to predict user-defined types. IEEE Transactions on Software Engineering, 2022.
  13. Unsupervised translation of programming languages. ArXiv, abs/2006.03511, 2020.
  14. An empirical evaluation of the “cognitive complexity” measure as a predictor of code understandability. Journal of Systems and Software, 197:111561, 2023.
  15. Starcoder: may the source be with you! arXiv preprint arXiv:2305.06161, 2023.
  16. Competition-level code generation with alphacode. arXiv preprint arXiv:2203.07814, 2022.
  17. An empirical evaluation of GitHub copilot’s code suggestions. In Proceedings of the 19th International Conference on Mining Software Repositories, pp.  1–5, 2022.
  18. SOAR: A Synthesis Approach for Data Science API Refactoring. In 2021 IEEE/ACM 43rd International Conference on Software Engineering (ICSE), pp.  112–124, Madrid, ES, May 2021. IEEE. ISBN 978-1-66540-296-5. doi: 10.1109/ICSE43902.2021.00023. URL https://ieeexplore.ieee.org/document/9402016/.
  19. A conversational paradigm for program synthesis. arXiv e-prints, pp.  arXiv–2203, 2022.
  20. Copy that! Editing Sequences by Copying Spans, December 2020a. URL http://arxiv.org/abs/2006.04771. arXiv:2006.04771 [cs, stat].
  21. Learning to update natural language comments based on code changes. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp.  1853–1868, 2020b.
  22. Learning to describe solutions for bug reports based on developer discussions. Findings of the Association for Computational Linguistics: ACL 2022, 2022.
  23. Typewriter: Neural type prediction with search-based validation. In Proceedings of the 28th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering, pp.  209–220, 2020.
  24. Learning to Model Editing Processes, May 2022. URL http://arxiv.org/abs/2205.12374. arXiv:2205.12374 [cs].
  25. Fast and memory-efficient neural code completion. In 2021 IEEE/ACM 18th International Conference on Mining Software Repositories (MSR), pp.  329–340. IEEE, 2021.
  26. Code translation with compiler representations. ArXiv, abs/2207.03578, 2022.
  27. Towards automating code review activities. In 2021 IEEE/ACM 43rd International Conference on Software Engineering (ICSE), pp.  163–174. IEEE, 2021.
  28. CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generation. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pp.  8696–8708, 2021.
  29. LambdaNet: Probabilistic Type Inference using Graph Neural Networks. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id=Hkx6hANtwH.
  30. TypeT5: Seq2seq Type Inference using Static Analysis. In International Conference on Learning Representations, 2023. URL https://openreview.net/forum?id=4TyNEhI2GdN.
  31. Big Bird: Transformers for Longer Sequences. In Advances in Neural Information Processing Systems, 2020.
  32. Repocoder: Repository-level code completion through iterative retrieval and generation. arXiv preprint arXiv:2303.12570, 2023.
  33. CoditT5: Pretraining for Source Code and Natural Language Editing, September 2022. URL http://arxiv.org/abs/2208.05446. arXiv:2208.05446 [cs].
User Edit Pencil Streamline Icon: https://streamlinehq.com
Authors (3)
  1. Jiayi Wei (10 papers)
  2. Greg Durrett (117 papers)
  3. Isil Dillig (57 papers)
Citations (8)
X Twitter Logo Streamline Icon: https://streamlinehq.com