Skip to content
Tutorials Center
My learning

Topics

Lesson 39 of 41 ยท Projects and Practice

Project: An End-to-End Mini MLOps Pipeline

Build a small but complete MLOps pipeline: validate data, fingerprint, train, gate, register, document, serve predictions and log them with lineage.

Time to combine the chapters. In this project you will build a miniature MLOps system in one Python file. It has no servers and no cloud accounts, so it runs right here in your browser, but every part mirrors a real component: validation, fingerprinting, training, a quality gate, a registry, a model card, a prediction function that logs each request, and a rollback.

Build it in five steps. Each step is a runnable block; the final step ties them together. You can edit any piece and rerun it.

The plan

flowchart LR
  A["1. Validate data"] --> B["2. Train + fingerprint"]
  B --> C["3. Gate vs champion"]
  C --> D["4. Register + model card"]
  D --> E["5. Serve + log predictions"]

Each step hands a small, well-defined object to the next.

Step 1: data and validation

Python Step 1: data, schema and validation

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Step 2 to 4: train, gate, register, document

Python Steps 2-4: train, gate, register, card

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The second release (its labels were scrambled) is rejected by the gate; the first and third are promoted, and each decision is in the audit list. A rejected candidate does not use up a version number in the registry, so the third release is churn:2. The card records the data fingerprint and parameters.

Step 5: serve and log predictions

Python Step 5: serve, log, roll back

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Every logged request carries the model version, so the lineage chain from Lineage and Audit Trails is unbroken.

Make it your own

Extend the project, one change at a time, and rerun each time:

  1. Add a fairness check on age bands to the gate (Fairness and Bias Checks).
  2. Add a fingerprint cache so unchanged data is not retrained (Continuous Training Pipelines).
  3. Add a drift check on incoming requests against the training data (Detecting Data Drift).
  4. Make predict reject out-of-range values using the schema from step 1.
  5. Add a bake period and automatic rollback (Automating the Retraining Loop).

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. In the project, what makes the second release fail?

    Its labels were scrambled, so its AUC drops to chance level, below the floor and below the champion.
  2. 2. Why does predict return a 422-style error for a missing field?

    Input validation at the boundary protects the model and gives callers a clear message.
  3. 3. Why log the model version with each prediction?

    That version is the entry point of the lineage chain.
  4. 4. Which part of the project corresponds to a model registry?

    It stores model versions, their cards and their stage (production or archived).
  5. 5. What is the benefit of rollback being a single state change?

    Keeping the previous model loaded and switching a pointer takes seconds.

Summary

  • You built validate, fingerprint, train, gate, register, document, serve, log and roll back in one small system.
  • Each real tool (MLflow, DVC, Airflow, KServe and others) implements one or more of these pieces at scale.
  • Small, explicit objects (a card, a log entry, a registry row) make the system easy to inspect.
  • Extend the project to practice the remaining chapters.

Next: Project: A Drift Monitoring Report