Bird
Raised Fist0
MLOpsdevops~20 mins

Model stages (staging, production, archived) 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 Stage Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding Model Stages Purpose

Which statement best describes the purpose of the staging stage in a model lifecycle?

AIt is where the model is tested in an environment similar to production before full deployment.
BIt is the final stage where the model is actively used to make predictions for users.
CIt is where old models are stored and no longer used for predictions.
DIt is the initial phase where the model is being trained and developed.
Attempts:
2 left
💡 Hint

Think about the stage that acts as a 'practice run' before the model goes live.

💻 Command Output
intermediate
2:00remaining
Identifying Model Stage from CLI Output

You run a command to list models and their stages. What is the stage of the model named sales_forecast_v2?

MLOps
Model Name          Stage
sales_forecast_v1   archived
sales_forecast_v2   production
sales_forecast_v3   staging
Astaging
Barchived
Cproduction
Dtraining
Attempts:
2 left
💡 Hint

Look at the row with the model name sales_forecast_v2.

🔀 Workflow
advanced
3:00remaining
Correct Workflow for Promoting a Model to Production

Which sequence correctly describes the workflow to promote a model from staging to production?

A1,2,3,4
B2,1,4,3
C1,3,2,4
D3,1,2,4
Attempts:
2 left
💡 Hint

Think about testing before deploying and cleaning up old models after deployment.

Troubleshoot
advanced
2:00remaining
Troubleshooting Model Stage Mislabeling

You notice a model labeled as production is actually outdated and should not serve predictions. What is the best immediate action?

AIgnore the label and continue using the model.
BDelete the model files from storage immediately.
CRetrain the model and keep the stage as production.
DChange the model stage to <code>archived</code> to prevent it from being used.
Attempts:
2 left
💡 Hint

Think about how to stop the model from being used without losing data.

Best Practice
expert
3:00remaining
Best Practice for Managing Archived Models

What is the best practice for handling archived models in a production system?

AUse archived models as the default for new predictions.
BKeep archived models in a separate storage with restricted access for audit and rollback purposes.
CMove archived models back to staging for retraining without review.
DDelete archived models immediately to save storage space.
Attempts:
2 left
💡 Hint

Consider the importance of old models for audits and recovery.

Practice

(1/5)
1. What is the primary purpose of the staging stage in model lifecycle management?
easy
A. To deploy models for live user traffic
B. To test and validate models before they go live
C. To permanently delete old models
D. To archive models for long-term storage

Solution

  1. Step 1: Understand model stages

    The staging stage is used to test and validate models before they are deployed to production.
  2. Step 2: Differentiate from other stages

    Production is for live use, archived is for storage, so staging is the testing phase.
  3. Final Answer:

    To test and validate models before they go live -> Option B
  4. Quick Check:

    Staging = Testing phase [OK]
Hint: Staging means testing before live use [OK]
Common Mistakes:
  • Confusing staging with production
  • Thinking archived means active use
  • Assuming staging is for deleting models
2. Which MLflow command correctly transitions a model version to the production stage?
easy
A. mlflow models transition-version --model-name my_model --version 3 --stage production
B. mlflow model transition-version --model-name my_model --version 3 --to-stage production
C. mlflow models transition-version --model-name my_model --model-version 3 --stage production
D. mlflow models transition --model-name my_model --model-version 3 --stage production

Solution

  1. Step 1: Recall MLflow CLI syntax

    The correct MLflow CLI command to transition a model version is mlflow models transition-version with flags --model-name, --version and --stage.
  2. Step 2: Identify correct flags and command

    mlflow models transition-version --model-name my_model --version 3 --stage production matches the correct syntax.
  3. Final Answer:

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

    Correct MLflow syntax = mlflow models transition-version --model-name my_model --version 3 --stage production [OK]
Hint: Use 'transition-version' with --version and --stage flags [OK]
Common Mistakes:
  • Using 'model' instead of 'models'
  • Mixing up --model-version and --version flags
  • Incorrect command order or missing flags
3. Given this MLflow Python snippet, what will be the stage of the model after execution?
from mlflow import MlflowClient
client = MlflowClient()
client.transition_model_version_stage(
    name="my_model",
    version=2,
    stage="archived"
)
medium
A. Archived
B. Production
C. Staging
D. None (error)

Solution

  1. Step 1: Understand the method call

    The method transition_model_version_stage changes the stage of a model version to the specified stage.
  2. Step 2: Check the stage argument

    The stage argument is set to "archived", so the model version 2 of "my_model" will be moved to archived stage.
  3. Final Answer:

    Archived -> Option A
  4. Quick Check:

    transition_model_version_stage with stage='archived' = Archived [OK]
Hint: Stage argument sets the model's new stage directly [OK]
Common Mistakes:
  • Assuming default stage if not specified
  • Confusing method name with other MLflow functions
  • Thinking 'archived' means deletion
4. You run this MLflow CLI command but get an error:
mlflow models transition-version --version 5 --stage production
What is the most likely cause?
medium
A. The command should be mlflow model transition-version (singular 'model')
B. Incorrect stage name; should be 'prod' instead of 'production'
C. Version number must be a string, not a number
D. Missing the --model-name argument

Solution

  1. Step 1: Check required arguments for transition-version

    The mlflow models transition-version command requires the --model-name argument to specify which model to update.
  2. Step 2: Identify missing argument

    The command lacks --model-name, causing the error.
  3. Final Answer:

    Missing the --model-name argument -> Option D
  4. Quick Check:

    Missing required flags cause errors [OK]
Hint: Always include --model-name when transitioning versions [OK]
Common Mistakes:
  • Assuming stage names are abbreviated
  • Using singular 'model' instead of 'models'
  • Passing version as string instead of number (both accepted)
5. You have two model versions: v1 in production and v2 in staging. You want to promote v2 to production and archive v1 using MLflow Python API. Which sequence of calls correctly achieves this?
hard
A. client.transition_model_version_stage('model', 2, 'archived') then client.transition_model_version_stage('model', 1, 'production')
B. client.transition_model_version_stage('model', 2, 'production') then client.transition_model_version_stage('model', 2, 'archived')
C. client.transition_model_version_stage('model', 1, 'archived') then client.transition_model_version_stage('model', 2, 'production')
D. client.transition_model_version_stage('model', 1, 'production') then client.transition_model_version_stage('model', 2, 'staging')

Solution

  1. Step 1: Archive current production version first

    To free the production stage, first move v1 from production to archived.
  2. Step 2: Promote staging version to production

    After archiving v1, promote v2 from staging to production.
  3. Final Answer:

    Archive v1 then promote v2 -> Option C
  4. Quick Check:

    Archive old before promoting new [OK]
Hint: Archive old production before promoting new [OK]
Common Mistakes:
  • Promoting new before archiving old causes stage conflict
  • Archiving staging version instead of production
  • Reassigning stages incorrectly