# Unraveling Code Clone Dynamics in Deep Learning Frameworks

arXiv: https://arxiv.org/abs/2404.17046 · HTML: https://mlsanity.com/paper/2404.17046/

## Key facts

- Cited by 2 papers in the map (data through 14 Oct 2026).
- Builds on 19 of its 98 references that are in the map.
- First posted on arXiv 25 Apr 2024.

## Builds on (most cited first, 19 of 19)

- [Taxonomy of Real Faults in Deep Learning Systems](https://mlsanity.com/paper/1910.11015/) (2019)
- [A Comprehensive Study on Deep Learning Bug Characteristics](https://mlsanity.com/paper/1906.01388/) (2019)
- [SourcererCC: Scaling Code Clone Detection to Big Code](https://mlsanity.com/paper/1512.06448/) (2015)
- [Repairing Deep Neural Networks: Fix Patterns and Challenges](https://mlsanity.com/paper/2005.00972/) (2020)
- [Toward Understanding Deep Learning Framework Bugs](https://mlsanity.com/paper/2203.04026/) (2022)
- [Silent Bugs in Deep Learning Frameworks: An Empirical Study of Keras and TensorFlow](https://mlsanity.com/paper/2112.13314/) (2021)
- [A systematic literature review on source code similarity measurement and clone detection: techniques, applications, and challenges](https://mlsanity.com/paper/2306.16171/) (2023)
- [On Reporting Performance and Accuracy Bugs for Deep Learning Frameworks: An Exploratory Study from GitHub](https://mlsanity.com/paper/2204.07893/) (2022)
- [Automatic Clone Recommendation for Refactoring Based on the Present and the Past](https://mlsanity.com/paper/1807.11184/) (2018)
- [Clones in Deep Learning Code: What, Where, and Why?](https://mlsanity.com/paper/2107.13614/) (2021)
- [Common Challenges of Deep Reinforcement Learning Applications Development: An Empirical Study](https://mlsanity.com/paper/2310.09575/) (2023)
- [Using a Nearest-Neighbour, BERT-Based Approach for Scalable Clone Detection](https://mlsanity.com/paper/2309.02182/) (2023)
- [An Exploratory Study on the Introduction and Removal of Different Types of Technical Debt](https://mlsanity.com/paper/2101.03730/) (2021)
- [On the Relationship of Inconsistent Software Clones and Faults: An Empirical Study](https://mlsanity.com/paper/1611.08005/) (2016)
- [Clone Detection on Large Scala Codebases](https://mlsanity.com/paper/2204.04247/) (2022)
- [Scripted GUI Testing of Android Apps: A Study on Diffusion, Evolution and Fragility](https://mlsanity.com/paper/1711.03565/) (2017)
- [Sourcerer's Apprentice and the study of code snippet migration](https://mlsanity.com/paper/1808.00106/) (2018)
- [On the Nature of Code Cloning in Open-Source Java Projects](https://mlsanity.com/paper/2107.04712/) (2021)
- [An Empirical Study on Bugs Inside PyTorch: A Replication Study](https://mlsanity.com/paper/2307.13777/) (2023)

## Built on by (most cited first, 2 of 2)

- [Deep-Bench: Deep Learning Benchmark Dataset for Code Generation](https://mlsanity.com/paper/2502.18726/) (2025)
- [A Systematic Literature Review on the Use of Machine Learning in Software Engineering](https://mlsanity.com/paper/2406.13877/) (2024)

## Abstract (arXiv)

Deep Learning (DL) frameworks play a critical role in advancing artificial intelligence, and their rapid growth underscores the need for a comprehensive understanding of software quality and maintainability. DL frameworks, like other systems, are prone to code clones. Code clones refer to identical or highly similar source code fragments within the same project or even across different projects. Code cloning can have positive and negative implications for software development, influencing maintenance, readability, and bug propagation. In this paper, we aim to address the knowledge gap concerning the evolutionary dimension of code clones in DL frameworks and the extent of code reuse across these frameworks. We empirically analyze code clones in nine popular DL frameworks, i.e., TensorFlow, Paddle, PyTorch, Aesara, Ray, MXNet, Keras, Jax and BentoML, to investigate (1) the characteristics of the long-term code cloning evolution over releases in each framework, (2) the short-term, i.e., within-release, code cloning patterns and their influence on the long-term trends, and (3) the file-level code clones within the DL frameworks. Our findings reveal that DL frameworks adopt four distinct cloning trends and that these trends present some common and distinct characteristics. For instance, bug-fixing activities persistently happen in clones irrespective of the clone evolutionary trend but occur more in the "Serpentine" trend. Moreover, the within release level investigation demonstrates that short-term code cloning practices impact long-term cloning trends. The cross-framework code clone investigation reveals the presence of functional and architectural adaptation file-level cross-framework code clones across the nine studied frameworks. We provide insights that foster robust clone practices and collaborative maintenance in the development of DL frameworks.
