Dataset Viewer
The dataset viewer is taking too long to fetch the data. Try to refresh this page.
Server-side error
Error code:   ClientConnectionError

YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

Automated Modernization of Machine Learning Engineering Notebooks for Reproducibility

This is replication package of paper "Automated Modernization of Machine Learning Engineering Notebooks for Reproducibility".

Environment

Python: 3.11.11

cd ~/CodeModernization && uv init --python 3.11.11
uv add -r requirements-mle_env.txt
uv sync

Python dependencies

Frozen environment from pip list.

Package Version Editable location
absl-py 2.1.0
accelerate 1.4.0
aiohappyeyeballs 2.4.6
aiohttp 3.11.10
aiosignal 1.4.0
airportsdata 20250224
albucore 0.0.34
alembic 1.16.5
altair 5.5.0
annotated-types 0.7.0
anthropic 0.64.0
antlr4-python3-runtime 4.9.3
anyio 4.12.0
appdirs 1.4.4
argon2-cffi 21.3.0
argon2-cffi-bindings 21.2.0
arrow 1.3.0
astor 0.8.1
asttokens 3.0.1
astunparse 1.6.3
async-lru 2.0.4
attrs 24.3.0
audioread 3.0.1
babel 2.16.0
backcall 0.2.0
backoff 2.2.1
bayesian-optimization 3.1.0
bayespy 0.5.1
bcrypt 4.3.0
beartype 0.21.0
beautifulsoup4 4.13.3
biopython 1.85
bitsandbytes 0.47.0
black 24.3.0
blake3 1.0.4
bleach 6.2.0
blinker 1.9.0
blis 1.2.0
Bottleneck 1.4.2
Brotli 1.1.0
build 1.3.0
cachetools 5.5.2
catalogue 2.0.10
cbor2 5.7.0
cchardet 2.1.7
certifi 2025.8.3
cffi 1.17.1
charset-normalizer 3.4.4
chromadb 1.0.20
click 8.1.8
cloudpathlib 0.21.0
cloudpickle 3.1.1
colorama 0.4.6
coloredlogs 15.0.1
colorlog 6.9.0
comm 0.2.1
compressed-tensors 0.10.2
confection 0.1.5
contourpy 1.3.1
coolname 2.2.0
cramjam 2.9.1
cupy-cuda12x 13.4.0
curated-tokenizers 0.0.9
curated-transformers 0.1.1
cycler 0.12.1
cymem 2.0.11
dataclasses-json 0.5.7
datasets 2.1.0
debugpy 1.8.11
decorator 5.1.1
defusedxml 0.7.1
Deprecated 1.2.13
depyf 0.19.0
dill 0.3.8
diskcache 5.6.3
distro 1.9.0
dnspython 2.7.0
docker 7.1.0
docopt 0.6.2
docstring_parser 0.16
durationpy 0.10
einops 0.8.1
email_validator 2.2.0
en_core_web_trf 3.8.0
entrypoints 0.4
et_xmlfile 2.0.0
executing 2.2.0
faiss 1.9.0
fastai 2.8.4
fastapi 0.115.11
fastapi-cli 0.0.7
fastcore 1.8.8
fastdownload 0.0.7
fastjsonschema 2.21.1
fastparquet 2024.11.0
fastprogress 1.0.3
fastrlock 0.8.3
fasttest 0.0.8
fasttext 0.9.3
fasttransform 0.0.2
filelock 3.17.0
flash_attn 2.8.3
flatbuffers 25.2.10
fonttools 4.56.0
fqdn 1.5.1
frozenlist 1.5.0
fsspec 2025.2.0
funcy 2.0
future 1.0.0
gast 0.6.0
gensim 4.3.3
genson 1.3.0
gguf 0.17.1
gitdb 4.0.12
GitPython 3.1.45
gmpy2 2.2.1
google-ai-generativelanguage 0.6.15
google-api-core 2.25.1
google-api-python-client 2.143.0
google-auth 2.45.0
google-auth-httplib2 0.2.0
google-auth-oauthlib 1.2.2
google-genai 1.56.0
google-generativeai 0.8.5
google-pasta 0.2.0
googleapis-common-protos 1.70.0
greenlet 3.1.1
grpcio 1.75.0
grpcio-status 1.71.2
gym 0.26.2
gym-notices 0.1.0
h11 0.14.0
h5py 3.13.0
hf-xet 1.1.8
hmmlearn 0.3.3
httpcore 1.0.2
httplib2 0.22.0
httptools 0.6.4
httpx 0.28.1
httpx-sse 0.4.0
huggingface_hub 0.34.4
humanfriendly 10.0
humanize 4.8.0
hyperopt 0.2.7
idna 3.10
igraph 0.11.9
imagecodecs 2025.8.2
imageio 2.37.0
imbalanced-learn 0.12.4
imgaug 0.4.0
importlib-metadata 7.0.1
importlib_resources 6.5.2
inflate64 1.0.1
iniconfig 2.0.0
instructor 1.3.7
interegular 0.3.3
ipykernel 6.29.5
ipython 8.30.0
ipython-genutils 0.2.0
ipython_pygments_lexers 1.1.1
ipywidgets 7.8.1
isoduration 20.11.0
jedi 0.19.2
Jinja2 3.1.5
jiter 0.12.0
joblib 1.5.1
json5 0.9.25
jsonpatch 1.33
jsonpointer 3.0.0
jsonschema 4.25.1
jsonschema-specifications 2024.10.1
jupyter 1.1.1
jupyter_client 8.6.3
jupyter-console 6.4.4
jupyter_core 5.7.2
jupyter-events 0.10.0
jupyter-lsp 2.2.0
jupyter_server 2.14.1
jupyter-server-mathjax 0.2.6
jupyter_server_terminals 0.4.4
jupyterlab 4.3.4
jupyterlab_pygments 0.3.0
jupyterlab_server 2.27.3
jupyterlab-widgets 1.0.0
kaggle 1.7.4.5
keras 3.11.3
kiwisolver 1.4.8
kornia 0.8.1
kornia_rs 0.1.9
krippendorff 0.8.1
kubernetes 33.1.0
langchain 0.3.20
langchain-community 0.3.19
langchain-core 0.3.41
langchain-text-splitters 0.3.6
langcodes 3.5.0
langfuse 3.3.1
langsmith 0.3.12
language_data 1.3.0
lark 1.2.2
lazy_loader 0.4
Levenshtein 0.26.1
libclang 18.1.1
libcst 1.8.6
librosa 0.11.0
lightgbm 4.6.0
lightning-utilities 0.15.2
llguidance 0.7.30
llvmlite 0.44.0
lm-format-enforcer 0.10.11
loguru 0.7.2
lxml 5.3.1
Mako 1.3.10
marisa-trie 1.2.1
Markdown 3.7
markdown-it-py 3.0.0
markovify 0.9.4
MarkupSafe 3.0.2
marshmallow 3.26.1
marshmallow-enum 1.5.1
matplotlib 3.10.0
matplotlib-inline 0.1.6
mdurl 0.1.2
mistral_common 1.8.4
mistune 3.1.2
mkl_fft 1.3.11
mkl_random 1.2.8
mkl-service 2.4.0
ml_dtypes 0.5.3
mle-agent 0.4.2
mlebench 1.0.0 ./mle-bench
mmh3 5.2.0
monai 1.5.0
mpmath 1.3.0
msgpack 1.1.0
msgpack-numpy 0.4.8
msgspec 0.19.0
multidict 6.1.0
multiprocess 0.70.18
multivolumefile 0.2.3
murmurhash 1.0.12
mypy-extensions 1.0.0
namex 0.0.8
narwhals 2.2.0
nbclassic 1.1.0
nbclient 0.10.2
nbconvert 7.16.6
nbdime 4.0.2
nbformat 5.10.4
nest-asyncio 1.6.0
networkx 3.4.2
ninja 1.13.0
nltk 3.9.1
notebook 7.3.2
notebook_shim 0.2.3
numba 0.61.2
numexpr 2.10.2
numpy 1.26.4
nvidia-cublas-cu11 11.11.3.6
nvidia-cublas-cu12 12.6.4.1
nvidia-cuda-cupti-cu11 11.8.87
nvidia-cuda-cupti-cu12 12.6.80
nvidia-cuda-nvrtc-cu11 11.8.89
nvidia-cuda-nvrtc-cu12 12.6.77
nvidia-cuda-runtime-cu11 11.8.89
nvidia-cuda-runtime-cu12 12.6.77
nvidia-cuda-runtime-cu13 0.0.0a0
nvidia-cudnn-cu11 9.1.0.70
nvidia-cudnn-cu12 9.10.2.21
nvidia-cufft-cu11 10.9.0.58
nvidia-cufft-cu12 11.3.0.4
nvidia-cufile-cu12 1.11.1.6
nvidia-curand-cu11 10.3.0.86
nvidia-curand-cu12 10.3.7.77
nvidia-cusolver-cu11 11.4.1.48
nvidia-cusolver-cu12 11.7.1.2
nvidia-cusparse-cu11 11.7.5.86
nvidia-cusparse-cu12 12.5.4.2
nvidia-cusparselt-cu12 0.7.1
nvidia-nccl-cu11 2.21.5
nvidia-nccl-cu12 2.27.3
nvidia-nvjitlink-cu12 12.6.85
nvidia-nvtx-cu11 11.8.86
nvidia-nvtx-cu12 12.6.77
oauthlib 3.3.1
omegaconf 2.3.0
onnxruntime 1.22.1
openai 2.14.0
openai-harmony 0.0.4
opencv-python 4.11.0.86
opencv-python-headless 4.11.0.86
openpyxl 3.1.5
opentelemetry-api 1.36.0
opentelemetry-exporter-otlp-proto-common 1.36.0
opentelemetry-exporter-otlp-proto-grpc 1.36.0
opentelemetry-exporter-otlp-proto-http 1.36.0
opentelemetry-proto 1.36.0
opentelemetry-sdk 1.36.0
opentelemetry-semantic-conventions 0.57b0
opt_einsum 3.4.0
optree 0.14.0
optuna 4.5.0
optuna-integration 4.5.0
orjson 3.10.15
outlines 0.1.11
outlines_core 0.2.10
overrides 7.4.0
packaging 24.2
pandas 2.2.2
pandocfilters 1.5.1
parso 0.8.4
partial-json-parser 0.2.1.1.post5
pathspec 0.12.1
patsy 1.0.1
pdf2image 1.17.0
pexpect 4.9.0
pickleshare 0.7.5
pigar 2.2.0
pillow 11.1.0
pip 25.2
pipreqs 0.5.0
platformdirs 3.10.0
plotly 6.3.0
pluggy 1.5.0
plum-dispatch 2.5.7
pooch 1.8.2
posthog 5.4.0
preshed 3.0.9
prometheus_client 0.21.0
prometheus-fastapi-instrumentator 7.0.2
prompt_toolkit 3.0.50
propcache 0.3.0
proto-plus 1.26.1
protobuf 5.29.3
psutil 7.0.0
psycopg2-binary 2.9.11
ptyprocess 0.7.0
pure_eval 0.2.3
py-cpuinfo 9.0.0
py4j 0.10.9.9
py7zr 0.22.0
pyaml 25.7.0
pyarrow 17.0.0
pyasn1 0.6.1
pyasn1_modules 0.4.2
pybase64 1.4.2
pybcj 1.0.3
pybind11 3.0.1
pycocotools 2.0.8
pycountry 24.6.1
pycparser 2.21
pycryptodomex 3.21.0
pydantic 2.12.4
pydantic_core 2.41.5
pydantic-extra-types 2.10.5
pydantic-settings 2.8.1
pydeck 0.9.1
pyglove 0.5.0.dev202509290811
Pygments 2.15.1
pyLDAvis 3.4.1
pymongo 4.11.1
pyocr 0.8.5
pyparsing 3.2.1
pypdf 6.0.0
PyPika 0.48.9
pyppmd 1.1.1
pyproject_hooks 1.2.0
PyQt6 6.7.1
PyQt6_sip 13.9.1
pyquaternion 0.9.9
pyre-check 0.9.25
pyre-extensions 0.0.32
Pyro4 4.82
PySocks 1.7.1
pytest 7.4.3
python-dateutil 2.9.0.post0
python-dotenv 1.0.1
python-json-logger 3.2.1
python-multipart 0.0.20
python-slugify 8.0.4
pytorch-lightning 2.5.3
pytorch-triton 3.4.0
pytz 2025.1
PyYAML 6.0.2
pyzmq 26.2.0
pyzstd 0.16.2
qtconsole 5.6.1
QtPy 2.4.1
questionary 2.1.0
RapidFuzz 3.12.1
ray 2.49.0
redis 7.1.0
referencing 0.36.2
regex 2025.11.3
requests 2.32.5
requests-oauthlib 2.0.0
requests-toolbelt 1.0.0
responses 0.18.0
rfc3339-validator 0.1.4
rfc3986-validator 0.1.1
rich 13.9.4
rich-toolkit 0.13.2
rpds-py 0.23.1
rsa 4.9.1
safetensors 0.4.5
scikit-image 0.25.2
scikit-learn 1.5.0
scikit-optimize 0.10.2
scipy 1.16.0
seaborn 0.13.2
Send2Trash 1.8.2
sentence-transformers 5.1.0
sentencepiece 0.2.0
serpent 1.41
setproctitle 1.3.6
setuptools 80.9.0
shapely 2.0.7
shellingham 1.5.4
shutup 0.2.0
simpledorff 0.0.2
simsimd 6.5.3
sip 6.10.0
six 1.16.0
sklearn-pandas 2.2.0
smart-open 7.1.0
smmap 5.0.2
sniffio 1.3.0
soundfile 0.13.1
soupsieve 2.6
soxr 0.5.0.post1
spacy 3.8.4
spacy-curated-transformers 0.3.0
spacy-legacy 3.0.12
spacy-loggers 1.0.5
SQLAlchemy 2.0.38
srsly 2.5.1
stack-data 0.6.3
starlette 0.46.0
statsmodels 0.14.5
streamlit 1.40.2
stringzilla 4.2.3
sympy 1.13.3
tabulate 0.9.0
tavily-python 0.7.11
tenacity 8.5.0
tensorboard 2.20.0
tensorboard-data-server 0.7.2
tensorflow 2.20.0
tensorflow-addons 0.23.0
tensorflow-io-gcs-filesystem 0.37.1
tensorpack 0.11
tensorrt 10.13.3.9
tensorrt_cu13 10.13.3.9
tensorrt_cu13_bindings 10.13.3.9
tensorrt_cu13_libs 10.13.3.9
termcolor 2.5.0
terminado 0.17.1
TestSlide 2.7.1
text-unidecode 1.3
texttable 1.7.0
tf_keras 2.19.0
thinc 8.3.4
threadpoolctl 3.5.0
tifffile 2025.8.28
tiktoken 0.11.0
timm 1.0.19
tinycss2 1.4.0
tokenizers 0.22.0
toml 0.10.2
tomli 2.3.0
tomli_w 1.2.0
torch 2.8.0+cu126
torchaudio 2.8.0+cu126
torchinfo 1.8.0
torchmetrics 1.8.1
torchtext 0.18.0
torchvision 0.23.0+cu126
tornado 6.4.2
tqdm 4.66.2
traitlets 5.14.3
transformers 4.56.0
triton 3.4.0
ttach 0.0.3
typeguard 2.13.3
typer 0.15.2
types-python-dateutil 2.9.0.20250822
typing_extensions 4.15.0
typing-inspect 0.9.0
typing-inspection 0.4.2
tzdata 2025.2
Unidecode 1.4.0
uri-template 1.3.0
uritemplate 4.2.0
urllib3 2.3.0
uv 0.8.14
uvicorn 0.34.0
uvloop 0.21.0
wasabi 1.1.3
watchdog 6.0.0
watchfiles 1.0.4
wcwidth 0.2.13
weasel 0.4.1
webcolors 24.11.1
webencodings 0.5.1
websocket-client 1.8.0
websockets 15.0.1
Werkzeug 3.1.3
wheel 0.45.1
widgetsnbextension 3.6.6
wrapt 1.17.0
xformers 0.0.32.post2
xgboost 3.0.5
xgrammar 0.1.21
xlrd 2.0.2
XlsxWriter 3.2.2
xxhash 3.5.0
yarg 0.1.9
yarl 1.18.3
zipp 3.21.0
zstandard 0.23.0

