# Jupyter Notebooks on GitHub: Characteristics and Code Clones

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

## Key facts

- Cited by 4 papers in the map (data through 14 Oct 2026).
- First posted on arXiv 20 Jul 2020.

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

- [Good Tools are Half the Work: Tool Usage in Deep Learning Projects](https://mlsanity.com/paper/2310.19124/) (2023)
- [No Accidental Software Agent First Canonical Code for Human Code Entropy Reduction and 30 to 500 times Lower Frontier Model Requirements](https://mlsanity.com/paper/2606.14357/) (2026)
- [JupOtter: Cell-Level Bug Detection in Jupyter Notebooks](https://mlsanity.com/paper/2606.23877/) (2026)
- [On the Relation between Code Quality and Machine Learning Performance: A Large-scale Empirical Study](https://mlsanity.com/paper/2609.10610/) (2026)

## Abstract (arXiv)

Jupyter notebooks has emerged as a standard tool for data science programming. Programs in Jupyter notebooks are different from typical programs as they are constructed by a collection of code snippets interleaved with text and visualisation. This allows interactive exploration and snippets may be executed in different order which may give rise to different results due to side-effects between snippets. Previous studies have shown the presence of considerable code duplication -- code clones -- in sources of traditional programs, in both so-called systems programming languages and so-called scripting languages. In this paper we present the first large-scale study of code cloning in Jupyter notebooks. We analyse a corpus of 2.7 million Jupyter notebooks hosted on GitHJub, representing 37 million individual snippets and 227 million lines of code. We study clones at the level of individual snippets, and study the extent to which snippets are recurring across multiple notebooks. We study both identical clones and approximate clones and conduct a small-scale ocular inspection of the most common clones. We find that code cloning is common in Jupyter notebooks -- more than 70% of all code snippets are exact copies of other snippets (with possible differences in white spaces), and around 50% of all notebooks do not have any unique snippet, but consists solely of snippets that are also found elsewhere. In notebooks written in Python, at least 80% of all snippets are approximate clones and the prevalence of code cloning is higher in Python than in other languages. We further find that clones between different repositories are far more common than clones within the same repository. However, the most common individual repository from which a Jupyter notebook contains clones is the repository in which itself resides.
