21Performance Optimisation

Notebook Compression

#ModelScoreStepsIn tokOut tokAvg costAvg time
1Claude Fable 5.1
0.5459
±0.045
423118.0M369k$68.0014.9h
2GPT-5.6
0.2280
±0.050
497110.0M230k$86.5913.2h
3Kimi K3
0.2268
±0.025
33775.6M330k$31.1416.3h
4GLM-5.3
0.2184
±0.062
412117.7M411k$37.7317.5h
5Grok 4.6
0.2122
±0.010
33673.2M481k$75.639.6h
6Qwen3.8-Max
0.2061
±0.015
39952.1M724k$17.7818.8h
7DeepSeek V4 Flash Exp
0.1974
±0.012
487141.2M412k$2.5813.9h
8Gemini 3.7 Flash
0.0944
±0.073
17619.0M131k$4.094.1h
9Muse Spark 1.2
0.0912
±0.058
807281.7M956k$75.0615.3h
10Inkling
0.0202
±0.001
1726.5M34k$6.302.6h

Background

Jupyter notebooks are a compressor's puzzle box: JSON structure, source code, markdown prose, and, dominating the bytes, base64-encoded cell outputs. In this corpus roughly 64% of all bytes are base64 image/png payloads, so beating a general-purpose compressor requires exploiting the format itself: undoing the base64 layer, modeling the JSON envelope, and finding redundancy across hundreds of related notebooks, all while guaranteeing byte-exact reconstruction.

The corpus is a fixed selection of real, permissively-licensed notebooks from twelve pinned open-source repositories (TensorFlow docs, Hugging Face, OpenAI cookbook, scikit-style ML tutorials, cloud-vendor samples, and more), shipped byte-for-byte as committed upstream (no re-serialization, no output stripping), with per-file provenance and hashes in a manifest.

Task

The agent must compress the Jupyter notebooks in /app/corpus/ as small as possible, losslessly, and ship the result as a self-extracting archive under /app/dist/.

  • python3 /app/dist/decompress.py <out_dir> must recreate every notebook byte-for-byte into <out_dir>, using only what is under /app/dist/.
  • The total size of /app/dist/(file contents plus every entry's path name, with only __pycache__excluded) counts as the compressed size, so the decoder's own code is part of the price.
  • The decoder may shell out to tools already installed on the machine (those do not count toward the size); anything custom must live inside /app/dist/.
  • Changes are confined to /app/dist, and the workspace must stay in working condition in case the sandbox times out mid-experiment.

What The Agent Gets

The full ~650 MB notebook corpus at /app/corpus/ (the exact bytes that will be scored, not a proxy), plus python3 /app/check.py, which runs the decoder into a temporary directory, verifies the byte-exact round trip (with a --sample flag for fast iteration), and reports the size of /app/dist against the recorded xz -9 baseline.

The machine is offline (Ubuntu 24.04) with a compression-oriented toolchain preinstalled: standard compression CLIs and headers, a build toolchain, and a Python stack including zstandard, brotli, lz4, NumPy, pandas, SciPy, and PyArrow. A sandbox-timer CLI reports the remaining budget.

Verification

A clean-room verifier in a separate container scores the captured submission against root-only ground truth. It first wipes any harness logs restored from the agent's trial so a decoder cannot read an out-of-band stash, rejects any symlink under the submission, copies /app/dist into a scratch directory, and empties /app entirely before decoding; the decoder runs unprivileged with only its own files.

  • The decode stage is capped at 30 minutes; every recovered notebook is then compared byte-for-byte against the root-only corpus copy, with symlinked or non-regular outputs rejected. Any mismatch means the submission is not lossless and scores 0.
  • The metric is the submission ratio: total /app/dist bytes (contents plus path names) divided by corpus bytes; lower is better.
  • Reward is anchored to two fixed points: matching a whole-corpus xz -9 self-extracting archive scores 0, and reaching 15% of the corpus size scores 1.0. The curve is measured in compression factor and bent exponentially (2u − 1), so each further halving of the archive is worth more than the last.
  • A decoder that fails, times out, or depends on anything outside /app/dist zeroes the result.

Environment

Base imageubuntu:24.04
Tools availableCMake, C/C++ toolchain, Python 3
Compute4 CPUs · 8 GB RAM
Time limit20h

Changes From V1

This task is an improved revision of Notebook Compression from FrontierSWE V1.

  • The task was reframed from a three-stage fit / compress / decompress codec scored per-notebook on a hidden holdout set to a single self-extracting archive of the visible corpus itself: the agent now compresses exactly the bytes it can see, and the whole /app/dist directory (decoder included) is the scored size.
  • The corpus was rebuilt from scratch: V1 shipped pre-canonicalized notebooks on a data volume, while V2 ships ~650 MB of real, unmodified notebooks from twelve pinned permissively-licensed repositories with per-file provenance and hashes, deliberately retaining real cell outputs (about 64% of bytes are base64 PNG images).
  • Scoring changed from raw byte ratios to a two-anchor curve: a whole-corpus xz -9 archive marks zero reward and 15% of corpus size marks full credit, with an exponential bend that rewards escaping a compression plateau more than polishing inside one.
  • Verification hardened into a separate clean-room container: restored harness logs are wiped so decoders cannot read out-of-band stashes, symlinks are rejected, /app is emptied before the unprivileged capped decode, and the round trip is checked byte-for-byte against root-only ground truth.
  • The agent budget grew from 8 to 20 hours while the machine shrank from 16 CPUs / 32 GB RAM to 4 CPUs / 8 GB, and V1's per-stage wall-time limits and artifact caps were replaced by a single decode cap; the /app/.timer daemon files gave way to the sandbox-timer CLI under the new harbor schema.

References