CourseAI / ML Engineer: The Complete Course · Module 12: Foundation Models · part 72 of 93
Part 72 · Module 12: Foundation Models

Lesson 1: Adapting a small open model to Kestrel's messages

34 min read·
Module 12 · Lesson 1 · About 55 minutes · Needs: Module 4 lesson 3 (the message intents), Module 8 lesson 1 (quantisation and distillation) and PyTorch basics. GPU optional: everything runs on a CPU.

The situation

Week 12 at Kestrel. Hannah's team routes customer messages by hand. Module 4's transformer matched the first annotator on 0.808 of held-out messages; a TF-IDF baseline scores macro F1 0.855. Adaeze asks whether an adapted pretrained language model does better. Hannah's rule: customer text stays inside Kestrel, so the model must be open and run on Kestrel's machines.

The running example is message M0001 (simulated): "hiya you said tomorrow 4 my parcel. it is now late! Regards", which both annotators labelled delivery_late.

WHERE THIS FITS The Kestrel system this lesson SHARED SERVICES Depot scans parcels, routes Ingestion nightly batch Validation Pandera checks Data lake Parquet, DuckDB Experiments MLflow runs Training LightGBM, Optuna Online store Feast, Redis Features point in time Gates vs the champion Registry staged versions Serving API FastAPI, ONNX Consumers vans, customers Retraining trigger, budget Alerting on call Monitoring drift, Evidently Late labels a day later Orchestrator Prefect flows Versions DVC, Git CI/CD GitHub Actions Containers Docker images
Module 12 adapts a second, text model on the same training, experiment and registry path (blue); the late-risk system around it is grey.

The rest of this course is yours to keep

This course is bought on its own, once, and stays readable afterwards, including the parts added to it later.

Or open everything with a plan