ZenML

On this page 7

ZenML is an open-source Python framework for building portable machine learning pipelines that separate the code of each workflow from the infrastructure that executes it. In MLOps & deployment, it acts as an abstraction layer over orchestrators, artifact stores, experiment trackers and model deployers, so a team can develop a pipeline on a laptop and run the same definition on Kubernetes or a managed cloud service without rewriting it.

The framework is released under the Apache 2.0 license, with a commercial managed edition that adds access control and hosted servers. Within artificial intelligence engineering, ZenML is best understood as glue between specialized tools rather than a replacement for them: it records lineage, artifacts and metadata for every run while delegating scheduling, storage and serving to the components the organization already uses.

How ZenML structures a pipeline

A ZenML pipeline is a directed acyclic graph of steps, written as ordinary Python functions decorated with @step and composed inside a function decorated with @pipeline. Each step declares typed inputs and outputs, and ZenML infers the execution order from data dependencies between them rather than from explicit wiring.

Every value returned by a step becomes a versioned artifact. A component called a materializer serializes the object, for example a pandas DataFrame or a PyTorch model, writes it to the artifact store and reads it back for downstream steps. Because inputs, code and parameters are hashed, ZenML can apply step caching and skip a step whose inputs have not changed, which shortens iterative development considerably.

The following table summarizes the core building blocks that appear in almost every ZenML project.

ConceptWhat it isWhy it matters
StepDecorated Python function with typed inputs and outputsUnit of work, caching and retry
PipelineGraph of steps defined in a decorated functionReproducible end-to-end workflow
ArtifactVersioned output stored in the artifact storeLineage and reuse across runs
MaterializerSerializer for a specific data typeControls how objects are stored
StackNamed set of infrastructure componentsDecides where and how code runs
ModelGrouping of artifacts and runs under a model versionPromotion and governance
Core ZenML concepts

Stacks and stack components

The stack is the central idea that makes ZenML pipelines portable. A stack is a named combination of stack components, and switching the active stack with a single CLI command moves execution from local processes to a remote cluster while the pipeline code stays identical. Only an orchestrator and an artifact store are mandatory; the other components are optional.

Each component category has several flavors, which are concrete integrations. Cloud credentials are handled by service connectors, which issue short-lived credentials to components so that secrets do not have to be copied into pipeline code or container images.

ComponentRole in the stackExample flavors
OrchestratorSchedules and runs pipeline stepsLocal, Kubernetes, Kubeflow, Airflow, SageMaker, Vertex AI
Artifact storePersists step outputsLocal disk, Amazon S3, Google Cloud Storage, Azure Blob
Container registryHolds images for remote executionAmazon ECR, Google Artifact Registry, Docker Hub
Experiment trackerLogs metrics and parametersMLflow, Weights & Biases, Neptune
Step operatorRuns a single step on special hardwareSageMaker, Vertex AI, Kubernetes
Model deployerServes trained modelsMLflow, Seldon Core, BentoML
Data validatorChecks data quality and driftEvidently, Great Expectations, Deepchecks
Common stack component categories

Remote orchestrators require each step to run in a container image. ZenML builds these images automatically from declared requirements and an image builder component, which removes manual Dockerfile maintenance but adds build time and registry costs that teams should plan for.

Metadata, lineage and the model control plane

ZenML stores run information in a metadata store backed by a ZenML server, usually with a MySQL database in production setups. The server records which code version, parameters, stack and input artifacts produced every output, giving teams end-to-end model lineage that can be browsed in a web dashboard or queried through the Python client.

The model control plane groups pipelines, artifacts and metadata under a named model and its versions. Versions can be moved through stages such as staging and production, which supports model promotion workflows and makes rollback a matter of re-pointing a stage to an earlier version rather than reconstructing old training conditions.

ZenML overlaps with several neighbors in the MLOps landscape, but its position differs: it is an orchestrator-agnostic framework rather than an execution engine or a managed platform. The comparison below highlights the practical distinction.

ToolPrimary focusRelationship to ZenML
Kubeflow PipelinesPipeline execution on KubernetesCan serve as a ZenML orchestrator
MetaflowData science workflows with own runtimeAlternative framework with similar goals
KedroProject structure and data catalogComplementary; focuses on code organization
MLflowExperiment tracking and model registryIntegrated as tracker and deployer
Amazon SageMakerManaged end-to-end cloud platformCan serve as orchestrator or step operator
ZenML and neighboring MLOps tools

The key trade-off is portability versus depth. A team committed to one cloud may get richer native features from that provider directly, while a team expecting to change infrastructure, or running hybrid environments, gains most from ZenML’s vendor-neutral abstraction.

Limitations and common mistakes

ZenML adds another layer to operate and upgrade, and abstraction does not remove the need to understand the underlying orchestrator. Debugging a failed Kubernetes pod, for example, still requires Kubernetes knowledge, and not every orchestrator flavor supports every feature such as scheduling or step retries in the same way.

SymptomLikely causeRecommended fix
Step reruns despite unchanged dataNon-deterministic inputs or code editsPin parameters and review cache keys
Remote run cannot load an artifactMissing or custom type without materializerWrite a custom materializer
Slow remote startupImage rebuilt on every runReuse images and pin requirements
Credential errors in the cloudSecrets embedded in codeUse service connectors
Large artifacts fill storageEvery intermediate output is persistedSet retention rules and trim outputs
Typical problems and their fixes

A frequent design mistake is treating ZenML as a model serving platform. It coordinates deployment through model deployer components, but low-latency inference still depends on a dedicated serving system such as KServe or BentoML behind it.

Put simply

ZenML is a recipe book for machine learning work. A team writes each step once: load data, train a model, test it. ZenML remembers every ingredient and every result.

The kitchen can change. Today the recipe runs on one laptop. Tomorrow it runs in a large cloud data center. The recipe itself does not need rewriting. ZenML simply sends it to the new kitchen and keeps a record of what happened.

In practice

A mid-sized insurance company trains a claims fraud model every week. Its data scientists develop the pipeline locally with a small sample, using a local orchestrator and a local artifact store. When the pipeline is ready, an engineer switches the active stack to one that uses Kubernetes as orchestrator, Amazon S3 as artifact store and MLflow as experiment tracker.

Each weekly run loads new claims, validates them for data drift with Evidently, retrains a gradient boosting model and compares it with the current production version. If the new version improves recall by at least two percentage points without lowering precision, a final step promotes it to the production stage. When a regulator later asks how a specific decision model was built, the team opens the dashboard and shows the exact data, code and parameters, which cuts the audit preparation from days to under an hour.