Bird
Raised Fist0
MLOpsdevops~20 mins

Promoting models between stages in MLOps - Practice Problems & Coding Challenges

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Challenge - 5 Problems
🎖️
Model Promotion Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding Model Promotion in MLOps Pipelines

What is the primary purpose of promoting a machine learning model from a staging environment to production in an MLOps pipeline?

ATo test the model with new data before final deployment
BTo archive the model for future reference
CTo make the model available for real users and applications
DTo retrain the model with additional datasets
Attempts:
2 left
💡 Hint

Think about what 'production' means in software and model deployment.

💻 Command Output
intermediate
2:00remaining
Output of Model Promotion Command

Given the command below to promote a model version in MLflow, what is the expected output?

mlflow models transition-stage --model-name my_model --version 3 --stage Production
AModel version 3 transitioned to stage Production successfully.
BError: Model version 3 does not exist.
CModel version 3 is already in Production stage.
DSyntax error: missing required flags.
Attempts:
2 left
💡 Hint

Assume the model version exists and the command syntax is correct.

Configuration
advanced
3:00remaining
Configuring Automated Model Promotion

Which YAML snippet correctly configures a CI/CD pipeline step to promote a model to Production only if tests pass?

A
steps:
  - name: Promote Model
    run: mlflow models transition-stage --model-name my_model --version ${{ env.MODEL_VERSION }} --stage Production
    when: always()
B
steps:
  - name: Promote Model
    run: mlflow models transition-stage --model-name my_model --version ${{ env.MODEL_VERSION }} --stage Production
    if: failure()
C
steps:
  - name: Promote Model
    if: cancelled()
    run: mlflow models transition-stage --model-name my_model --version ${{ env.MODEL_VERSION }} --stage Production
D
steps:
  - name: Promote Model
    if: success()
    run: mlflow models transition-stage --model-name my_model --version ${{ env.MODEL_VERSION }} --stage Production
Attempts:
2 left
💡 Hint

Promotion should happen only when previous steps succeed.

Troubleshoot
advanced
2:30remaining
Troubleshooting Model Promotion Failure

You run a model promotion command but receive the error: "Permission denied: cannot transition model stage." What is the most likely cause?

AThe user lacks permissions to change model stages.
BThe model version does not exist in the registry.
CThe model is already in the target stage.
DThe command syntax is incorrect.
Attempts:
2 left
💡 Hint

Think about access rights and roles in model registries.

🔀 Workflow
expert
3:00remaining
Correct Sequence for Model Promotion Workflow

Arrange the following steps in the correct order for promoting a machine learning model from staging to production:

A1,4,2,3
B4,1,2,3
C2,4,1,3
D4,2,1,3
Attempts:
2 left
💡 Hint

Think about the logical order from training to promotion.

Practice

(1/5)
1. What is the main purpose of promoting a machine learning model between stages like testing and production?
easy
A. To move a model to a more stable and reliable environment
B. To delete old versions of the model
C. To retrain the model with new data automatically
D. To change the model's algorithm

Solution

  1. Step 1: Understand model promotion

    Promoting a model means moving it from one stage to another, like from testing to production.
  2. Step 2: Identify the purpose of promotion

    This process ensures the model is stable and reliable before it is used live.
  3. Final Answer:

    To move a model to a more stable and reliable environment -> Option A
  4. Quick Check:

    Model promotion = move to stable environment [OK]
Hint: Promotion means moving model to a safer, stable stage [OK]
Common Mistakes:
  • Confusing promotion with retraining
  • Thinking promotion deletes models
  • Assuming promotion changes model algorithms
2. Which of the following is the correct command syntax to promote a model named my_model version 3 to the Production stage using MLflow CLI?
easy
A. mlflow models promote --name my_model --version 3 --stage Production
B. mlflow model promote --model my_model --ver 3 --to Production
C. mlflow models transition --name my_model --version 3 --stage Production
D. mlflow models transition-stage --model-name my_model --version 3 --stage Production

Solution

  1. Step 1: Identify correct MLflow CLI command

    The MLflow CLI uses mlflow models transition-stage to promote models between stages.
  2. Step 2: Check command options

    The correct options are --model-name, --version, and --stage to specify the model, version, and target stage.
  3. Final Answer:

    mlflow models transition-stage --model-name my_model --version 3 --stage Production -> Option D
  4. Quick Check:

    MLflow promote command = transition-stage with correct flags [OK]
Hint: Use 'transition-stage' with --model-name, --version, --stage flags [OK]
Common Mistakes:
  • Using 'promote' instead of 'transition-stage'
  • Wrong flag names like --name or --ver
  • Mixing singular/plural 'model' vs 'models'
3. Given the following MLflow CLI command:
mlflow models transition-stage --model-name sales_forecast --version 5 --stage Staging
What will be the result of running this command?
medium
A. The model version 5 of sales_forecast is moved to the Staging stage
B. The model sales_forecast version 5 is deleted
C. A new version 6 of sales_forecast is created in Staging
D. The model sales_forecast version 5 is retrained automatically

Solution

  1. Step 1: Understand the command purpose

    The command transition-stage moves a specific model version to a new stage.
  2. Step 2: Analyze the command parameters

    It targets model sales_forecast, version 5, moving it to Staging stage.
  3. Final Answer:

    The model version 5 of sales_forecast is moved to the Staging stage -> Option A
  4. Quick Check:

    transition-stage moves model version to new stage [OK]
Hint: transition-stage moves specified version to target stage [OK]
Common Mistakes:
  • Thinking it deletes or retrains the model
  • Assuming it creates a new version
  • Confusing model name and version
4. You run the command mlflow models transition-stage --model-name my_model --version 2 --stage Production but get an error saying "Stage 'Production' does not exist." What is the most likely cause and fix?
medium
A. The stage name is case-sensitive; change 'Production' to 'production'
B. The stage 'Production' is not registered; create the stage before promotion
C. The MLflow server is down; restart the server
D. The model version 2 does not exist; create it first

Solution

  1. Step 1: Analyze the error message

    The error says the stage 'Production' does not exist, meaning it is not registered in MLflow.
  2. Step 2: Determine the fix

    You must create or register the 'Production' stage before promoting a model to it.
  3. Final Answer:

    The stage 'Production' is not registered; create the stage before promotion -> Option B
  4. Quick Check:

    Stage must exist before promotion [OK]
Hint: Check if target stage exists before promoting model [OK]
Common Mistakes:
  • Assuming stage names are case-insensitive
  • Blaming model version existence
  • Ignoring server status
5. You want to automate promoting the best performing model version to Production only if it passes testing. Which approach best fits this requirement?
hard
A. Automatically promote every new model version to Production without testing
B. Manually run mlflow models transition-stage after testing
C. Use a CI/CD pipeline that runs tests, then promotes the model version to Production stage if tests pass
D. Delete all previous versions and keep only the latest model

Solution

  1. Step 1: Understand automation and testing requirements

    Automation requires a pipeline that runs tests and promotes models only if tests pass.
  2. Step 2: Evaluate options for automation

    Use a CI/CD pipeline that runs tests, then promotes the model version to Production stage if tests pass describes a CI/CD pipeline that tests and promotes automatically, matching the requirement.
  3. Final Answer:

    Use a CI/CD pipeline that runs tests, then promotes the model version to Production stage if tests pass -> Option C
  4. Quick Check:

    Automate with CI/CD pipeline and conditional promotion [OK]
Hint: Automate promotion with CI/CD pipeline after tests pass [OK]
Common Mistakes:
  • Promoting without testing
  • Manual promotion defeats automation
  • Deleting versions unnecessarily