MLflow: Experiment Tracking, Model Registry & Serving
MLflow is the open-source platform for managing the end-to-end ML lifecycle. Log experiments, version models, and deploy to production — all from a unified API that works with any framework.
Related Products
on GumroadDeveloper Productivity Bundle
Stop rebuilding the same setup every project. 51 VSCode snippets, 40 Git aliases, 5 Docker Compose stacks, 5 GitHub Actions workflows, 5 README templates, and a dotfiles kit. Set up a professional dev environment in under an hour.
Buy on Gumroad →AI Prompt Engineering Toolkit
58 structured prompt templates for Claude, ChatGPT, and Gemini — organized by use case. Code Review, Debugging, Documentation, Architecture, and 10 model-specific tips. Stop writing prompts from scratch.
Buy on Gumroad →Developer Cheat Sheet Bundle
10 print-ready cheat sheets for the tools developers use every day: Git, Docker, Linux CLI, SQL, Regex, HTTP Status codes, VS Code shortcuts, Bash scripting, jq/JSON, and Markdown.
Buy on Gumroad →You Might Also Need
JSON Formatter & Validator
Format, beautify, and validate JSON online. Paste your JSON to instantly pretty-print it with 2-space, 4-space, or tab indentation. Minify JSON too. Free, runs in your browser.
Open free tool →
Regex Tester
Free regex tester. Test regular expressions against multiple strings with expected match/no-match assertions — see instant pass/fail results. Built-in presets for email, URL, IPv4, and phone. Pro: unl
Open free tool →
Base64 Encoder & Decoder
Free Base64 Encoder & Decoder. Convert text, images, and any file to Base64 and back. Supports URL-safe Base64, image data URIs, and file download from Base64. Runs 100% in your browser — no data sent
Open free tool →
More Free Tools
Related Articles
curl 深度使用手冊:API 測試從入門到進階
curl 是每位開發者必備的 CLI 工具。本文涵蓋 GET/POST/PUT/DELETE 請求、認證、header 設定、檔案上傳、除錯技巧,以及 REST API 測試的完整實戰範例。
Best AI Code Review Tools 2026: CodeRabbit, Sourcery, DeepCode & Bito Compared
Compare top AI code review tools for 2026: CodeRabbit, Sourcery, DeepCode, and Bito. Features, pricing, GitHub/GitLab integration, and choosing the right tool for your team.
AI Code Review Tools 2026: GitHub Copilot, CodeRabbit, Qodo Merge Ranked
Compare AI code review tools for 2026: GitHub Copilot code review, CodeRabbit, Qodo Merge, Sourcery, and PR-Agent. Pricing, accuracy, and GitHub integration.
AI Coding Tools Comparison 2026: GitHub Copilot vs Cursor vs Windsurf vs Cline
Comprehensive comparison of the best AI coding tools in 2026: GitHub Copilot, Cursor, Windsurf, and Cline. Pricing, features, model support, and real-world benchmarks.
AI Pair Programming in 2026: GitHub Copilot vs Cursor vs Claude Code
Master AI pair programming in 2026. Compare GitHub Copilot, Cursor, and Claude Code for autocomplete, chat, and agentic workflows. Includes setup guides and productivity tips.
Enjoying this tool? Get more like it.
Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.
Unlock AI-Powered Dev Tools
- ⚡ AI Code Review, Doc Generator & SQL Builder
- ⚡ All premium templates & early access
- ⚡ Member discounts on Gumroad products
$9/mo after trial · Cancel anytime
Want the full toolkit?
Get DevPlaybook Pro
Every template, guide, boilerplate, and automation script in one bundle. 13 premium products — grab them all at once and save big.
MIT licensed · Instant download · No subscription
See what's included → Browse all deals →What is MLflow?
MLflow is an open-source platform created by Databricks (2018) that solves the reproducibility and management problem in ML: "which parameters produced my best model, and how do I get it back to production?" It provides a clean API for logging any training run, storing artifacts, and managing model versions through a standardized lifecycle.
MLflow is framework-agnostic — the same tracking API works whether you are training a scikit-learn pipeline, a PyTorch transformer, or a custom NumPy model. Runs are stored in a backend (local filesystem, PostgreSQL, MySQL) and artifacts in an artifact store (local disk, S3, GCS, Azure Blob).
Quickstart: Log Your First Run
Install MLflow with pip install mlflow, then wrap your training code in a run context:
import mlflow
import mlflow.sklearn
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import accuracy_score
mlflow.set_experiment("fraud-detection")
with mlflow.start_run(run_name="rf-baseline"):
# Log hyperparameters
params = {"n_estimators": 100, "max_depth": 8, "random_state": 42}
mlflow.log_params(params)
# Train
clf = RandomForestClassifier(**params)
clf.fit(X_train, y_train)
# Log metrics
acc = accuracy_score(y_test, clf.predict(X_test))
mlflow.log_metric("accuracy", acc)
mlflow.log_metric("f1_score", f1)
# Log the model artifact
mlflow.sklearn.log_model(clf, artifact_path="model")
print(f"Run ID: {mlflow.active_run().info.run_id}") Run mlflow ui to open the tracking dashboard at http://localhost:5000. Every run appears as a row with its params, metrics, and artifact links.
Autolog: Zero-Code Tracking
For supported frameworks, one line before training is enough:
import mlflow
# Enable autolog for all supported libraries at once
mlflow.autolog()
# Or per-library for fine-grained control
mlflow.sklearn.autolog(log_model_signatures=True)
mlflow.pytorch.autolog(log_every_n_epoch=5)
mlflow.xgboost.autolog()
mlflow.transformers.autolog()
# Training code unchanged — MLflow captures everything automatically
from sklearn.linear_model import LogisticRegression
model = LogisticRegression(C=0.5, max_iter=200)
model.fit(X_train, y_train)
# ✓ Params logged: C=0.5, max_iter=200, solver=lbfgs
# ✓ Metrics logged: training_score, validation metrics
# ✓ Model artifact saved automatically Model Registry: Staging → Production Lifecycle
Register a model from a run, then manage its lifecycle programmatically:
from mlflow.tracking import MlflowClient
client = MlflowClient()
# Register model from a completed run
run_id = "abc123def456"
model_uri = f"runs:/{run_id}/model"
mv = client.create_model_version(
name="FraudDetector",
source=model_uri,
run_id=run_id
)
print(f"Version: {mv.version}") # Version: 3
# Transition through lifecycle stages
client.transition_model_version_stage(
name="FraudDetector",
version=3,
stage="Staging",
archive_existing_versions=False,
)
# After validation, promote to Production
client.transition_model_version_stage(
name="FraudDetector",
version=3,
stage="Production",
archive_existing_versions=True, # archive old Production version
)
# Load production model anywhere
prod_model = mlflow.pyfunc.load_model("models:/FraudDetector/Production") MLflow vs Weights & Biases vs Comet ML
| Feature | MLflow | Weights & Biases | Comet ML |
|---|---|---|---|
| Self-hostable | Yes (fully open-source) | Enterprise only | Enterprise only |
| Free tier | Unlimited (self-hosted) | 100 GB free | Limited free |
| Model Registry | Built-in | Artifacts + Registry | Model registry |
| Hyperparameter sweeps | Manual / Optuna plugin | W&B Sweeps (excellent) | Optimizer |
| Collaboration / Reports | Basic UI | W&B Reports (excellent) | Panels |
| Model serving | mlflow models serve | None built-in | None built-in |
| Best for | Full MLOps pipeline, self-hosted | Research teams, sweep-heavy work | Mid-size teams, good UI |
Frequently Asked Questions
What are the four main components of MLflow?▼
MLflow has four core components: MLflow Tracking (log parameters, metrics, and artifacts per run), MLflow Projects (package ML code in a reproducible format with conda/docker environments), MLflow Models (a standard format for packaging models with a flavor abstraction), and MLflow Model Registry (a centralized store to manage model lifecycle with Staging, Production, and Archived stages).
How does MLflow Tracking differ from TensorBoard?▼
TensorBoard is tightly coupled to TensorFlow/Keras and excels at visualizing training curves. MLflow Tracking is framework-agnostic — it works with scikit-learn, XGBoost, PyTorch, HuggingFace, and custom code. MLflow also logs arbitrary artifacts (plots, CSVs, serialized models) and supports remote backends (S3, GCS, Azure Blob) alongside a full Model Registry, which TensorBoard lacks.
What is the MLflow Model Registry and when should I use it?▼
The Model Registry is a centralized store for managing ML model versions across their lifecycle. Use it when you have multiple model versions and need to track which version is in Staging vs Production, who approved a promotion, and what run produced the model. It integrates with CI/CD pipelines: an automated test can query models in Staging, validate them, then transition to Production via the API.
Can MLflow run without a remote tracking server?▼
Yes. By default MLflow logs to a local ./mlruns directory — no server required. For team use, deploy an MLflow tracking server with mlflow server --backend-store-uri postgresql://... --default-artifact-root s3://my-bucket/. Clients connect by setting the MLFLOW_TRACKING_URI environment variable. MLflow Databricks also provides a fully managed tracking server.
How does MLflow autolog work?▼
mlflow.autolog() automatically captures parameters, metrics, and model artifacts for supported libraries without any manual log calls. Call it before training: mlflow.sklearn.autolog() logs estimator params, CV metrics, and the fitted model. mlflow.pytorch.autolog() logs loss curves, optimizer state, and checkpoints. It is the fastest way to add tracking to existing training code.
How do I serve a registered MLflow model?▼
Use mlflow models serve -m models:/MyModel/Production -p 5001. This starts a REST endpoint that accepts JSON payloads and returns predictions. For production-scale serving, use mlflow.pyfunc.load_model() inside a custom FastAPI or BentoML service, or deploy the model to SageMaker/AzureML via built-in mlflow.sagemaker.deploy().