metadata-models/docs/entities/mlModelDeployment.md
ML Model Deployments represent deployed instances of machine learning models running in production or other environments. They track the operational aspects of ML models, including their deployment status, platform, configuration, and lifecycle. Model deployments are distinct from ML models themselves - while an ML model represents the trained artifact, a deployment represents a specific instance of that model serving predictions in a particular environment.
ML Model Deployments are identified by three pieces of information:
sagemaker, azureml, vertexai, mlflow, seldon, kserve, etc. This corresponds to a data platform URN.An example of an ML model deployment identifier is urn:li:mlModelDeployment:(urn:li:dataPlatform:sagemaker,recommendation-endpoint,PROD).
The core metadata about a deployment is stored in the mlModelDeploymentProperties aspect. This includes:
IN_SERVICE: Active deployments serving predictionsOUT_OF_SERVICE: Deployments that are not currently serving trafficCREATING: Deployments being provisionedUPDATING: Deployments being updated with new configurationsROLLING_BACK: Deployments being reverted to a previous versionDELETING: Deployments being removedFAILED: Deployments in an error stateUNKNOWN: Deployments with unmapped or unknown statusThe following code snippet shows you how to create an ML model deployment.
<details> <summary>Python SDK: Create an ML model deployment</summary>{{ inline /metadata-ingestion/examples/library/mlmodel_deployment_create.py show_path_as_comment }}
ML Model Deployments are connected to their underlying ML Models through the mlModelProperties.deployments field. This relationship enables:
{{ inline /metadata-ingestion/examples/library/mlmodel_deployment_add_to_model.py show_path_as_comment }}
ML Model Deployments can have tags attached to them using the globalTags aspect. Tags are useful for:
Ownership is associated with a deployment using the ownership aspect. Owners can be technical owners (ML engineers, MLOps teams) or business owners (product managers, data scientists) who are responsible for the deployment. Ownership helps with:
{{ inline /metadata-ingestion/examples/library/mlmodel_deployment_add_owner.py show_path_as_comment }}
The dataPlatformInstance aspect provides additional context about the specific instance of the deployment platform. This is important when organizations have multiple instances of the same platform (e.g., multiple SageMaker accounts, different Azure ML workspaces, separate Kubernetes clusters).
Deployments can be marked as deprecated using the deprecation aspect when they are planned for decommissioning. This includes:
The status aspect can also be used to soft-delete a deployment (mark it as removed) when it has been taken down but you want to preserve the historical metadata.
Deployments can belong to a parent container (such as an ML workspace, namespace, or project) using the container aspect. This creates a hierarchical structure:
ML Workspace (Container)
├── Model Deployment 1
├── Model Deployment 2
└── Model Deployment 3
This hierarchy helps with:
ML Model Deployments are typically ingested automatically from ML platforms using DataHub's ingestion connectors:
Each connector maps platform-specific deployment metadata to DataHub's standardized deployment model.
You can retrieve deployment information using DataHub's REST API:
<details> <summary>Fetch deployment entity snapshot</summary>curl 'http://localhost:8080/entities/urn%3Ali%3AmlModelDeployment%3A(urn%3Ali%3AdataPlatform%3Asagemaker,recommendation-endpoint,PROD)'
The response includes all aspects of the deployment, including:
You can query deployment relationships to understand its connections to other entities:
<details> <summary>Find deployments for a specific ML model</summary>curl 'http://localhost:8080/relationships?direction=INCOMING&urn=urn%3Ali%3AmlModel%3A(urn%3Ali%3AdataPlatform%3Asagemaker,recommendation-model,PROD)&types=DeployedTo'
This returns all deployments of the specified ML model.
</details> <details> <summary>Find the ML model for a deployment</summary>curl 'http://localhost:8080/relationships?direction=OUTGOING&urn=urn%3Ali%3AmlModel%3A(urn%3Ali%3AdataPlatform%3Asagemaker,recommendation-model,PROD)&types=DeployedTo'
This returns the ML model that is deployed to the specified deployment.
</details>It's important to understand the distinction between ML Models and ML Model Deployments:
ML Model: Represents the trained model artifact, including training data, metrics, hyperparameters, and model metadata. A model can have multiple versions and can exist independently of any deployment.
ML Model Deployment: Represents a running instance of a model serving predictions. A deployment references a specific model version and includes operational metadata like status, configuration, and serving platform details.
This separation enables:
A single ML model can have multiple deployments simultaneously:
Each deployment is tracked as a separate entity with its own metadata.
Some platforms create temporary or ephemeral deployments (e.g., for batch inference jobs). These deployments may have short lifespans but are still valuable to track for:
Different ML platforms have varying concepts that map to deployments:
DataHub's deployment model abstracts these platform differences while preserving important platform-specific details in custom properties.
ML Model Deployments frequently interact with these other DataHub entities: