MLOps Observer
← All labs

Model serving and feature contracts / Intermediate / 20–30 min

The prediction request that no longer fits

A model service is healthy, but its prediction requests fail. Investigate feature schema drift and restore inference for a synthetic payload.

LAB IDmlops-01-inference-schema-driftTRACK / mlops.observer
Engineer monitoring model training beside GPU servers

The scenario

A local inference service starts successfully, yet a producer's request is rejected. Compare the producer's payload with the model's input contract and restore the prediction without changing the model or the synthetic measurements.

Mission objectives

  • Reproduce the failed prediction request.
  • Inspect the model's input contract and producer payload.
  • Restore a valid request and verify its prediction.

Lab README

Inference schema drift

A model-serving process is healthy, but its producer receives an error instead of a prediction. Investigate the mismatch between the request and the model's feature contract.

The exercise uses a deliberately simple illustrative logistic model with fixed coefficients and synthetic measurements. Its output is for troubleshooting practice, not a trained or validated prediction.

Before you begin

You need Bash, Python 3, Docker and Docker Compose on a disposable local machine. The first run may download a Python container image. No cloud account, real data or host port is used. Docker still consumes local disk, compute and network bandwidth, and a Docker host in the cloud may incur charges.

The exercise creates Compose project breakfix-mlops-01 and mounts this lab directory read-only inside its container. Do not reuse the project name for another workload. Your changes to the payload remain on the host after teardown; re-extract the archive to reset the exercise.

Start the incident

Run ./setup.sh from this directory. The script starts the service and confirms the prediction request is rejected. Reproduce the request with docker compose -p breakfix-mlops-01 exec inference python /lab/client.py; inspect the error, model artifact and input payload.

Verify and clean up

After correcting the request contract without changing the model or measurements, run ./verify.sh. It checks that the original values reach the model and the prediction matches the model's calculation. Run ./teardown.sh to remove the lab container and network. Setup refuses to reuse an existing project, and teardown refuses containers belonging to a different directory.

View Markdown source ↗

Get the lab

Download and inspect the installer before running it. It checks the archive's SHA-256 digest and refuses to overwrite an existing lab directory.

curl -fsSLO https://devops.download/labs/mlops-01-inference-schema-drift.sh
less mlops-01-inference-schema-drift.sh
bash mlops-01-inference-schema-drift.sh
cd labs/mlops-01-inference-schema-drift
./setup.sh

When you've made your changes, run ./verify.sh. Remove lab resources with ./teardown.sh.

Download the archive instead ↗

Need a nudge?

Hint #1

A healthy process does not guarantee that its prediction endpoint accepts the producer's payload.

Hint #2

Compare feature names in the request with the model artifact; preserve the original measurement values.

Hint #3 · Learning paths on opsbreakfix.com

Explore learning paths ↗

Solved it?

Continue learning with the paths on opsbreakfix.com.

Continue to opsbreakfix.com ↗