Home › Guides › MLflow Tutorial
Tutorial · 2026MLflow Tutorial 2026: Track Your First Run, Register a Model and When Not to Use It
An MLflow tutorial starts with one command: pip install mlflow, then mlflow server, which puts a tracking UI on port 5000 and writes runs to a local SQLite file. From there you log parameters and metrics, register the winning model under an alias, and load it back by name instead of by file path.
-
Two commands get you running.
pip install mlflowandmlflow servergive you a tracking server onhttp://127.0.0.1:5000with a SQLite backend, no cloud account and no signup. -
MLflow 3.18.0 shipped on 2 November 2026. The official release notes on mlflow.org list automatic issue detection, an experimental Agent Skill Registry and online evaluation, and they warn that you must run
mlflow db upgradebefore restarting. -
Stages are dead, aliases won. Model Registry stages have been deprecated since MLflow 2.9.0; the documented pattern now is
models:/policy-lapse@champion, a mutable pointer you can move without touching deployment code. -
Autolog is the fastest real win. One line,
mlflow.sklearn.autolog(), captures params, metrics and the fitted model without you writing a singlelog_metriccall. - The free tiers are real but capped. Databricks publishes a fixed limit of 500,000 runs per MLflow experiment, and its Free Edition page states it is not for production or commercial use.
-
Skip the parts nobody uses. MLproject entrypoints and
mlflow runwere the 2019 pitch; your CI pipeline already does that job better.
Your best model is sitting in a file called clf_v7_FINAL_final.pkl and nobody, including you, can say which learning rate produced it. The notebook that made it has been re-run eleven times since. That gap between "the model works" and "I can prove which model works and rebuild it" is the only problem MLflow was designed to solve, and it is why this MLflow tutorial opens with a server rather than a library import.
Throughout, keep one team in mind: two people doing machine learning at a mid-size insurer in Pune, training a policy-lapse model on roughly 400,000 rows, with no platform team behind them and a compliance reviewer who will eventually ask which version of the model scored a particular customer. That is the most common shape of an MLflow adoption in India, and it needs about four hours of setup, not a quarter of platform work.
What Is MLflow, and What Does It Actually Replace?
MLflow is an open-source platform for recording what happened during machine learning work and for turning the winning result into something loadable by name. It has four moving parts, and knowing which one you are touching at any moment is most of the learning curve.
The four things MLflow stores for you
Most confusion comes from mixing up the tracking store and the registry; they are separate concepts with separate APIs.
| Component | What it holds | How you write to it | When you need it |
|---|---|---|---|
| Tracking | Runs: parameters, metrics, tags, a Git commit hash |
mlflow.log_param(), mlflow.log_metric(), autolog()
|
Day one, the moment you try a second hyperparameter |
| Models | The serialised model plus its signature and Python environment | mlflow.sklearn.log_model(model, name="model") |
As soon as someone other than you must load it |
| Model Registry | Named models, numbered versions, aliases like champion
|
mlflow.register_model(), set_registered_model_alias()
|
When a deployment needs a stable pointer |
| Tracing | Spans for LLM and agent calls: prompt, response, latency, tokens |
mlflow.anthropic.autolog() and the other provider autologgers |
When the thing you are shipping is an agent, not a classifier |
Component behaviour read from the MLflow documentation on mlflow.org, checked January 2027.
What it replaces, concretely: a spreadsheet of accuracy numbers, a folder of pickle files with dates in the names, and the Slack message where someone asks which model is live. It does not replace your orchestrator, your feature store or your monitoring. People who expect it to do those things are the ones who write blog posts about being disappointed by MLflow.
How the pieces talk to each other
MLflow request flow, from training script to served endpoint
Runs and artifacts land in two different stores; the registry only holds pointers.
Drawn from the tracking server and model registry pages of the MLflow documentation, checked January 2027.
MLflow Tutorial, Step 1: Your First Tracking Server in Three Commands
The MLflow tracking server is a Python process. It needs no Docker, no database you install separately and no account anywhere. On a clean machine:
python -m venv .venv && source .venv/bin/activate
pip install "mlflow==3.18.0" scikit-learn pandas
mlflow server --host 127.0.0.1 --port 5000
Open http://127.0.0.1:5000 and you have the UI. Two defaults in that third command are worth knowing before they bite you. The MLflow documentation states that the server binds to 127.0.0.1 and accepts connections only from the local machine, so a colleague on your network sees nothing until you pass --host 0.0.0.0. And the current docs give SQLite as the default backend store, at sqlite:///mlflow.db, falling back to a ./mlruns directory if one already exists. Artifacts default to a local ./mlartifacts folder.
For the Pune team, that default is the right answer for the first fortnight. I would not stand up Postgres and an S3 bucket until a second person needs to read the runs. When that day comes, the shape is this:
mlflow server \
--host 0.0.0.0 --port 5000 \
--backend-store-uri postgresql://mlflow:pw@db-host:5432/mlflow \
--artifacts-destination s3://insurer-ml-artifacts/mlflow
Two stores, two reasons. The SQL backend holds small structured rows that you query and sort in the UI. The artifact store holds the model binaries and plots, which is why it wants object storage rather than a database. Getting an S3 bucket, an IAM policy and a lifecycle rule right is ordinary cloud work, and if that sentence sounded like a foreign language, it is the first week of 360DT's AWS Solutions Architect and DevOps program, where you build exactly that bucket and policy live.
MLflow at a glance, November 2026
The four numbers you will actually need in the first week.
Version from the mlflow.org releases page; defaults from the MLflow self-hosting docs; the run cap from the Databricks resource limits page. Checked January 2027.
Step 2: Logging a Run, and Why mlflow autolog Beats Doing It by Hand
You can log everything manually. Almost nobody should start there. The autologgers hook into the training library and capture parameters, metrics and the fitted model for you:
import mlflow, pandas as pd
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split
from sklearn.metrics import roc_auc_score
mlflow.set_tracking_uri("http://127.0.0.1:5000")
mlflow.set_experiment("policy-lapse")
mlflow.sklearn.autolog()
df = pd.read_csv("policies.csv")
X = df.drop(columns=["lapsed"])
y = df["lapsed"]
X_tr, X_te, y_tr, y_te = train_test_split(X, y, test_size=0.2, random_state=42)
with mlflow.start_run(run_name="rf-depth-12"):
model = RandomForestClassifier(max_depth=12, n_estimators=300, random_state=42)
model.fit(X_tr, y_tr)
auc = roc_auc_score(y_te, model.predict_proba(X_te)[:, 1])
mlflow.log_metric("test_auc", auc)
mlflow.set_tag("dataset_version", "2026-11-policies-v3")
That set_experiment line is not decoration. Leave it out and every run from every project on the machine lands in the experiment literally named Default, which is how teams end up with four thousand unsorted runs and give up on the UI by March. One line, written once, prevents it.
The set_tag line is the one experienced people add and beginners skip. A run that records its hyperparameters but not which snapshot of the data it saw is only half reproducible, and in a regulated setting it is the half the auditor asks about.
Where the hours go on a first MLflow rollout
Instrumenting the training code is the biggest slice, and the server setup is the smallest. Plan accordingly.
An effort split for the rollout described in this guide, not a measured benchmark.
Step 3: The Worked Example, From Run to Registered Model
Here is the whole loop end to end, with the output you should expect at each stage. Run the training script above three times with max_depth set to 8, 12 and 20. In the UI you now see three runs under policy-lapse, each with a test_auc column you can sort on. Say depth 12 wins with an AUC of 0.81, depth 20 overfits to 0.77, and depth 8 lands at 0.79.
Now promote the winner. The registry does not store a copy of the model; it stores a named, numbered pointer to the run that produced it.
from mlflow import MlflowClient
client = MlflowClient()
run_id = "a1b2c3d4e5f64a7b8c9d0e1f2a3b4c5d" # the depth-12 run
mv = mlflow.register_model(f"runs:/{run_id}/model", "policy-lapse")
print(mv.name, mv.version) # -> policy-lapse 1
client.set_registered_model_alias("policy-lapse", "champion", mv.version)
loaded = mlflow.pyfunc.load_model("models:/policy-lapse@champion")
print(loaded.predict(X_te.head(3))) # -> [0 1 0]
Read that last URI again, because it is the single most useful idea in MLflow. Nothing downstream references run a1b2c3d4, a file path or a version number. It asks for whichever version currently wears the champion alias. Retrain next month, register version 2, move the alias, and the scoring job picks up the new model without a code change or a deploy.
One detail that trips up anyone following an older tutorial: in MLflow 3 the artifact_path argument to log_model is deprecated and the documented replacement is name, because models are now first-class entities you can search for by name. If you copy a 2023 snippet you will get a deprecation warning and, on some versions, a model logged somewhere you did not expect.
Also read: MLOps Projects in 2026: 6 Portfolio Builds With Real Pipelines, Registries and Drift Alerts, which takes this registry pattern and wraps it in a full project you can put on a CV.
Step 4: The MLflow Model Registry, and Why Stages Are Gone
If you learned MLflow before 2024 you learned four fixed stages: None, Staging, Production, Archived. Forget them. The MLflow documentation records that stages have been deprecated since version 2.9.0 and will be removed in a future major release, with the migration guide telling you to pick an alias per stage, typically champion in place of Production, and to point workloads at models:/<name>@champion.
The replacement is better for a plain reason: a model version can hold several aliases at once, and you define what they mean. The pattern the docs demonstrate is champion and challenger, where champion serves live traffic and challenger is the version you are shadow-testing against it. Four hardcoded stages could never express that.
For the Pune team, the promotion rule that actually works is three lines in a CI job, not a conversation: register every trained model, compare its test_auc to whatever currently holds champion, and move the alias only if the new one wins by more than half a point. Writing that gate as code is what separates a tracking tool from an actual MLOps practice, and it is the core of the live MLOps Engineer program that maps to Microsoft's AI-300 objectives.
What usually goes wrong here
Here is the one that will eat an afternoon. You run the server on a VM, train from your laptop, and the run appears in the UI with its metrics, but clicking the artifact tab shows nothing. The model is sitting on your laptop's disk because the client wrote artifacts locally rather than through the server. Set the tracking URI in the client and give the server an --artifacts-destination, and it resolves. Nine out of ten "MLflow lost my model" complaints are this.
Six errors you will meet in your first week
Each one has a one-line cause. None of them mean MLflow is broken.
Connection refused on :5000
The server bound to 127.0.0.1, which the docs give as the default, so nothing outside the machine can reach it. Restart with --host 0.0.0.0 and open the port.
Runs appear, artifacts do not
The client never pointed at the server for artifact writes. Call mlflow.set_tracking_uri() in the script and start the server with --artifacts-destination.
Everything lands in "Default"
You forgot mlflow.set_experiment(). Harmless on day one, unusable by run four hundred. Add it to your training template now.
RESOURCE_DOES_NOT_EXIST on alias
You set an alias before registering the model. Register first, read the version off the returned object, then set the alias on that version.
RegistrySchema error after an upgrade
The 3.18.0 release notes call for a database migration. Stop the servers, back up the SQL backend and run mlflow db upgrade before restarting.
Serving hangs for minutes
The default environment manager is virtualenv, so serving rebuilds the model's environment from scratch. Pass --env-manager local for a local smoke test.
Causes and fixes read from the MLflow CLI reference, self-hosting docs and the 3.18.0 release notes, checked January 2027.
Step 5: Serving the Model, and the Flag That Saves Ten Minutes
MLflow will stand up a REST endpoint around any registered model. This is genuinely useful for a smoke test and genuinely not a production serving platform, which is a distinction worth making out loud.
mlflow models serve \
-m "models:/policy-lapse@champion" \
--port 5002 --env-manager local
curl -s http://127.0.0.1:5002/invocations \
-H "Content-Type: application/json" \
-d '{"dataframe_split": {"columns": ["age","premium","tenure_months"],
"data": [[34, 18500, 26]]}}'
# {"predictions": [0]}
That --env-manager local flag matters. The MLflow CLI documentation states that when the option is unspecified it defaults to virtualenv, which means the first invocation rebuilds the model's recorded Python environment before it answers anything. Correct for production, infuriating when you are checking whether the model loads at all. Use local while you are iterating and let CI use the default.
Would I ship this endpoint to real traffic? No. It is a single Python process with no autoscaling, no canary and no request authentication. Put the model artifact behind a proper container and a managed endpoint instead, which is what the Azure Solutions Architect and DevOps course covers on the AZ-400 release-pipeline side, and what the AI-200 Azure AI developer track covers for managed online endpoints.
MLflow is not a good fit for everyone reading this. If you are a solo learner with three experiments and a clear naming scheme, git tags and a text file will serve you better for another month, and the hour you spend on a tracking server is an hour not spent on the model. MLflow earns its keep at the point where a second person must reproduce your result, or a reviewer must trace a prediction back to a version. The open-source UI is also not something to show a business stakeholder; it is an engineer's tool, and MLflow 3's pivot toward GenAI means you will frequently land on a documentation page for a version you are not running. Check the version selector before you copy a snippet.
Learn the tracking, evaluation and agent skills that MLflow 3 now expects
The AI Engineer course teaches you to build agents that plan, use tools and act, certified on both Microsoft Copilot Studio and Claude Code. You instrument, evaluate and ship them live with an instructor rather than reading about it.
Explore the course
MLflow Tutorial for Agents: Tracing an LLM Call With One Line
The reason MLflow is worth relearning in 2026 is that it stopped being only a classical machine learning tool. The MLflow documentation describes a one-line automatic tracing experience for integrated libraries, and it works the same way the training autologgers do:
import mlflow, anthropic
mlflow.set_tracking_uri("http://127.0.0.1:5000")
mlflow.set_experiment("lapse-explainer-agent")
mlflow.anthropic.autolog()
client = anthropic.Anthropic()
resp = client.messages.create(
model="claude-sonnet-5-5",
max_tokens=512,
messages=[{"role": "user",
"content": "Explain in two sentences why policy 88213 was flagged as likely to lapse."}],
)
print(resp.content[0].text)
Nothing else changes in your code, and every call now lands in the UI as a trace with the prompt, the response, the latency and the model parameters. The docs note a real limitation: the Anthropic integration traces synchronous text calls, so asynchronous calls and the full content of multi-modal inputs are not captured. Worth knowing before you conclude your async agent is silently failing.
This is also where the newest release points. The MLflow 3.18.0 notes on mlflow.org list automatic issue detection that groups recurring agent problems and links them to trace evidence, an experimental Agent Skill Registry for sharing reusable skills across agents, and experimental online evaluation that runs your own Python quality checks against live traffic. That is an agent observability product wearing an ML tracking tool's name. If that sentence describes what you want to build, the evaluation half of it is the spine of the AI Engineer course, and the protocol and skill side sits in the CCDV-F developer prep course.
Also read: What Is Observability? How Logs, Metrics and Traces Actually Work in 2026 for the vocabulary that MLflow tracing borrows wholesale from backend engineering.
Free Tiers, Real Limits and When Not to Use MLflow
MLflow itself is free and open source, so the only question is where it runs and who pays for that. The four realistic options:
Where to run MLflow, and what each option costs you
Start at the top row. Most learners never need to leave it.
| Option | What it costs | Good for | The catch |
|---|---|---|---|
Local SQLite plus ./mlartifacts
|
Nothing | Learning, interviews, solo projects | One machine only; back up mlflow.db yourself |
| Self-hosted server, Postgres plus S3 | A small VM and object storage | A two to ten person team | You own upgrades, auth and the database migration |
| Databricks Free Edition | Nothing | Trying managed MLflow without a card | Databricks states it is limited to smaller compute sizes, subject to fair use limits, and not for production or commercial use |
| Azure Machine Learning workspace | Azure compute and storage | Teams already on Azure or studying AI-300 | You point MLflow at an azureml:// tracking URI rather than running a server |
Free Edition terms from the Databricks Free Edition page; Azure behaviour from Microsoft Learn; checked January 2027.
That Azure row is the one most Indian learners will meet at work, because the tracking server is already there and nobody mentions it. Microsoft Learn states that on Azure compute the tracking URI is configured automatically, and that elsewhere you fetch it yourself:
az ml workspace show \
--name my-workspace --resource-group my-rg \
--query mlflow_tracking_uri --output tsv
# azureml://eastus.api.azureml.ms/mlflow/v1.0/subscriptions/...
Export that as MLFLOW_TRACKING_URI and every script in this guide works unchanged against Azure. That interoperability is the practical reason MLflow is worth learning even in a Microsoft shop, and it is why the AI-300 objectives behind the MLOps engineer track assume MLflow rather than a proprietary API. The same logic applies on the data side: if your runs read from a lakehouse, the pipeline work sits in the Microsoft Fabric data engineering course, not in MLflow.
The limits worth knowing before you scale
Two published numbers will shape how you log. The Databricks resource limits page caps experiment tracking at 500,000 runs per MLflow experiment, marked as a fixed limit, and 10 million total metric steps per run. The tracking guide there tells you to delete runs you no longer need, or change your logging strategy, when you hit a quota. If you are logging a metric every training step across a hyperparameter sweep, those ceilings arrive faster than they sound.
And the plain "do not bother" cases. Skip MLproject files and mlflow run; it was the 2019 pitch for reproducible entrypoints and your CI pipeline does that job better today. Skip the registry entirely if you have exactly one model and deploy it by hand once a quarter. Skip self-hosting if your employer already pays for a managed workspace, because running a second tracking server next to a corporate one is how you end up with the truth in two places.
How to Learn MLflow Properly From Here
A realistic path, if you have about eight hours a week. Week one: everything in this guide, locally, with a dataset you already know. Week two: move the backend to Postgres and the artifacts to object storage, then break it on purpose and fix it. Week three: write the CI job that registers a model and moves the champion alias only when a metric gate passes. Week four: instrument an LLM call with tracing and look at the traces until you can explain what a span is without hedging.
That fourth week is the one that changes what you get paid for, because tracing an agent and evaluating it are now separate skills from training a model. If you want that taught live rather than assembled from documentation, start with a free webinar before committing to anything, or compare the full certifications overview to see where MLflow sits inside the AI-300 and AI-200 objectives. A demo class costs you an hour and answers the "is this level right for me" question better than any syllabus page.
Also read: Machine Learning Projects for Beginners 2026: 6 End-to-End Builds With Datasets, MLflow and a Live API if you want a dataset and a scope handed to you rather than inventing one.
If I were in the Pune team's position, I would do exactly one thing today: start the server with the SQLite default, add set_experiment and autolog to the training script, and retrain. That is twenty minutes, it is reversible, and by tomorrow you will have something the compliance reviewer can read. Everything else in this guide, the Postgres backend, the promotion gate, the traces, is worth doing only once that first habit holds. Learn it in that order and MLflow stays a tool. Learn it backwards, starting with the platform, and it becomes a project that never ships.
Related guides
- What Is an MLOps Engineer in 2026? Role, Skills, AI-300 Certification and Career Path in India the job title that owns everything you just built.
- MLOps vs DevOps in 2026: 12 Criteria, Job Counts and Which One to Learn First in India read this if you already know CI/CD and are deciding how far to pivot.
- MLOps Engineer Salary in India 2026: Advertised Pay by Experience, Company Type and Skill Stack what the registry-and-pipeline skill set is actually advertised at.
- MLOps Engineer Interview Questions 2026: 20 Real Questions With Model Answers several of these ask about model versioning, which you can now answer from experience.
- AI Agent Evaluation in 2026: How Evals Work, LLM-as-a-Judge vs Deterministic Checks and 6 Steps the next layer up from tracing, and where MLflow 3 is heading.
Frequently asked questions
Is MLflow free to use?
Yes. MLflow is open source, so pip install mlflow and a local tracking server cost nothing beyond the machine you run them on. You only pay when you choose a managed host: a VM and object storage if you self-host for a team, or Azure and Databricks compute if you use their workspaces. Databricks Free Edition gives you a managed option at no cost, though its page states it is limited to smaller compute sizes and is not for production or commercial use.
What is MLflow used for in machine learning?
Four jobs. Recording what each training run did, so you can compare and reproduce it. Packaging a trained model with its signature and environment. Holding named model versions in a registry so deployments reference an alias instead of a file. And, since MLflow 3, tracing LLM and agent calls the way an APM tool traces web requests. It is not an orchestrator, a feature store or a monitoring platform.
Do I need Databricks to use MLflow?
No. Databricks created MLflow and sells a managed version, but the open-source project runs anywhere Python runs. Start a server with mlflow server on your laptop and you have the same tracking API and the same registry concepts. Azure Machine Learning also exposes an MLflow-compatible tracking URI, so the same training script works unchanged against an Azure workspace.
How do I start an MLflow tracking server locally?
Run mlflow server --host 127.0.0.1 --port 5000 and open that address. Per the MLflow self-hosting docs, the server binds to localhost by default and uses SQLite at sqlite:///mlflow.db as its backend store, with artifacts in ./mlartifacts. To let teammates reach it, restart with --host 0.0.0.0 and point the clients at the machine's address with mlflow.set_tracking_uri().
What replaced model stages in the MLflow model registry?
Aliases. The docs record that stages have been deprecated since MLflow 2.9.0, and the migration guide tells you to map each old stage to an alias, typically champion for what used to be Production. You then load with models:/<name>@champion. Aliases are mutable pointers and one version can carry several, which is what makes champion and challenger testing possible.
What should I learn after this MLflow tutorial?
The promotion gate and the serving layer, in that order. Write a CI job that registers every trained model and moves the champion alias only when a metric improves by a threshold you chose in advance. Then put the model behind a real container and a managed endpoint rather than mlflow models serve. After that, learn tracing and evaluation, because that is where the hiring demand has moved.
Does MLflow work with PyTorch, XGBoost and LLM frameworks?
Yes, through flavour-specific modules. Each supported library has its own autologger and log_model function, so mlflow.pytorch, mlflow.xgboost and mlflow.sklearn follow the same shape. For generative work the docs describe one-line tracing autologgers per provider, such as mlflow.anthropic.autolog() and mlflow.openai.autolog(), which record prompts, responses and latency into the active experiment.
How long does it take to learn MLflow?
An afternoon to log your first runs and register a model. Roughly four weeks of part-time work to be genuinely useful with it: a week locally, a week moving to Postgres and object storage, a week writing the CI promotion gate, and a week on tracing. The tool is small. What takes time is the surrounding discipline of naming, tagging and gating, which is the part interviewers probe.
About this guide. 360 Digital Transformation is an Anthropic Partner and a Microsoft Authorized Training Partner. Other certification bodies, vendors and employers named here are not affiliated with us. Tools and versions change quickly; commands and figures cited were checked on January 2027.




