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.

The ZenML Model Control Plane is a ZenML Pro feature. While the Python functions for creating and interacting with models are available in the open-source version, the visual dashboard for exploring and managing models is only available in ZenML Pro. Please sign up here to get access to the full model management experience.

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.

A ZenML Model is different from a "technical model" (the actual ML model files with weights and parameters) or "agent configuration" (prompt templates, tool definitions, etc.). These technical artifacts are just components that can be associated with a ZenML Model, alongside training data, predictions, evaluation results, and other resources.

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

While all Model Control Plane functionality is accessible programmatically through the Python SDK in both OSS and Pro versions, the visual dashboard shown below is only available in ZenML Pro.

Model Control Plane Overview in ZenML Pro Dashboard

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 production

  • production: Currently deployed in a production environment

  • latest: 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.

While metadata tracking is available in both OSS and Pro versions through the Python SDK, visualizing and exploring model metrics through a dashboard interface is only available in ZenML Pro.

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.

OSS vs Pro Feature Summary:

  • ZenML OSS: Includes all the programmatic (Python SDK) model features described in this guide

  • ZenML Pro: Adds visual model dashboard, advanced model exploration, comprehensive metrics visualization, and integrated model lineage views

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.

ZenML Scarf

Last updated

Was this helpful?