ML Tools - MLflow
ML Tools - MLflow
MLflow
Managing the Machine
Learning Lifecycle
Kostya Numan
AI & AGI Researcher
Why MLflow
Problem:
ML projects are chaotic - scattered code, untracked
experiments, unclear deployment steps.
Solution:
MLflow helps track, reproduce, and deploy models --
all from one place.
Open Source:
MLflow is framework-agnostic and integrates easily
with popular ML libraries.
Kostya Numan
AI & AGI Researcher
Tracking Experiments
MLflow Tracking lets you log parameters, metrics, tags,
and artifacts for each run.
Backend:
Stores data locally, on cloud storage, or in SQL-based
tracking servers.
Kostya Numan
AI & AGI Researcher
Logging From Code
Logging is as simple as wrapping your training code with
`mlflow.start_run()`.
Best Practice:
Group related logs in a single run with nested structure
if needed.
Kostya Numan
AI & AGI Researcher
Model Packaging
MLflow Models standardize how models are saved and
loaded across frameworks.
Supported Flavors:
• Python function (pyfunc)
• scikit-learn
• TensorFlow
• PyTorch
• XGBoost
Format:
Each model includes code, conda environment, and
signature for inputs/outputs.
Custom Logic:
Use pyfunc wrapper to add preprocessing or postproc-
essing logic.
Kostya Numan
AI & AGI Researcher
Model Registry
Central hub to manage lifecycle of models - staging,
versioning, approval, deployment.
Version Control:
Each model can have multiple versions tracked with
metadata and stage labels.
Stages:
Move models across Staging ’ Production ’ Archived.
Approval Workflows:
You can require reviews or tests before promoting a
model.
UI + API:
Manage registry via web UI or Python REST client.
Kostya Numan
AI & AGI Researcher
Serving Models
Serve MLflow models locally or in production with
minimal setup.
REST API:
`mlflow models serve` launches a local REST endpoint
from any saved model.
Scalability:
Integrate with Kubernetes, SageMaker, or Azure ML
for scale.
Monitoring:
Track inference logs and request payloads for
debugging and auditing.
Third-party platforms like BentoML or Ray Serve can
wrap MLflow models too.
Kostya Numan
AI & AGI Researcher
Artifacts and Storage
MLflow can log arbitrary files: checkpoints, images, logs,
configs.
Where Stored:
Artifacts can go to local disk, S3, GCS, Azure Blob, or
custom stores.
Use Case:
Save model files, attention heatmaps, training curves,
or evaluation CSVs.
Access:
Artifacts are linked per run and accessible from the UI
or API.
Kostya Numan
AI & AGI Researcher
Deployment Options
Where You Can Deploy:
• Local REST server
• Kubernetes
• SageMaker
• Azure ML
• Databricks
• Custom Docker containers
Environment Repro:
Each model export includes conda.yaml or requirem-
ents.txt to recreate the env.
CI/CD:
Integrate with GitHub Actions or Jenkins to automate
retraining and deployment.
MLflow makes it easier to go from notebook to
production without reinventing infra.
Kostya Numan
AI & AGI Researcher
Advanced Use Cases
What Power Users Do:
• Track hundreds of experiments at scale
• Use MLflow in Airflow DAGs
• Build custom MLflow plugins
• Sync with external registries
• Version data alongside models
Multi-user:
MLflow supports access control and multi-user
tracking setups.
Auditing:
Track who ran what, when, and with which config.
Kostya Numan
AI & AGI Researcher
Subscribe
to Numan Substack
for more insights
Kostya Numan
AI & AGI Researcher