PYEVOLVE: Automating Frequent Code Changes in Python ML Systems
Malinda Dilhara, Danny Dig, Ameya Ketkar
Abstract
Because of the naturalness of software and the rapid evolution of Machine Learning (ML) techniques, frequently repeated code change patterns (CPATs) occur often. They range from simple API migrations to changes involving several complex control structures such as for loops. While manually performing CPATs is tedious, the current state-of-the-art techniques for inferring transformation rules are not advanced enough to handle unseen variants of complex CPATs, resulting in a low recall rate. In this paper we present a novel, automated workflow that mines CPATs, infers the transformation rules, and then transplants them automatically to new target sites. We designed, implemented, evaluated and released this in a tool, PYEVOLVE. At its core is a novel data-flow, control-flow aware transformation rule inference engine. Our technique allows us to advance the state-of-the-art for transformation-by-example tools; without it, 70% of the code changes that PYEVOLVE transforms would not be possible to automate. Our thorough empirical evaluation of over 40,000 transformations shows 97% precision and 94% recall. By accepting 90% of CPATs generated by PYEVOLVE in famous open-source projects, developers confirmed its changes are useful.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext 43785dd1-a063-468e-94c4-9ec10b9ca737Cited by top-tier papers11
- Unprecedented Code Change Automation: The Fusion of LLMs and Transformation by ExampleMalinda Dilhara, Abhiram Bellur, Timofey Bryksin, Danny DigFSE 2024 · 18 citations
- Refactoring to Pythonic Idioms: A Hybrid Knowledge-Driven Approach Leveraging Large Language ModelsZejun Zhang, Zhenchang Xing, Xiaoxue Ren, Qinghua Lu et al.FSE 2024 · 11 citations
- MELT: Mining Effective Lightweight Transformations from Pull RequestsDaniel Ramos, Hailie Mitchell, Inês Lynce, Vasco Manquinho et al.ASE 2023 · 6 citations
- MigGPT: Harnessing Large Language Models for Automated Migration of Out-of-Tree Linux Kernel Patches Across VersionsPucheng Dang, Di Huang, Dong Li, Kang Chen et al.NeurIPS 2025 · 3 citations
- Automated Deep Learning Optimization via DSL-Based Source Code TransformationRuixin Wang, Minghai Lu, Cody Hao Yu, Yi-Hsiang Lai et al.ISSTA 2024 · 1 citation
Builds on8
- An empirical study on program failures of deep learning jobsRu Zhang, Wencong Xiao, Hongyu Zhang, Yu Liu et al.ICSE 2020 · 96 citations
- An Empirical Study of Refactorings and Technical Debt in Machine Learning SystemsYiming Tang, Raffi Khatchadourian, Mehdi Bagherzadeh, Rhia Singh et al.ICSE 2021 · 60 citations
- PyNose: A Test Smell Detector For PythonTongjie Wang, Yaroslav Golubev, Oleg Smirnov, Jiawei Li et al.ASE 2021 · 44 citations
- Making Python code idiomatic by automatic refactoring non-idiomatic Python code with pythonic idiomsZejun Zhang, Zhenchang Xing, Xin Xia, Xiwei Xu et al.FSE 2022 · 35 citations
- Discovering Repetitive Code Changes in Python ML SystemsMalinda Dilhara, Ameya Ketkar, Nikhith Sannidhi, Danny DigICSE 2022 · 30 citations
Related papers
- Inferring and Applying Type ChangesAmeya Ketkar, Oleg Smirnov, Nikolaos Tsantalis, Danny Dig et al.ICSE 2022 · 17 citations
- SPINFER: Inferring Semantic Patches for the Linux KernelLucas Serrano, Van-Anh Nguyen, Ferdian Thung, Lingxiao Jiang et al.USENIX ATC 2020 · 16 citations
- APP-Miner: Detecting API Misuses via Automatically Mining API Path PatternsJiasheng Jiang, Jingzheng Wu, Xiang Ling, Tianyue Luo et al.S&P 2024 · 8 citations
- reCode : A Lightweight Find-and-Replace Interaction in the IDE for Transforming Code by ExampleWode Ni, Joshua Sunshine, Vu Le, Sumit Gulwani et al.UIST 2021 · 15 citations
- DyLin: A Dynamic Linter for PythonAryaz Eghbali, Felix Burk, Michael PradelFSE 2025 · 1 citation