Terminology

Replicable: scripts with valid csv generated and threshold <= 10%

  • i. filtering criteria: where tau = 10%, meaning that scripts whose replicated scores differ from their Kaggle-reported scores (the variance) by less than 10% advance to the next round.

Not Replicable: (research objects) scripts with valid csv generated and threshold > 10%

Failed: scripts with no csv generated (mainly because of running time and submission_data.to_csv('submission_csv', index=False) saving without suffix) and running time > 600s

Backporting: backporting Environments

Upgrade (from Baseline): modify Code

  1. file-level
  2. code-level

Procedure

Raw Data Collection

The datadump is provided by Meta Kaggle and Meta Kaggle Code.

Meta Kaggle:

#!/bin/bash
curl -L -o ~/Downloads/meta-kaggle.zip\
  https://www.kaggle.com/api/v1/datasets/download/kaggle/meta-kaggle

Meta Kaggle Code:

#!/bin/bash
curl -L -o ~/Downloads/meta-kaggle-code.zip\
  https://www.kaggle.com/api/v1/datasets/download/kaggle/meta-kaggle-code

Tables

KernelVersions.csv

Each row is one published version of a kernel: a concrete snapshot you can run or submit from. It has Id (filename in Meta Kaggle Code), ScriptId, ScriptLanguageId, RunningTimeInMilliseconds, VersionNumber, CreationDate, EvaluationDate, etc. ScriptLanguageId tells you the language family (e.g. Python notebook vs R vs other).

