Build garageTry it → read → next · ~11 min

Tutorials · Chapter D (4/4) · ~11 min

Model deployment

Try it → see it → read → next

Move a tested model behind a reliable interface, then prove you can observe and recover it.

Try yourself

Playground

Deploy desk

Deploy → Break → HealthCheck (see red) → Rollback or Canary to recover.

Endpoint health

No deploy yet

Green — looking steady.

Recap

What you just did

DeployDeskSim shipped a fake endpoint, broke it, ran a health check, then recovered with rollback or canary. Deployment means interface + observe + recover.

Teach

How it works

The serving boundary can stay small:

def predict_endpoint(payload):
    if "features" not in payload:
        return {"error": "features required"}, 400

    features = payload["features"]
    prediction = model.predict([features])[0]
    return {
        "prediction": prediction,
        "model_version": "2026-07-15",
    }, 200
  1. Package model code, artifact, and dependencies
  2. Validate incoming data before prediction
  3. Serve through an API, batch job, or edge process
  4. Observe latency, errors, drift, and output quality
  5. Rollback when a release behaves badly

Mental model: deployment turns a model into a maintained product boundary, not a one-time file upload.

Use it

When you'd use this

  • Serving predictions to a web or mobile app
  • Running nightly scores over a batch of records
  • Releasing a new model version gradually

Watch out

Watch out

Training metrics do not guarantee production safety. Inputs drift, dependencies fail, and sensitive data may enter logs. Start with limited traffic, redact logs, define an owner, and keep the previous working version available.

Try next

Try this next

Invent one malformed request and one out-of-range feature. Decide the status and message each should return without calling the model.