Module 5 · step 2 of 6 · Deploying and testing

Deploy a model

Put the best model behind a live endpoint on mlflow and read the deployment page.

App6 min

In this step you will put your model behind a live endpoint on mlflow and read the deployment page. It matters because a model nobody can call helps nobody: an endpoint lets applications ask it questions, and lets you test, monitor and roll back from one place.

The idea

A deployment is a live prediction endpoint that serves one specific model version at a stable address. The address is POST /api/v1/deployments/<slug>/predict and callers send raw column values: the preprocessing steps of your pipeline run inside the endpoint, so nobody has to reproduce them. The deployment points to a version, never to a moving target, so nothing changes under the people who depend on it until you deliberately switch versions.

Step by step

  1. Open your finished run and select Deploy best model in the run header. A dialog opens with the tabs Download, Deploy anywhere and Monitor it.
  2. Open Deploy anywhere and select Deploy on mlflow. The other cards create kits for your own infrastructure.
  3. If a dialog titled Promote and deploy appears, the model is not yet a pipeline version. Select Promote and continue; mlflow creates the version for you.
  4. In the Deploy dialog, enter an Endpoint slug, for example churn-demo. It uses 3 to 64 lowercase letters, digits and dashes and must be unique on the whole server, so add a few digits if it is taken.
  5. Keep the default under Access control, workspace members. In the demo this is the only mode available. Select Deploy.
  6. mlflow opens the deployment page. Check the status Active and look at the four tabs: Overview, Test, Monitor and Versions.
  7. Select Deployments in the sidebar. Your endpoint is listed on the Endpoints tab with its Status, Access and prediction counters, still at zero.

You cannot rename an endpoint. To use a different slug, deploy again.

Common mistakes

  • Choosing a slug that is malformed or already taken. The dialog refuses slugs outside 3 to 64 lowercase letters, digits and dashes, and slugs used elsewhere on the server.
  • Calling a workspace-mode endpoint from outside the app without credentials. The card Use this endpoint on Overview explains the access mode: workspace mode is for members with a session or an API key.
  • Dismissing the Promote and deploy prompt as a nuisance. It is what turns the trial into a versioned pipeline, and that version is what the endpoint serves.

As a data scientist

Deploy only a candidate you have registered and compared with the baseline and with the model currently in use. Treat the slug as a public name: describe the use case, not the experiment. Right after deploying, send a few test rows (next lessons) before anyone else depends on the endpoint.

Checkpoint

You should see a deployment page with the status Active and the tabs Overview, Test, Monitor and Versions.

Theory to read next

Read in the docs