Production Case — TinyBERT, Packaged to Monitored
P13.cases.02 · Audience: guest, it-ml, language-pro · Prerequisites: Packaging & deployment, Monitoring & drift
The P13 tracks teach each production stage on its own; a case picks up one
real artefact and carries it through all of them, in order. Case B ran the P5
tabular income model through package → serve → monitor. This case does the same
for a neural artefact: the TinyBERT checkpoint trained in the
P10 Pipeline console — a small BERT with its
own tokenizer, mounted read-only in the practice kernel as tinybert-fr@1 at
/data/tinybert-fr/1/bert_tiny_fr.pt. Every rung runs on the real model, in the
bert kernel flavor (PyTorch + the tokenizer), and the case ends in a graded
Project that runs the whole lifecycle end to end.
Rung 1 — Package
Packaging a neural model means writing its parts to disk as a reproducible, deployable bundle — the weights, the config needed to rebuild the architecture, and the tokenizer — each pinned with a checksum so a consumer can prove the bytes they load are the bytes you shipped. Reloading those files must reproduce the model's predictions exactly; that reload-and-reproduce contract is what packaging buys you, and the finale reuses it.
Ask the mentor about this module
Ask a question about this content. The mentor explains and grounds its answer in what you are studying; asking is recorded as a learning signal, not a grade.
Loading exercise…
Rung 2 — Serve
Serving scores requests in batches for throughput, but a Transformer batch needs every sequence padded to one length — and padding must not change the answer. The attention mask is what makes batched inference agree with scoring each text alone, whatever the batch size.
Loading exercise…
Rung 3 — Monitor
A served model degrades silently when production text stops looking like its training text. For a lightly-trained model the outputs barely move, so the sharper, cheaper signal is the input: how finely the tokenizer fragments the text. The Population Stability Index turns that shift into a number, and a policy turns the number into a retrain decision.
Loading exercise…
Project — the whole lifecycle
The graded finale runs package → serve → monitor in order on the mounted checkpoint: load it, package it with a checksum manifest, reload it from disk, batch-score a production stream, and decide from the input-drift PSI whether to retrain. Hidden tests grade the lifecycle and a design rubric reviews your choices.
Loading exercise…
Try it yourself
A scratch console for this page's ideas — ungraded, nothing you run here is recorded.
Scratch console
A scratch console with the scientific stack (pandas, numpy, scikit-learn). Runs on the server — no network, resource-limited and measured.
Output appears here.
Where next?
Go up a level