ML — MLOps

MLflow for Experiment Tracking

Direct answer

MLflow experiment tracking gives every training run a permanent record — parameters, metrics, artifacts, and the exact code version — so 'which model is best and how do we reproduce it' stops being tribal knowledge. Setup is genuinely minutes: pip install mlflow, wrap training in mlflow.start_run(), log params and metrics, and run the local UI. The discipline that makes it pay off is logging enough to retrain any run from scratch: data version, feature code, and environment — not just the accuracy number.

Every ML team hits the same moment: a model in production is misbehaving, and nobody can say exactly which data, code, and hyperparameters produced it. Experiment tracking is the fix, and MLflow is the default open-source answer. Here's the setup that works for small teams, and the conventions that keep it useful past week two.

Key facts, with sources

  • The global MLOps market was estimated at about 3.03 billion US dollars in 2025 and is projected to grow at a 40.5% compound annual growth rate from 2025 to 2030. (Grand View Research)
  • Precedence Research projects the MLOps market will reach about 56.6 billion US dollars by 2035, up from roughly 2.43 billion in 2025. (Precedence Research)
  • An analysis of MIT and Harvard research covering 128 model-dataset pairs across 32 datasets in four industries found 91% of machine learning models degrade over time in production. (NannyML)
  • Models left unchanged in production for six months or longer see error rates jump about 35% on new data, according to a 2025 model drift and retraining guide summarizing industry research. (SmartDev)
  • A 2024 practitioner study on ML deployment and monitoring found most organizations monitor less than 40% of their production models, with the most common answer being under 20%. (arXiv)

The five-minute setup

MLflow's tracking API is deliberately boring: start a run, log things, end the run. Locally it writes to a folder and the UI runs on localhost; for a team, point MLFLOW_TRACKING_URI at a shared server backed by Postgres and object storage. The API is identical either way, so starting local costs nothing.

train.py — tracked training run
import mlflow

mlflow.set_experiment("ticket-router")

with mlflow.start_run(run_name="tfidf-logreg-bigrams"):
    mlflow.log_params({
        "vectorizer": "tfidf",
        "ngram_range": "1-2",
        "C": 1.0,
        "class_weight": "balanced",
        "train_rows": len(X_train),
        "data_snapshot": "tickets-2026-07-01",  # reproducibility anchor
    })

    model.fit(X_train, y_train)

    mlflow.log_metrics({
        "f1_macro": f1_macro,
        "accuracy": acc,
        "f1_worst_class": worst_class_f1,  # averages hide failures
    })
    mlflow.sklearn.log_model(model, name="model")

# Browse everything: `mlflow ui` → http://localhost:5000

Log for reproducibility, not for decoration

The accuracy number is the least valuable thing in a run record — you'll remember roughly how good the model was. What you won't remember in three months is everything needed to rebuild it: which data snapshot trained it, which feature-engineering commit processed that data, which library versions were installed. Log a dataset identifier (a snapshot name, a query plus date, or a data hash), let MLflow capture the git commit (it does automatically when you run from a repo), and log the environment via the model artifact's dependency capture.

The test of a good tracking habit: could a new teammate reproduce your best run from the MLflow record alone, without asking you anything? If the answer is no, you have a leaderboard, not experiment tracking.

Conventions that keep a shared server useful

Tracking servers rot socially, not technically — a hundred runs named 'test' with three logged params each is write-only noise. Three conventions prevent it. One experiment per problem, not per person: 'ticket-router', not 'dhairya-experiments'. Run names that state the hypothesis: 'bigrams-vs-unigrams', not 'run-47'. And tags for lifecycle: tag runs as candidate, shipped, or archived so the registry promotion story is visible in the tracking UI.

Also log the metric that reflects the product, not just the modeling default — for an imbalanced routing problem, macro-F1 and the worst class's F1, because the overall accuracy will look fine while one queue silently gets everything wrong.

From tracking to registry: closing the loop

Tracking answers 'what did we try'; the model registry answers 'what is running in production'. They connect: register the winning run's model, promote it through aliases (staging, production), and your deployment layer loads by alias. Now every production model traces back through the registry to the exact run — parameters, data snapshot, code commit — that created it. That lineage is what turns a production incident from archaeology into a lookup.

When to adopt a managed alternative instead of self-hosting: if nobody on the team wants to own a tracking server's uptime, backups, and auth, hosted options are worth their cost — the tracking discipline matters far more than where the server runs.

When to hire senior help

Consider senior MLOps help once models are making real decisions and nobody can answer what version is live, when it was last retrained, or whether accuracy is drifting, since most organizations monitor under 40% of their production models. The failure mode it prevents, silent degradation discovered through business losses, is far more expensive than the engagement itself. If your stack includes React Native + Python + AI, a senior engineer who owns the full product beats coordinating multiple juniors.

Bottom line

Dhairya Senjaliya ships ML — MLOps projects worldwide — book a scoping call to discuss your specific situation.

Common pitfalls to avoid

  • Buying a full MLOps platform for one or two models, adding process overhead before the models have proven business value
  • Monitoring only infrastructure metrics like latency and CPU while prediction drift and input data quality degrade silently
  • Skipping model and data versioning, so a bad release cannot be rolled back or a past prediction reproduced for debugging
  • Retraining on a fixed calendar schedule rather than on detected drift, either wasting compute or reacting months too late

Frequently asked questions

Is MLflow free and can I self-host it?

Yes — MLflow is open source and free. Locally it needs nothing but pip install; for a team you self-host the tracking server with a Postgres backend and object storage for artifacts, or use a managed offering if nobody wants to operate the server. The tracking API is identical in all cases, so migrating later is low-cost.

What should I log in every ML experiment?

Enough to reproduce the run without asking its author: all hyperparameters, a dataset identifier (snapshot name or data hash), the code version (MLflow captures the git commit automatically), library environment, and the metrics that reflect the product — including per-class or worst-case numbers, not just the average. The model artifact itself should be logged so the winning run is deployable directly.

MLflow vs Weights & Biases — which should a small team pick?

MLflow if you want open-source, self-hosted, and a built-in model registry that connects tracking to deployment; its UI is plainer but the lineage story is complete. Hosted platforms like W&B offer richer visualization and zero ops at a subscription cost. For a small team shipping models to production, the registry integration usually matters more than dashboard polish.

Do we need MLOps if we only have one model?

You need a minimal slice of it: versioned training code and data, automated deployment, and monitoring of prediction quality, because research shows 91% of models degrade over time. A full platform with feature stores and pipelines is justified once several models share infrastructure, not before.

How often should models be retrained?

It depends on how fast your data drifts; studies show error rates can rise around 35% when models sit unchanged for six months, but some models decay in weeks and others stay stable for a year. The robust approach is drift-triggered retraining, monitoring input distributions and outcome metrics and retraining when thresholds are crossed.

What is the minimum viable MLOps stack?

Git for code, an experiment tracker or model registry, containerized deployment through your existing CI/CD, and a monitoring job that compares live prediction distributions and outcomes against training baselines. Most of this is achievable with open-source tools; the discipline of using it consistently matters more than the specific vendor.

Bottom line: Dhairya Senjaliya ships ML — MLOps projects worldwide. Book a scoping call at https://dhairyasenjaliya.com/#book-call.

Sources

Related guides

Keep up with new guides

New deep-dive guides on React Native, Python, and AI ship regularly. Subscribe via RSS or follow on LinkedIn.

Want help implementing this?

30-minute scoping call · Clear milestones · Senior engineer ownership