Models
Managing ML models throughout their lifecycle with ZenML
Machine learning models and AI agent configurations are at the heart of any ML workflow and AI system. ZenML provides comprehensive model management capabilities through its Model Control Plane, allowing you to track, version, promote, and share both traditional ML models and AI agent systems across your pipelines.
This guide covers all aspects of working with models in ZenML, from basic concepts to advanced usage patterns.
Understanding Models in ZenML
What is a ZenML Model?
A ZenML Model is an entity that groups together related resources:
Pipelines that train, evaluate, or deploy the model or agent system
Artifacts like datasets, model weights, predictions, prompt templates, and agent configurations
Metadata including metrics, parameters, evaluation results, and business information
Think of a ZenML Model as a container that organizes all the components related to a specific ML use case, business problem, or AI agent system. This extends beyond just model weights or agent prompts - it represents the entire ML product or intelligent system.
The Model Control Plane
The Model Control Plane is ZenML's unified interface for managing models throughout their lifecycle. It allows you to:
Register and version models
Associate pipelines and artifacts with models
Track lineage and dependencies
Manage model promotions through stages (staging, production, etc.)
Exchange data between pipelines using models

Working with Models
Registering a Model
You can register models in several ways:
Using the Python SDK
Using the CLI
Using a Pipeline
The most common approach is to register a model implicitly as part of a pipeline:
Model Versioning
Each time you run a pipeline with a model configuration, a new model version is created. You can:
Explicitly Name Versions
Use Templated Naming
Linking Artifacts to Models
Artifacts produced during pipeline runs can be linked to models to establish lineage and enable reuse:
Model Promotion
Model stages represent the progression of models through their lifecycle. ZenML supports the following stages:
staging: Ready for final validation before productionproduction: Currently deployed in a production environmentlatest: The most recent version (virtual stage)archived: No longer in use
You can promote models to different stages:
Using Models Across Pipelines
One of the most powerful features of ZenML's Model Control Plane is the ability to share artifacts between pipelines through models.
Pattern: Model-Mediated Artifact Exchange
This pattern allows pipelines to exchange data without knowing the specific artifact IDs:
This pattern enables clean separation between training and inference pipelines while maintaining a clear relationship between them.
Tracking Metrics and Metadata
ZenML allows you to attach metadata to models, which is crucial for tracking performance, understanding training conditions, and making promotion decisions.
Logging Model Metadata
Fetching Model Metadata
You can retrieve logged metadata for analysis or decision-making:
Deleting Models
When a model is no longer needed, you can delete it or specific versions:
Deleting All Versions of a Model
Deleting a Specific Version
Best Practices
Consistent Naming: Use consistent naming conventions for models and versions
Rich Metadata: Log comprehensive metadata to provide context for each model version
Promotion Strategy: Develop a clear strategy for promoting models through stages
Model Association: Associate pipelines with models to maintain lineage and enable artifact sharing
Versioning Strategy: Choose between explicit versioning and template-based versioning based on your needs
Conclusion
The Model Control Plane in ZenML provides a comprehensive solution for managing both traditional ML models and AI agent systems throughout their lifecycle. By properly registering, versioning, linking artifacts, and tracking metadata, you can create a transparent and reproducible workflow for your ML projects and AI agent development.
Whether you're working on a simple classification model, a complex production ML system, or a sophisticated multi-agent AI application, ZenML's unified model management capabilities help you organize your resources and maintain clarity across your entire AI development lifecycle.
Last updated
Was this helpful?