Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Content-Addressed Caching for Reactive Notebooks

A System for Cell-Level Cache Reuse in marimo

Authors
Affiliations
marimo
marimo
marimo

Abstract

We describe a caching mechanism for resumable sessions in marimo, a reactive Python notebook. Cache keys are derived recursively from the reactive DAG, content-addressing reference values and substituting parent-cell hashes where direct content addressing is not possible. The recurrence forms a Merkle structure that an edit invalidates at the subtree granularity. Cached values cross process and session boundaries through a lazy stub mechanism and participate in marimo’s static WASM/HTML export, so heavy computations and trained models can ship with a notebook to readers with a browser-embedded Python runtime. Empirically the cache lookup is as fast or faster than representative baselines on microbenchmarks of variably sized payloads. However, unlike other mechanisms, marimo’s caching is native to the reactive notebook, adds little user-facing overhead in its utilization, and allows for cross platform reuse.

Read it your way

The one-figure version

The cache key dispatch (left) and the derivation over a full cell (right): the same parse that schedules a cell yields its cache key.

The cache key dispatch (left) and the derivation over a full cell (right): the same parse that schedules a cell yields its cache key.