Kernels.csv

Each row is one kernel (notebook) entity, not a specific version. Id is the kernel id—the same meaning as KernelVersions.ScriptId. Medal records competition medal tier for that kernel (1: gold, 2: silver, 3: bronze). AuthorUserId is the Kaggle user id of the author; it matches Users.Id (same numeric user key). CurrentUrlSlug is a part of the submission url (refer to the next subsection).

Submissions.csv

Each row is one leaderboard submission from a team. TeamId points to Teams.Id: which team filed it. SourceKernelVersionId points to KernelVersions.Id: which kernel version was used as the submission source. Since a KernelVersions.Id may exit multi records in Submissions.csv, SubmissionDate and ScoreDate are timestamps used for date matching and cutoff filters. PublicScoreFullPrecision and PrivateScoreFullPrecision hold scores; the scripts use private (and sometimes public) scores to require a scored submission and non-null / non-zero private logic where applied.

KernelVersionDatasetSources.csv

Each row links a kernel version to an external dataset version used in that run. KernelVersionId is the same id space as Submissions.SourceKernelVersionId / KernelVersions.Id. SourceDatasetVersionId identifies the attached dataset version (used when listing dataset sources per version and when building the set of “dataset-bound” version ids to exclude).

Teams.csv

Each row is one team registered for a competition. Id identifies the team pointing to TeamId in Submissions.csv. CompetitionId points to Competitions.Id: which competition that team belongs to.

