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

Towards Safe Automated Refactoring of Imperative Deep Learning Programs to Graph Execution (2308.11785v2)

Published 22 Aug 2023 in cs.SE and cs.PL

Abstract: Efficiency is essential to support responsiveness w.r.t. 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 tends to produce code that is error-prone, non-intuitive, and difficult to debug. Consequently, more natural, less error-prone imperative DL frameworks encouraging eager execution have emerged at the expense of run-time performance. Though hybrid approaches aim for the "best of both worlds," using them effectively requires subtle considerations to make code amenable to safe, accurate, and efficient graph execution -- avoiding performance bottlenecks and semantically inequivalent results. We present our ongoing work on an automated refactoring approach that assists developers in specifying whether and how their otherwise eagerly-executed imperative DL code could be reliably and efficiently executed as graphs at run-time in a semantics-preserving fashion. The approach, based on a novel tensor analysis specifically for imperative DL code, consists of refactoring preconditions for automatically determining when it is safe and potentially advantageous to migrate imperative DL code to graph execution and modifying decorator parameters or eagerly executing code already running as graphs. The approach is being implemented as a PyDev Eclipse IDE plug-in and uses the WALA Ariadne analysis framework. We discuss our ongoing work towards optimizing imperative DL code to its full potential.

Definition Search Book Streamline Icon: https://streamlinehq.com
References (32)
  1. “HARP: Holistic Analysis for Refactoring Python-Based Analytics Programs” In International Conference on Software Engineering, 2020, pp. 506–517 DOI: 10.1145/3377811.3380434
  2. Google LLC “Migrate your TensorFlow 1 code to TensorFlow 2”, 2021 URL: https://tensorflow.org/guide/migrate#automatic_conversion_script
  3. “MXNet: A Flexible and Efficient Machine Learning Library for Heterogeneous Distributed Systems” In Workshop on Machine Learning Systems at NIPS, 2015 arXiv:1512.01274 [cs.DC]
  4. “An Empirical Study on TensorFlow Program Bugs” In International Symposium on Software Testing and Analysis, 2018 DOI: 10.1145/3213846.3213866
  5. “A comprehensive study on Deep Learning bug characteristics” In Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering, 2019 DOI: 10.1145/3338906.3338955
  6. “What Do Developers Ask About ML Libraries? A Large-scale Study Using Stack Overflow”, 2019 arXiv:1906.11940 [cs.SE]
  7. “An Empirical Study of Common Challenges in Developing Deep Learning Applications” In International Symposium on Software Reliability Engineering, 2019 DOI: 10.1109/ISSRE.2019.00020
  8. “TensorFlow Eager: A Multi-Stage, Python-Embedded DSL for Machine Learning”, 2019 arXiv:1903.01855 [cs.PL]
  9. “PyTorch: An Imperative Style, High-Performance Deep Learning Library”, 2019 arXiv:1912.01703 [cs.LG]
  10. François Chollet “Deep Learning with Python” Manning, 2020
  11. “AutoGraph: Imperative-style Coding with Graph-based Performance”, 2019 arXiv:1810.08061 [cs.PL]
  12. Facebook Inc. “PyTorch Documentation”, 2019 URL: https://pytorch.org/docs/stable/jit.html
  13. “Speculative Symbolic Graph Execution of Imperative Deep Learning Programs” In SIGOPS Oper. Syst. Rev. 53.1, 2019, pp. 26–33 DOI: 10.1145/3352020.3352025
  14. Google LLC “Introduction to graphs and tf.function”, 2022 URL: https://tensorflow.org/guide/intro_to_graphs
  15. Apache “Hybridize”, 2021 URL: https://mxnet.apache.org/versions/1.8.0/api/python/docs/tutorials/packages/gluon/blocks/hybridize.html
  16. “TensorFlow: A System for Large-Scale Machine Learning” In Symposium on Operating Systems Design and Implementation, 2016
  17. Google LLC “Better performance with tf.function”, 2021 URL: https://tensorflow.org/guide/function
  18. “Challenges in Migrating Imperative Deep Learning Programs to Graph Execution: An Empirical Study” In International Conference on Mining Software Repositories, MSR ’22 ACM, 2022 ACM/IEEE DOI: 10.1145/3524842.3528455
  19. “Characterizing Performance Bugs in Deep Learning Systems”, 2021 arXiv:2112.01771 [cs.SE]
  20. Danny Dig, John Marrero and Michael D. Ernst “Refactoring sequential Java code for concurrency via concurrent libraries” In International Conference on Software Engineering, 2009, pp. 397–407 IEEE DOI: 10.1109/ICSE.2009.5070539
  21. OpenAI, Inc. “ChatGPT”, 2023 URL: https://chat.openai.com
  22. “Discovering Repetitive Code Changes in Python ML Systems” To appear. In International Conference on Software Engineering, ICSE ’22, 2022
  23. “A Comparative Study of Manual and Automated Refactorings” In European Conference on Object-Oriented Programming Berlin, Heidelberg: Springer Berlin Heidelberg, 2013, pp. 552–576
  24. Miryung Kim, Thomas Zimmermann and Nachiappan Nagappan “A Field Study of Refactoring Challenges and Benefits” In Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering, FSE ’12 Cary, North Carolina: ACM, 2012 DOI: 10.1145/2393596.2393655
  25. Fabio Zadrozny “PyDev”, 2023 URL: https://www.pydev.org
  26. “Ariadne: Analysis for Machine Learning Programs” In International Workshop on Machine Learning and Programming Languages, MAPL 2018 Philadelphia, PA, USA: Association for Computing Machinery, 2018, pp. 1–10 ACM SIGPLAN DOI: 10.1145/3211346.3211349
  27. Raffi Khatchadourian “graph_execution_time_comparison.ipynb”, 2021 URL: https://bit.ly/3bwrhVt
  28. Google LLC “Better performance with tf.function”, 2021 TensorFlow URL: https://www.tensorflow.org/guide/function#controlling_retracing
  29. Malinda Dilhara, Ameya Ketkar and Danny Dig “Understanding Software-2.0: A Study of Machine Learning Library Usage and Evolution” In ACM Transactions on Software Engineering and Methodology New York, NY, USA: Association for Computing Machinery, 2021 DOI: 10.1145/3453478
  30. “Repairing Deep Neural Networks: Fix Patterns and Challenges” In International Conference on Software Engineering, 2020 DOI: 10.1145/3377811.3380378
  31. “Unveiling the Mystery of API Evolution in Deep Learning Frameworks: A Case Study of TensorFlow 2” In International Conference on Software Engineering, ICSE-SEIP, 2021 DOI: 10.1109/ICSE-SEIP52600.2021.00033
  32. “Safe Automated Refactoring for Intelligent Parallelization of Java 8 Streams” In International Conference on Software Engineering, ICSE ’19 IEEE Press, 2019, pp. 619–630 DOI: 10.1109/ICSE.2019.00072

Summary

We haven't generated a summary for this paper yet.