Cert EspressoLearn. Practise. Find your flow.

A LITTLE FOCUS.
A BIG NEXT STEP.

Your pace. Your space.
Databricks · Databricks Machine Learning Professional

The model lifecycle and the deploy code strategy

Databricks Machine Learning Professional · Lesson 13 of 22 · 1:35:37

YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗

Learning with these videos? Subscribe for new courses and exam-style questions.

In this lesson

Prepare for the Databricks Certified Machine Learning Professional exam. In this lesson: deploy models or deploy code, the development, staging, and production environments, production pipelines for training, validation, deployment, and inference, and the Databricks features for each step. Includes three original practice questions.

Study notes

The text of this lesson, to read at your own pace. Information as of November 2026.

Copied by email

Pebblecove's cancellation model was trained in a notebook, saved by hand, and copied to production by email, and nobody can say which code produced the model that runs today. Section two is about MLOps: moving models from development to production in a way that is repeatable and tested. This lesson covers the deploy code strategy, its three environments, and the Databricks feature behind each step of the model lifecycle.

Deploy models or deploy code

There are two patterns to move machine learning into production. Deploy models trains the model in development, then promotes the model artifact itself through staging to production, which suits a model that is very expensive or hard to reproduce, or a single workspace without continuous integration. Deploy code promotes the training code instead: the same code trains the model in development, in staging on a small subset of data during integration tests, and in production on the full production data. That is why Databricks recommends deploy code in most situations: production data stays in production, and automated retraining is safer, since the training code was reviewed and tested. Its cost is a steeper handoff for data scientists, which project templates like MLOps Stacks reduce.

Three environments

In the recommended workflow, each environment is usually a separate catalog in Unity Catalog, or a separate workspace: development, staging, and production. In development, data scientists explore the data and write the code in a Git branch, track their runs in MLflow, and can often read production data, without writing to it. In staging, a pull request to the main branch runs the unit tests, then the integration tests in an environment that mimics production, and a merge is followed by a release branch. In production, the release branch drives the production jobs, which run as service principals, not as personal accounts.

Production pipelines

In production, a training job trains the model on production data, logs it to MLflow, and registers it in Unity Catalog as a new version. A validation step checks the new version, for example its format, its metadata, and its performance on important slices, then marks it with the Challenger alias. A deployment step compares the Challenger against the current Champion, offline or online, and moves the Champion alias when the Challenger wins. Model Serving then serves the Champion in real time, while batch and streaming inference jobs load the model by its alias. And monitoring watches the data and the predictions, and can trigger retraining when they drift.

Databricks features for each step

Each step of the lifecycle maps to a Databricks feature. Git folders and notebooks hold the code, MLflow tracks the experiments, and Unity Catalog governs the data, the features, and the registered models, with versions, aliases, and lineage. Lakeflow Jobs run training, validation, deployment, and batch inference, and Declarative Automation Bundles describe these resources as code, deployed by continuous integration. Model Serving hosts the endpoints, and its inference tables log the requests and responses. And data profiling, formerly Lakehouse Monitoring, tracks the quality of the data and of the model over time, with alerts that can start retraining.

Recap

Let's recap. Deploy code promotes the training code, and trains the model in each environment, which Databricks recommends in most cases. Development, staging, and production are usually separate catalogs or workspaces. A pull request runs unit tests, then integration tests in staging, and a release branch drives production. In production, a training job registers a version, validation marks a Challenger, and deployment moves the Champion. And MLflow, Unity Catalog, Lakeflow Jobs, Model Serving, and data profiling cover each step.

Quick checks for this lesson

The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.

  1. Data scientists cannot read production data from development, for security reasons, and the model must be retrained every week. Which pattern fits?

    • Deploy models, trained once in development
    • Deploy code, trained in production on production data
    • Deploy models, with weekly copies of production data
    • Neither: retrain by hand in production
    Show the answer

    Deploy code, trained in production on production data

    With deploy code, the reviewed training code runs in production, on production data, and the weekly retraining is automated safely. “Deploy models, trained once in development” would train on development data, since production data cannot be read there. “Deploy models, with weekly copies of production data” would copy production data into development, which the security rule forbids. And “Neither: retrain by hand in production” would give up on review and automation.

  2. In the deploy code workflow, where do the final integration tests run, before the code reaches production?

    • In production, on the first scheduled run
    • In development, on a feature branch
    • Nowhere: unit tests are enough
    • In staging, which mimics production
    Show the answer

    In staging, which mimics production

    After a pull request, the integration tests run in staging, which mimics production, before the merge and the release. “In production, on the first scheduled run” would test too late, on live data. “In development, on a feature branch” is wrong, since final integration testing belongs to staging in this pattern. And “Nowhere: unit tests are enough” is wrong, since unit tests check functions in isolation, not the pipelines together.

  3. Which Databricks feature tracks drift in a model's inputs and predictions over time?

    • Data profiling, formerly Lakehouse Monitoring
    • MLflow experiment tracking
    • Declarative Automation Bundles
    • Git folders
    Show the answer

    Data profiling, formerly Lakehouse Monitoring

    Data profiling computes statistics and drift metrics on a table over time, including inference tables. “MLflow experiment tracking” would track training runs, not production data. “Declarative Automation Bundles” would deploy resources as code. And “Git folders” would hold the code.