Competitions.csv

Each row is one competition. Id is its stable numeric identifier. Slug is the URL-style name (used to resolve a competition from a slug). TotalSubmissions is the count Kaggle reports for the competition.

Users.csv

Each row is one Kaggle user. Id is exactly what Kernels.AuthorUserId references: the author of a kernel is that user row. UserName is the URL-style name for the submission url (refer to the next subsection).

Submission URL

A submission URL is composed as https://www.kaggle.com/code/{UserName}/{CurrentUrlSlug}?scriptVersionId={SourceKernelVersionId}, where UserName, CurrentUrlSlug, and SourceKernelVersionId are from Users.csv and Kernels.csv * 2 respectively.

Table Connections

  • Competition → teams: Competitions.Id = Teams.CompetitionId.
  • Team → submissions: Teams.Id = Submissions.TeamId.
  • Submission → kernel version: Submissions.SourceKernelVersionId = KernelVersions.Id.
  • Kernel version → kernel: KernelVersions.ScriptId = Kernels.Id.
  • Kernel → user (author): Kernels.AuthorUserId = Users.Id.
  • Kernel version → external dataset used: KernelVersionDatasetSources.KernelVersionId = KernelVersions.Id (and thus the same id as SourceKernelVersionId on submissions when that link exists).

File Naming

