Module 12 · Responsible systems

Module 12: Deployment and monitoring

Read the overview and learning outcomes here, then follow the learning route. Return to this page’s run instructions for the complete study.

Expose shared model inference through a checked local app and rehearse monitoring with actual held-out records.

This module works independently: no earlier notebook state, Canvas assignment, paid AI account, or GPU is required. Allow approximately 2–3 hours plus first installation/downloads. Small CPU runs demonstrate mechanisms, not production readiness.

Learning outcomes

Learning route

Follow foundation → concepts and small cases → guided construction → independent practice. Use solutions after your attempt, then connect your work to the complete reference below.

Entry support and topics

Use the foundation bridge if these concepts are new. Basic Python/functions/files and the train/validation/test distinction are assumed with support from Module 2 and Module 5.

Training and serving must use the same feature order, transformation, and threshold. Schema validation protects the contract, but does not guarantee in-distribution inputs. Monitoring combines input quality, score/outcome behavior, resource cost, and operational responsibilities.

Real data and its limits

UCI Wine Quality and SMS Spam Collection; actual records supply app defaults, inference, and replay. See the source register.

Sources, licenses, hashes, and model provenance distinguish external records from original teaching code. No generated dataset or invented labels are used in this module. Public files still require responsible handling. Source versions are fixed after verified acquisition; changed cached/upstream bytes cause an error. The first data/model download requires internet; retain the cache for offline replay.

The complete workflow

The app's default numeric values come from one actual held-out wine record. Checked inference rejects missing/extra fields, booleans, nonfinite values, and a documented technical range; it flags departures from observed training ranges. A separate form performs local LLM triage with strict rejection. Four actual-record batches measure durations and a training-referenced mean-shift diagnostic; source row order is not event time.

Run and inspect

Download the complete source or use a checkout. Work from its ml_ai_it folder. Use the isolated CPU framework environment. Run framework commands in the Linux CPU reference environment; see the support matrix for platform coverage. Reading the reports needs no framework installation. In commands below, python means your environment executable; use its full path if not activated. If a download link does not open, use the offline access route.

python examples/model-service/scripts/run.py --output runs/module12

Use a fresh output directory for a new run; completed studies are not silently overwritten. Open runs/module12/index.html or read summary.txt/summary.json and the companion CSV tables. Read the verified worked report without installing an execution interface.

Key artifacts:

The shared implementation is under src/practical_ml_ai; scripts and commented notebook call the same functions. Keep the notebook inside the complete source tree. Named results and captioned/scoped tables support interpretation without a chart or screenshot. For interface choices and test coverage, see the accessibility guide.

To launch the local interface after installing the deployment/framework extras:

python -m streamlit run apps/wine_quality.py --server.address 127.0.0.1

The app has classifier and local-LLM forms. The CLI/text report remains a usable route when an interface is a barrier.

Read selectively

Practice and continue

Complete original practice, then compare worked feedback. Instructor notes map evidence and explain adaptation.

Next: Module 13.

Build understanding step by step

Use the guided construction and mastery check before the full study. New programmers should start with Python Foundation and readiness; use the glossary for notation.

Optional project connection

The complete project exemplar connects development, frozen inference, invalid-input handling, offline monitoring and a rollback decision. It is an optional local delivery demonstration, not a live service.