JupOtter: Cell-Level Bug Detection in Jupyter Notebooks
Lukas Ottenhof, Thibaud Lutellier · 2026
Read JupOtter: Cell-Level Bug Detection in Jupyter Notebooks by Lukas Ottenhof, Thibaud Lutellier (2026) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2606-23877.txt.
Introduction
Ottenhof and Lutellier build a bug detector that works at the level of individual cells inside Jupyter notebooks, in a 2026 paper on software engineering. Notebooks are graduating from quick prototypes to complex programs, and buggy notebooks on public platforms are rising fast. Their cell structure breaks ordinary tools: cells run in any order, and a file level warning is barely useful for finding a bug.
JupOtter combines three new pieces. A notebook specific way of splitting code into tokens preserves cell structure. A prediction technique flags buggy cells directly, rather than whole files. And OtterDataset provides over twenty one thousand notebooks labeled for cell level bug detection. JupOtter's F1 scores beat static analyzers and large language models on two of three datasets.
Catalog record
| CREATOR | Lukas Ottenhof, Thibaud Lutellier |
|---|---|
| YEAR | 2026 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 59 KB |
| LICENSE | http://creativecommons.org/licenses/by-sa/4.0/ |
| RIGHTS | CC BY SA |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2606.23877
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
JupOtter: Cell-Level Bug Detection in Jupyter Notebooks Thanks: This work was supported by the Natural Sciences and Engineering Research Council of Canada (NSERC). Lukas Ottenhof, Thibaud Lutellier Abstract Jupyter Notebooks are an increasingly popular coding environment used across many domains, especially in Python-based data science and scientific computing. Originally used for prototyping and interactive exploration, notebooks are increasingly used to develop more complex programs, leading to a rapid rise in buggy notebooks on platforms like GitHub. To address this trend, we present JupOtter , a bug detection system designed specifically for Jupyter Notebooks. JupOtter features three novel contributions: (1) a notebook-specific tokenization strategy that preserves cell structure, (2) a cell-level bug prediction technique, and (3) a new labeled dataset, OtterDataset , containing over 21,000 notebooks annotated for fine-grained cell-level bug detection. JupOtter achieves cell-level bug detection F1 scores that surpass static analyzers and large language models in two out of three evaluation datasets. I Introduction Jupyter Notebooks have become the standard environment in data science due to their unique interactive structure [ 39 ] . Unlike traditional code files, notebooks consist of executable cells that can contain either code or markdown, and can be executed in any order. This cell-based execution model allows users to run time-consuming operations (e.g., data loading) once and iteratively modify downstream code without re-executing the entire notebook. While this flexibility has accelerated development and experimentation, it has also introduced new challenges in code reliability. As notebooks evolve from prototyping tools into complex, multi-stage software artifacts, the risk of implementation bugs grows. This shift has contributed to a rising number of buggy notebooks [ 11 ] . Recent studies show that the number of implementation bugs in Jupyter Notebooks found on Stack Overflow is increasing by 48% annually [ 11 ] , suggesting developers are struggling to manage notebook quality. This problem is especially concerning in domains such as scientific research, finance, and artificial intelligence, where high accuracy and reliability are critical. This paper presents contributions focused on detecting bugs related to code implementation because they represent a significant and growing portion of real-world notebook bugs. Unlike environment-related bugs that depend on external dependencies or configurations, implementation bugs are self-contained within notebooks and can be identified by learning patterns in code. Detecting such bugs prior to execution can reduce debugging time and resource costs. Jupyter Notebooks present unique challenges for bug detection due to their non-linear, cell-based execution model. Unlike traditional scripts, notebooks allow cells to be run in arbitrary order, which can introduce implementation bugs tied to execution state and cell dependencies. As a result, conventional debugging techniques that work on sequential scripts are often ineffective. Machine learning tools have shown potential in code understanding tasks such as bug detection across programming languages [ 3 , 59 , 31 , 23 , 42 ] . However, many existing machine learning-based bug detectors operate at the file or function level, which is ill-suited to the notebook format. Simply knowing that a bug exists in a notebook file is often not actionable, and focusing on a single function may miss cross-cell dependencies. Despite recent advances, existing machine learning tools lack support for the structural and execution-specific characteristics of Jupyter Notebooks. As a result, the software engineering community still lacks effective approaches to automatically detect notebook bugs [ 58 , 26 ] . To address the unique challenges of analyzing Jupyter Notebooks, we propose JupOtter : a novel machine learning-based bug detection system tailored to the notebook format. JupOtter introduces three key contributions: (1) A new tokenization strategy which enables fine-grained predictions by inserting special tokens that wrap each cell and act as explicit cell boundaries. These boundary tokens allow models to know exactly where notebook cells start and end after tokenization, which is necessary for making precise, localized predictions. Unlike prior code tokenization approaches, which either flatten notebooks into plain scripts or truncate long inputs [ 13 , 65 , 21 , 20 ] , our strategy preserves the original cell structure while enabling long-context processing without losing global notebook coverage. This makes fine-grained, cell-level reasoning possible at scale. (2) A new cell-level bug prediction technique which allows models to make separate predictions for each cell in a notebook. Unlike previous models built for linear, traditional source code [ 41 , 30 , 10 , 22 ] , our technique assumes no fixed execution order. This matches the naturally non-linear, cell-by-cell execution of computational notebooks. This differs from standard pretrained-model adaptation for sequence classification, which produces a single label per input sequence rather than per-cell representations. (3) OtterDataset, a new dataset of 21,303 Python Jupyter Notebooks labeled for bug detection. This dataset is designed to support cell-level and file-level evaluation and training, while reflecting real-world notebook usage. To the best of our knowledge, this is the first publicly available large-scale dataset of Jupyter Notebooks with cell-level labels. JupOtter was evaluated using three datasets excluded from its training data (OtterDataset, Jupyter Errors [ 19 ] , and CodeParrot [ 7 ] ). We aimed to answer four research questions: RQ1: How well does JupOtter detect bugs at the cell level, RQ2: How does JupOtter perform when detecting specific error types, RQ3: How does JupOtter compare to related tools for file-level bug detection, and RQ4: How does each contribution affect performance? II Approach At a high level, JupOtter processes Jupyter Notebooks by extracting code cells, converting them into a tokenized format that preserves notebook structure, and predicting whether each cell contains an implementation bug. Our approach is designed to handle the unique characteristics of notebooks, including variable-length cells and interleaved code and markdown content. Our approach consists of four main components: (1) a dataset construction phase, (2) a notebook-specific tokenization strategy, (3) a cell-level defect prediction model, and (4) a multi-segment training strategy (see Figure 1 ). Fig. 1: Overview of JupOtter, a bug detection system for Jupyter Notebooks. Our approach begins with source notebooks whose code cells are first extracted and preprocessed. The processed code cells are then tokenized into non-overlapping chunks using our tokenization strategy. These chunks are then processed by a pre-trained encoder, and predictions are generated. II-A The OtterDataset To address the lack of publicly available datasets for supervised cell-level bug detection in Jupyter Notebooks, we constructed OtterDataset: a new labeled dataset of Python notebooks designed for this task. We systematically extracted Jupyter Notebook files from GitHub using GitHub Search API and a set of 32 search queries to ensure broad coverage of topics and error types. After cleaning, labeling, and removing duplicate notebooks, this process resulted in 9,937 buggy notebooks and 11,366 non-buggy notebooks (47% buggy ratio, 21,303 total notebooks). At the cell-level, 43,789 cells are buggy out of 661,909 cells (7% buggy cell ratio), with an average of 2.1 buggy cells per notebook. To prevent over-representation of any particular query, we limited the collection to a maximum of 1,000 notebooks per query. The search queries were designed to capture a broad range of domains such as statistics and machine learning, and common bug types. To target common implementation errors, we incorporated bug-related keywords including Python exceptions such as “IndexError” and “TypeError”, based on the list of built-in exceptions in the official Python documentation