Notebooks are named and saved based on their SourceKernelVersionId processed by following:

f = str(id).zfill(10)
meta-kaggle-code/'+f[0:4]+'/'+f[4:7]+'/'+str(id)+'.ipynb'

To help readability, we rename them by {Slug}_{UserName}_{CurrentUrlSlug}_v{VersionNumber}_{}_C1.ipynb

Baseline (replication of collected scripts)

Raw Data Processing

1.create_kernel.py retrieves metadata (runtime, submission date, APIs, private score, and external dataset) for all executable scripts

  • Use pigar (still updated) to dynamically list dependencies with correct PyPI names
  • output: kernel.json

2.baseline/create_fullDataset.py filters out targeted HTML and converts the code in HTML to Python code in notebooks (.ipynb)

  • output: baseline/notebooks/{competition}_{submissionID}_{status}.ipynb

<span style="color: red;">Make sure to run create_kernel.py and API Preparation 1 2 3 before going through the below sections

Execution

Please refer to the section here

API Backporting

Backporting dependency versions (Rule-based: looking for old version APIs in pypi):

  1. For each dependency, query PyPI for the version current at (or just before) the notebook’s original submit date.
  2. Create one docker image for the submissions under the same user&competition (choose the oldest version if conflicts).
  3. Pin environment to those historical versions and execute the notebook.
  4. If failures arise, apply the same cell-level repair loop, but favor backward-compatible edits that align with older APIs.

API Preparation

  1. apiDowngrade/python_versions.py crawls the Python version w.r.t. its release date from the Python official documentation
  • output: apiDowngrade/python_versions.json
  1. apiDowngrade/python_versions_update.py updates each submission in kernel.json with the relevant (max) Python versions
  • feature: discern the code syntax (py2 or py3)
  • output: updated apiDowngrade/kernel_w_pyVersion.json

Python Version Statistics

Total collected entries: 51,743

Total scripts updated: 12,106

Scripts with no match: 0

Total unique versions: 59

Python Version Distribution

