Themisto: Jupyter-Based Runtime Benchmark

Konstantin Grotov, Sergey TitovDL4C @ ICLR 2025

TL;DR

This paper introduces THEMISTO, a novel benchmark for evaluating Large Language Models (LLMs) on their ability to leverage runtime information from Jupyter notebooks for code generation and output prediction. Current LLMs struggle with these dynamic aspects of development, highlighting a significant gap in their understanding of real-world coding workflows.

What Problem Does This Paper Address?

The field of code generation with LLMs has seen rapid progress, but most research focuses on static code analysis. This means LLMs are trained on snapshots of code without considering how it behaves during execution. This is a major limitation because real-world software development, especially in interactive environments like Jupyter notebooks, heavily relies on understanding runtime behavior, variable states, and execution outputs. The challenge is that traditional programming environments don't easily facilitate capturing this dynamic context during code generation. Jupyter notebooks, with their cell-by-cell execution and immediate feedback, offer a unique opportunity to bridge this gap. The authors aim to create a benchmark that specifically tests LLMs' ability to utilize this rich runtime information.

Methods

The core of this paper is the creation of the THEMISTO benchmark. This benchmark is built upon "development trajectories" extracted from Jupyter notebooks. A trajectory is a sequence of cell executions, capturing not just the code but also the runtime state after each execution. This includes:

  • Cell Content: The actual Python code in the cell.
  • Cell Output: The result of executing the code.
  • Execution Time: How long the cell took to run.
  • Memory Usage: The memory consumed during execution.
  • Runtime Variables: A snapshot of the environment's variables, including their names, sizes, and representations.
  • Execution State Hash: A unique identifier for the execution state.

The benchmark defines two primary tasks for LLMs:

  1. Next Cell Prediction: Predicting the code for the next cell a human developer would execute.
  2. Cell Output Prediction: Predicting the output of a given executed cell.

The authors collected and processed data to create these trajectories, enriching them with runtime information. They then evaluated several state-of-the-art LLMs on these tasks, both with and without providing runtime context.

Datasets

The primary dataset used is JuNE, a collection of Jupyter notebook development trajectories. The authors replicated the environment and re-executed four notebooks from JuNE, resulting in 1,453 code executions. This process allowed them to collect detailed runtime information and serialize the environment state for each step. The THEMISTO benchmark is derived from this processed JuNE data. The authors also mention other datasets like Kaggle notebooks but argue JuNE provides more granular information about the development process.

Key Insights and Ideas

  • Runtime Context is Crucial but Underutilized: The paper strongly suggests that current LLMs are not effectively leveraging runtime information for code generation and prediction tasks, despite its obvious importance in real-world development.
  • Jupyter Notebooks as a Unique Environment: The interactive and stateful nature of Jupyter notebooks makes them ideal for capturing and utilizing dynamic execution context, a feature not easily replicated in other coding environments.
  • LLMs Struggle with Dynamic Code Understanding: The benchmark results reveal that even advanced LLMs perform poorly on tasks requiring an understanding of runtime behavior, indicating a significant area for improvement.
  • Next Cell Prediction is Particularly Challenging: Predicting the next piece of code is a complex task that requires a deep understanding of the developer's intent and the current state, which LLMs currently lack.
  • Output Prediction is More Achievable, but Runtime Still Matters: While LLMs can achieve reasonable scores on output prediction even without runtime context, the paper hypothesizes that providing this context should improve scores, though their experiments showed mixed results, suggesting models aren't fully exploiting it yet.

Key Results

The paper presents performance comparisons of several foundation models (GPT-40, Claude 3.5, Gemini 1.5 Pro, DeepSeek-V3) on both tasks.

  • Output Prediction: Models achieved a significant number of exact matches without runtime information. Claude 3.5 performed best with 18% exact match. While scores were similar across models, the exact predicted examples varied.
  • Next Cell Prediction: Overall performance was poor, especially for exact matches. DeepSeek-V3 achieved the highest exact match at 13%. Scores were compensated by higher Rouge-L and ChrF metrics, indicating relevance but not exactness.
  • Impact of Runtime Information: For output prediction, the scores remained very similar with or without runtime information, with Claude 3.5 even seeing a drop. This suggests models are not effectively leveraging this context. For next cell prediction, the results were also largely similar, indicating a similar lack of effective runtime context utilization.

Limitations and Future Work

  • Low Variability in Data: The authors acknowledge that the current benchmark has low variability. The original data was collected from only two tasks and 20 participants, leading to a limited representation of notebook trajectories. This makes it difficult to generalize conclusions.
  • Future Work: The authors encourage the community to use the provided tooling to gather more data for additional tasks. They also highlight the need for further research into how to effectively curate and incorporate runtime information into LLMs, suggesting this is a key area for future post-training improvements and new model architectures. The paper opens up new horizons for research in runtime-aware code completion, dynamic context understanding, and interactive development assistance.

Summary updated

BibTeX
@inproceedings{grotov2025themisto,
  author = {Konstantin Grotov and Sergey Titov},
  title = {{Themisto: Jupyter-Based Runtime Benchmark}},
  booktitle = {DL4C @ ICLR},
  year = {2025},
  url = {https://openreview.net/forum?id=zqTIE7PUtX},
}
Figure