Production Case — TinyBERT, Packaged to Monitored

P13.cases.02 · Audience: guest, it-ml, language-pro · Prerequisites: Packaging & deployment, Monitoring & drift

Real LLM grading for this pageLLM grading (this page):

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 (the saved trained weights) produced in the P10 Pipeline console — a small BERT with its own tokenizer (the text-splitting rules it was trained with), 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 — the pre-configured execution environment that ships PyTorch and 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.

Images, PDF or text. Kept on this device only.
Keeping your files on this device

Off by default. The mentor always gets your file; this only decides whether your own copy stays here. Copies live in this browser only - they do not follow you to another device, and clearing site data removes them.

Ctrl/Cmd + Enter to send

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.

My notes on this module

Loading your notes...

Production Case — TinyBERT, Packaged to Monitored — TransformerLab