Python Version Count Percentage
3.14.0 617 5.10%
3.13.7 31 0.26%
3.13.5 73 0.60%
3.13.4 2 0.02%
3.13.3 43 0.36%
3.13.2 156 1.29%
3.13.1 51 0.42%
3.13.0 244 2.02%
3.12.6 79 0.65%
3.12.5 61 0.50%
3.12.4 124 1.02%
3.12.3 410 3.39%
3.12.2 406 3.35%
3.12.1 163 1.35%
3.12.0 84 0.69%
3.11.5 54 0.45%
3.11.4 414 3.42%
3.11.3 111 0.92%
3.11.2 67 0.55%
3.11.1 137 1.13%
3.11.0 88 0.73%
3.10.8 52 0.43%
3.10.7 9 0.07%
3.10.6 39 0.32%
3.10.5 119 0.98%
3.10.4 353 2.92%
3.10.3 28 0.23%
3.10.2 107 0.88%
3.10.1 326 2.69%
3.10.0 836 6.91%
3.9.7 488 4.03%
3.9.6 317 2.62%
3.9.5 309 2.55%
3.9.4 137 1.13%
3.9.3 4 0.03%
3.9.2 177 1.46%
3.9.1 934 7.72%
3.9.0 326 2.69%
3.8.6 175 1.45%
3.8.5 955 7.89%
3.8.4 103 0.85%
3.8.3 347 2.87%
3.8.2 193 1.59%
3.8.1 91 0.75%
3.8.0 179 1.48%
3.7.4 313 2.59%
3.7.3 622 5.14%
3.7.2 123 1.02%
3.7.1 59 0.49%
3.7.0 474 3.92%
3.6.5 84 0.69%
3.6.4 117 0.97%
3.6.3 82 0.68%
3.6.1 2 0.02%
3.6.0 70 0.58%
3.5.2 91 0.75%
2.7.18 48 0.40%
2.7.16 1 0.01%
2.7.15 1 0.01%

3.apiDowngrade/create_apiVersions.py creates the API match list based on the script submission date and the API required Python version

  • feature: pick latest_version - 0.1 (e.g., 3.9 - 0.1 = 3.8) for Python > 3.5, as most scripts in Python 2 are submitted much after end of life of Python 2.6. This should work well in practice because most packages will be backward-compatible with older Python versions for a while.
  • outputs:

-apiDowngrade/submission_noAPI.json: No external APIs used in the script, note Python version

-apiDowngrade/pypi_versions.json: API metadata to save time in API retrieval (yanked versions removed)

-apiDowngrade/apiDowngradeList/{competition_fileName}.txt: the list of API names and their matched stable API versions (in the format of api==version) for each submission

-apiDowngrade/apiDowngradeFamilyList/{submission}.txt: groups submissions by family (competition + basename without _vN) and keeps the smallest package version across that family.

 (record competition name, submission name, and API name)

-apiDowngrade/apiMatch_error.txt: APIs w/ errors while calling pypi (N/A)

-apiDowngrade/apiMatch_notFound.txt: not found APIs on pypi (N/A)

-apiDowngrade/apiMatch_oldest_Python_compatible.txt: fallback to the earliest ever version that is Python-compatible (ignores submission date)

-apiDowngrade/apiMatch_oldest_version_compatible.txt: fallback to the earliest ever version, regardless of Python compatibility

  1. Manually check the python version on four submissions from apiDowngrade/apiMatch_oldest_version_compatible.txt based on the submission date and required python versions of APIs
  • "osic-pulmonary-fibrosis-progression_pradyut23_pulmonary-fibrosis-eda": "3.8"
  • "alaska2-image-steganalysis_dzz1th_kernel3de146856b": "3.9"
  • "spooky-author-identification_ttetls_a-gentle-mathematical-approach-to-spooky-en-fr": "3.6"
  • "statoil-iceberg-classifier-challenge_brassmonkey381_viewing-leak-and-machine-images": "3.6"
  • "rsna-2022-cervical-spine-fracture-detection_lsl000ud_rsna2022-7th-place-inference": "3.10"
  • "petfinder-pawpularity-score_guillaumes_petfinder-ensemble-xgboost-tabnet": "3.10"
  • "cassava-leaf-disease-classification_surayuthpintawong_inference-cassava": "3.5"
  • "cassava-leaf-disease-classification_saurabh2mishra_cassava-leaf-disease-inference-label-smoothing": "3.8"
  • "aerial-cactus-identification_visali_cactus-classification-using-fastai": "3.9"
  • "AI4Code_valentinaliferov_ai4code-submit": "3.11"
  • "AI4Code_vaaliferov_ai4code-submit": "3.11"
  • execute apiDowngrade/adjust_apiVersions.py to adjust the API match list
  • outputs:

-apiDowngrade/apiMatch_oldest_Python_compatible2.txt: final fallbacks that are Python-compatible (ignores submission date)

-apiDowngrade/apiMatch_oldest_version_compatible2.txt: final fallbacks regardless of Python compatibility

  1. baseline/check_missingAPIs.py inspects any APIs not found in the kaggle image
  • prerequisite: apiDowngrade/pypi_versions.json from apiDowngrade/create_apiVersions.py and apiDowngrade/adjust_apiVersions.py
  • output: baseline/requirements.txt
  • details: Found 906 packages in Docker image</br> 416 packages in cache</br> Found 284 packages in cache but not in Docker image</br> Filter out these packages for valid reasons; they are not supported by Kaggle
  1. baseline/search_nltkCorpora.py searches all nltk packages used in the scripts
  • output: baseline/nltkCorpora.txt
  • details: 492 scripts use nltk (8 unique corpora)

