Tutorial MLflow
MLflow tutorial: experiment tracking, logging parameters, metrics and artifacts, models, the model registry, evaluation, tracing for LLM apps and deployment.
Getting Started
- What Is MLflow? Learn what MLflow is, which problems it solves for machine learning and LLM projects, what you need to know first, and how this tutorial is organized.
- Install MLflow and Log Your First Run Install MLflow in a virtual environment, log a first run, open the web UI, and understand where your tracking data is saved on your own computer.
- Runs, Experiments and Stores Understand MLflow experiments, runs, logged models, the backend store and the artifact store, and see how a tracking client connects to each of them.
Experiment Tracking
- Log Parameters and Metrics Log parameters and metrics in MLflow one at a time or in batches, record training curves with steps, and avoid common naming and logging mistakes.
- Artifacts, Tags and Datasets Save plots, reports and files as MLflow artifacts, organize runs with tags and notes, and record which dataset each run used so you can trace results.
- Search and Query Runs Filter and sort MLflow runs with the search syntax, quote values correctly, order results, and load runs into a table for your own analysis.
Autologging and Comparison
- Autologging Use MLflow autologging to capture parameters, metrics, signatures and models with one line, and learn what it records, what it misses and how to control it.
- Compare Runs and Choose a Winner Compare MLflow runs in the UI and in code, set a selection rule before looking, handle trade-offs between metrics and check whether a difference is real.
- Nested Runs and Hyperparameter Tuning Group tuning trials with MLflow parent and child runs, track every trial of a search, mark the best one and enable system metrics logging when needed.
Models and Signatures
- The MLflow Model Format See what is inside an MLflow Model folder, how the MLmodel file and flavors work, how to log and load a model, and why loading untrusted models is risky.
- Signatures and Input Examples Define what a model accepts and returns with MLflow signatures, add input examples and parameters, and learn the main schema enforcement rules.
- Custom PyFunc Models Wrap preprocessing, business rules or an LLM chain in a custom MLflow PythonModel, and use models from code to log readable Python files.
Model Registry
- Model Registry Basics Register models in the MLflow Model Registry, understand registered models and versions, load them by URI, and record where each version came from.
- Aliases, Tags and Promotion Move model versions to production safely with MLflow aliases and validation tags, plan rollbacks and understand why the old stage system is deprecated.
Evaluation
- Evaluate Machine Learning Models Use mlflow.models.evaluate for classifiers and regressors, add your own metric, check quality thresholds before release and study results by group.
- Evaluate LLM Apps Evaluate LLM applications with mlflow.genai.evaluate: build test records, connect your app, choose scorers, manage datasets and read the results.
- Scorers and Judges Choose MLflow scorers: built-in judges, code-based custom scorers and make_judge LLM judges. Learn to calibrate judges against human labels.
Tracing and LLM Apps
- Tracing Basics Understand MLflow traces and spans, add manual tracing with decorators and context managers, set span types and read a trace tree to debug an app.
- Auto Tracing, Feedback and Production Turn on MLflow auto tracing for LLM libraries, group traces by user and session, attach feedback, redact data and control sampling in production.
- Version Prompts in the Prompt Registry Store prompt templates in the MLflow Prompt Registry, create versions, use aliases to release and roll back, and evaluate a prompt change before shipping.
Servers, Deployment and Teams
- Run a Tracking Server Run a shared MLflow tracking server with a database backend and artifact storage, understand the key command flags, protect it and upgrade it safely.
- Serve and Deploy Models Serve MLflow models over a REST API, send correctly shaped requests to the invocations endpoint, build Docker images and test before you deploy.
- Teams, Security and Reproducibility Share MLflow safely with authentication and permissions, clean up deleted runs, package code as MLflow Projects and use MLflow in a CI pipeline.
Projects and Reference
- Project: A Tracked Model Release Build an end-to-end MLflow project: track a parameter search, choose a model by a written rule, register it, gate the release and plan a rollback.
- Project: Trace and Evaluate a Support Bot Build a small support bot workflow, trace its steps, score it against a test set, fix a retrieval bug and compare two versions before releasing one.
- MLflow Glossary and Cheat Sheet A quick MLflow reference: key terms, Python calls for tracking, models, registry, evaluation and tracing, common commands, URIs and a release checklist.