mlsanityData to 14 Oct 2026

Speculative Automated Refactoring of Imperative Deep Learning Programs to Graph Execution

arXiv 2504.05424 ↗First posted 7 Apr 2025cs.SE cs.AI cs.PLcited by 0

Not on the map. Why?

Abstract (arXiv)

Efficiency is essential to support ever-growing datasets, especially for Deep Learning (DL) systems. DL frameworks have traditionally embraced deferred execution-style DL code -- supporting symbolic, graph-based Deep Neural Network (DNN) computation. While scalable, such development is error-prone, non-intuitive, and difficult to debug. Consequently, more natural, imperative DL frameworks encouraging eager execution have emerged but at the expense of run-time performance. Though hybrid approaches aim for the "best of both worlds," using them effectively requires subtle considerations. Our key insight is that, while DL programs typically execute sequentially, hybridizing imperative DL code resembles parallelizing sequential code in traditional systems. Inspired by this, we present an automated refactoring approach that assists developers in determining which otherwise eagerly-executed imperative DL functions could be effectively and efficiently executed as graphs. The approach features novel static imperative tensor and side-effect analyses for Python. Due to its inherent dynamism, analyzing Python may be unsound; however, the conservative approach leverages a speculative (keyword-based) analysis for resolving difficult cases that informs developers of any assumptions made. The approach is: (i) implemented as a plug-in to the PyDev Eclipse IDE that integrates the WALA Ariadne analysis framework and (ii) evaluated on nineteen DL projects consisting of 132 KLOC. The results show that 326 of 766 candidate functions (42.56%) were refactorable, and an average relative speedup of 2.16x on performance tests was observed with negligible differences in model accuracy. The results indicate that the approach is useful in optimizing imperative DL code to its full potential.

Key facts. No citing papers in the map yet (data through 14 Oct 2026). Builds on 27 of its 118 references that are in the map. First posted on arXiv 7 Apr 2025.

Builds on

27 of 118 references.

References · 27

  1. 2014Adam: A Method for Stochastic Optimizationcited by 37,240
  2. 2017Multi-Task Learning Using Uncertainty to Weigh Losses for Scene Geometry and Semanticscited by 1,358
  3. 2015MXNet: A Flexible and Efficient Machine Learning Library for Heterogeneous Distributed Systemscited by 195
  4. 2019Taxonomy of Real Faults in Deep Learning Systemscited by 90
  5. 2019A Comprehensive Study on Deep Learning Bug Characteristicscited by 65
  6. 2018Software Engineering Challenges of Deep Learningcited by 41
  7. 2020Repairing Deep Neural Networks: Fix Patterns and Challengescited by 33
  8. 2019TensorFlow Eager: A Multi-Stage, Python-Embedded DSL for Machine Learningcited by 22
  9. 2021An Empirical Study on Deployment Faults of Deep Learning Based Mobile Applicationscited by 20
  10. 2020A Toolkit for Generating Code Knowledge Graphscited by 17
  11. 2021Decomposing Convolutional Neural Networks into Reusable and Replaceable Modulescited by 14
  12. 2019What Do Developers Ask About ML Libraries? A Large-scale Study Using Stack Overflowcited by 13
15 more
  1. 2021Understanding Performance Problems in Deep Learning Systemscited by 12
  2. 2021LazyTensor: combining eager execution with domain-specific compilerscited by 11
  3. 2021Design Smells in Deep Learning Programs: An Empirical Studycited by 10
  4. 2023The Product Beyond the Model -- An Empirical Study of Repositories of Open-Source ML Productscited by 10
  5. 2018AutoGraph: Imperative-style Coding with Graph-based Performancecited by 9
  6. 2022Scalpel: The Python Static Analysis Frameworkcited by 9
  7. 2021SOAR: A Synthesis Approach for Data Science API Refactoringcited by 8
  8. 2023Reusing Deep Neural Network Models through Model Re-engineeringcited by 6
  9. 2018Ariadne: Analysis for Machine Learning Programcited by 4
  10. 2018From Monolith to Microservices: A Classification of Refactoring Approachescited by 3
  11. 2022Challenges in Migrating Imperative Deep Learning Programs to Graph Execution: An Empirical Studycited by 2
  12. 2022Static Analysis for AWS Best Practices in Python Codecited by 2
  13. 2022Terra: Imperative-Symbolic Co-Execution of Imperative Deep Learning Programscited by 1
  14. 2023Towards Safe Automated Refactoring of Imperative Deep Learning Programs to Graph Executioncited by 1
  15. 2024PoTo: A Hybrid Andersen's Points-to Analysis for Pythoncited by 1

Built on by

Not cited yet.