Execution

Please refer to the section here

API Upgrade

Prerequisite

Execute the .ipynb file inside Docker to collect replicated scores for Baseline and Backporting.

Preparation

  1. upgrade/get_data_preview.py lists the file paths as a tree in the Docker container/env
  • output: upgrade/data_previews/{competition}.txt and upgrade/data_preview.json
  1. upgrade/group_api.py groups the environments with the same requirement and python version plus the empty env (env with a specific python version but no API used)
  • output: upgrade/groups_by_exact_content.json
  1. upgrade/get_api_preview.py lists installed APIs for each env in upgrade/groups_by_exact_content.json
  • output: upgrade/pipList/{filename}.txt for backporting and upgrade/pip_list.txt for baseline
  1. upgrade/select_candidates.py selects non-replicable scripts used for LLM upgrade
  • LLM Keys: LLM keys are used to call the LLM by setting openai, anthropic, and gemini in profile.json
  • Note:
    1. you need to set the key by your own, or set export OPENAI_API_KEY="<keyhere>"
    2. sys_tokens > 13_485, where 13_485 (token_size) is computed by the 95th percentile of the resulting token counts (found in dprocess.ipynb).
  • output: /upgrade/baseline_candidates.json (baseline) or /upgrade/backporting_candidates.json (backporting)

Specification

Go over candidates, upgrade each script one by one with the LLM → send to execution if upgrade is done and there is a free GPU.

  • Model: GPT-5.2-2025-12-11
  1. File-level:
  • i. Convert notebooks (.ipynb) to python (.py) files via nbconvert.
  • ii. Execute the .py file inside Docker.
  • iii. On failure, prompt the LLM w/ the exception to update code to current APIs without altering algorithmic structure (data flow, feature engineering steps, etc.).
  1. Cell-level:
  • i. Execute the notebook w/o caring the errors (use --ExecutePreprocessor.allow_errors=True).
  • ii. If errors occur, localize the first failing cell.
  • iii. Prompt the LLM with all cells up to (and including) the failing one plus the next cell and the exception of the failing cell (no output of other cells); request API-compatible edits with minimal structural change.
  • iv. Re-execute; repeat until the notebook runs cleanly or time budget cap is reached.

<a id="file_execution"></a>

Execution (in Docker)

Setup

-docker/Dockerfile.base+docker/install_envs.sh: build the base image

  • prerequisite:
  • (1)baseline/nltk_corpora.txt
  • (2)apiDowngrade/kernel_w_pyVersion.json
  • (3) files under apiDowngrade/apiDowngradeList/*.txt
  • (4) docker image gcr.io/kaggle-gpu-images/python

Baseline

-baseline/run_baseline_w_time_parallel.py: execute notebooks for baseline in parallel, capture wall-clock runtime, logs, and exit status, and create the targeted virtual environment for each script in the container with pinned toolchains

  • feature: saves output back to the kaggle script
  • output:

-script_out/{competition}/{version}/*.ipynb: the folder that contains all notebooks w/ sub dirs {competition} and {version} to help visualization

-script_out/{competition}/result.json

-script_out_allINone: the folder that contains all notebooks w/o sub dirs

-csv_output/*.csv: output CSVs

-executable_files_w_timer_gpu_{gpu_id}.json: saved results of each thread

-executable_files_w_timer_parrallel.json: integrated results from executable_files_w_timer_gpu_{gpu_id}.json

Upgrade

-upgrade/run_upgrade_w_timer_parrallel.py is similar to baseline but uses the first {n} CPUs to update the candidate code at the file-level/cell-level with LLMs, while the rest of the CPUs execute updated notebooks with both processes running in a lock (concurrently)

  • inclusion:
  • "plan" = upgrade plan
  • "code" = upgraded code
  • "fixed_path" = where the upgrade notebooks saved
  • "request_time" = response time in second
  • "in_tokens" = # input tokens
  • "out_tokens" = # output tokens
  • "cached_tokens" = # cached tokens
  • "model" = request model name
  • "full_message" = full response message

verification/entrypoint.py adopt one-sample T-test based on repeated runs (up to 10 executions), classifying a modernization as reproducible when the target score and the reproduced score are from the same distribution with statistical significance (p >= 0.05).

Results

Grading

csv_grader.py concurrently grades each csv generated by baseline/run_baseline_w_time_parallel.py by setting --workers {n}

  • prerequisite:
  • (1) MLE-bench
  • (2) csv files and parameters "e.g., --save-dir ../CodeModernization/results/baseline"
  • output: {args.save_dir}/csv_score.json
  • Note: In upgrade the grading process is included, so the user does not need to run this script

Selecting Non-Reproducible Notebooks

verification/entrypoint.py runs result notebooks repeatedly (up to 10 executions) with one-sample T-test, classifying a modernization as successful when the target score and reproduced scores are from the same distribution with statistical significance (p >= 0.05). Script starts with run_2, as run_1 is the initial run.

  • output: baseline_non_reproducible.json, file_non_reproducible.json, cell_non_reproducible.json.

Data Analysis

restore_script_out.py will restore files under /result/../csv_output/* which is not included in the replication packages due to space issue. Variables ROOT (path to the type of result) and N_WORKERS (total of CPUs used in this task) need to be configured before execution.

dprocess.ipynb (containing all numbers/figures in the paper) processes results from baseline, backporting, and upgrade runs and produces the following:

  • Raw data & file info: Collects metadata from fetched competitions (total files, R vs Python scripts, date range) and builds a JSON of file info.
  • Notebook statistics: Competition/submission distribution; script token counts and long-tailed distribution (histogram, CCDF); replicated vs Kaggle score comparison with per-competition normalization.
  • Classification: Assigns each notebook to one of five categories—Error-free Reproducible, Error Reproducible, Error-free Non-reproducible, Error Non-reproducible, Failed—for Baseline and Backporting.
  • Sankey flow diagrams: Transitions between categories (Baseline → Backporting, Baseline → File-level upgrade, Baseline → Cell-level upgrade) with counts and percentages.
  • Average fixes (cell vs file): Distribution of number of LLM fixes in cell-level vs file-level upgrade; violin plots; Venn diagram of successfully modernized (replicable) notebooks.
  • Fix count vs file metrics: Relationship between number of fixes and file size, lines of code, and number of errors (for error and error-free subgroups).
  • Crash/error type analysis: Top exception types; stacked bars comparing baseline vs upgrade and Error Reproducible vs Error Non-reproducible.
  • Cell- vs file-level performance: Replication success comparison and edit similarity vs #fix (line chart with band and violin by group: Overall, Timeout, Error, Error-free).

error_causes.py analyzes crash outputs from executed notebooks (baseline, backporting, or upgrade) and produces:

  • Crash extraction & normalization: Extracts error outputs (exception name, value, traceback) from notebook cells; normalizes messages (paths, URLs, numbers) for comparison.
  • Crash type classification: Maps each crash to a type (e.g. module not found, OOM, io error, tensor shape mismatch, feature name mismatch, key/index/attribute/type/value error, invalid argument, other).
  • Root cause inference: Assigns a root cause per crash (environment setting, insufficient resource, NB specific, implementation error, data confusion, API misuse, ML model confusion, library cause) using crash type, packages from traceback, and context (notebook execution order, prior errors).
  • ML vs Python: Flags crashes as ML-related when traceback or message involves ML packages (e.g. numpy, sklearn, tensorflow, torch).
  • Clustering: Clusters crashes by Jaccard similarity on tokenized normalized error text; outputs top clusters with size, representative messages, and top crash types/root causes per cluster.
  • Outputs: JSON report and CSV of crash rows; counts by exception type, crash type, root cause, and ML vs Python; co-occurrence of crash type × root cause. Run with --run-type baseline|downgrade|upgrade; for upgrade, optionally --upgrade-type file|cell and --last-fix (analyze last fix only, split by Error Reproducible vs Error Non-reproducible). Writes to crash_report/.

Offline Grading

https://github.com/openai/mle-bench. Git clone https://github.com/openai/mle-bench.git (Recommanded) or unzip mle-bench-grader.tar.gz and then follow the instruction to install, e.g., pip install -e . and mlebench prepare --all, etc.

The per-fix CSV outputs for each file-level and cell-level modernization (i.e., ./results/upgrade/{gpt_cell, gpt_file, oss_file}/csv_output/fix_{fix_number} for fix_number ∈ {1,…,16}) are included in this replication package.

We have also recorded the score for each fix---consistent with MLE-Bench requirement---in ./results/upgrade/{gpt_cell, gpt_file, oss_file}/executable_files_w_timer_parrallel.json, and we have included all reproducible CSVs at ./results/upgrade/{gpt_cell, gpt_file, oss_file}/csv_output/{notebookName}.csv, where the notebookName is made of {competitionName}_{userName}_{submissionName}_{versionNumber}_C1.ipynb.

If the per-fix CSV outputs are required, we would recommand replicating the corresponding notebook(s) to generate the CSV again.

Downloads last month
1,249