Chip Foundry Services Request Assessment

Mlflow Tracking

MLflow Tracking is the open-source experiment logging system that records parameters, metrics, code versions, and model artifacts for every ML training run — solving the reproducibility crisis in machine learning by creating a permanent, searchable record of what hyperparameters, data, and code produced each model, enabling teams to compare runs, reproduce results, and understand what actually makes models perform better.

What Is MLflow Tracking?

  • Definition: The experiment tracking component of MLflow (open-source ML lifecycle platform created by Databricks in 2018) — a logging API and UI that records everything relevant to a model training run: hyperparameters (config), evaluation metrics (loss, accuracy), model artifacts (saved weights), and source code version (Git commit hash).
  • Runs and Experiments: An Experiment is a named collection of related Runs. A Run is a single execution of your training code — MLflow tracks when it started, how long it took, what parameters were set, what metrics were logged, and what artifacts were saved.
  • Automatic Logging (autolog): One line of code — $mlflow.\operatorname{autolog}()$ — automatically captures framework-specific information from PyTorch, TensorFlow, scikit-learn, XGBoost, LightGBM, and others without any manual log statements.
  • Backend Stores: MLflow stores run metadata in a backend (SQLite for local, PostgreSQL/MySQL for team use) and artifacts in a storage location (local filesystem, S3, GCS, Azure Blob) — the same API works whether running locally or on a shared team server.
  • Model Registry: An extension of tracking — promote the best run's model to the Model Registry with versioning, staging (Staging → Production), and deployment annotations.

Why MLflow Tracking Matters for AI

  • Reproducibility: Without tracking, reproducing a model that got 95% accuracy six months ago requires hoping someone documented the exact learning rate, batch size, data version, and random seed. MLflow makes this automatic.
  • Experiment Comparison: The MLflow UI enables sorting runs by any metric — find the hyperparameter combination that minimized validation loss across 100 training runs in seconds rather than digging through log files.
  • Team Collaboration: Shared MLflow server (PostgreSQL backend + S3 artifacts) gives the entire ML team visibility into experiments — a new team member can browse all prior experiments to understand what approaches have been tried.
  • Model Lineage: Every registered model links back to the training run, which links to Git commit, data version, and environment — complete lineage from raw data to production model artifact.
  • Framework Agnostic: Same API for PyTorch, TensorFlow, scikit-learn, HuggingFace Transformers, XGBoost — one tracking system for all ML frameworks, not separate logging per framework.

MLflow Tracking Core API

Manual Logging:
import mlflow
import mlflow.pytorch

$$mlflow.set_{\text{experiment}}("\text{llm-fine-tuning}")$$

with $mlflow.start_{\text{run}}(run_{\text{name}}="llama-3-8b-lora-v_2")$:

Log hyperparameters

mlflow.log_params({
"model": "meta-llama/Llama-3-8B",

$$"learning_{\text{rate}}": 2\times 10^{-4},$$
$$"lora_{\operatorname{\operatorname{rank}}}": 16,$$
$$"batch_{\text{size}}": 8,$$

"epochs": 3
})

Training loop

for epoch in $\operatorname{range}(3)$:

$$train_{\text{loss}} = train_{\text{epoch}}(model, train_{\text{loader}})$$
$$val_{\text{loss}} = \operatorname{evaluate}(model, val_{\text{loader}})$$

Log metrics per step

mlflow.log_metrics({

$$"train_{\text{loss}}": train_{\text{loss}},$$
$$"val_{\text{loss}}": val_{\text{loss}}$$

}, step=epoch)

Log final model artifact

$mlflow.pytorch.\log_{\text{model}}(model$, "fine-tuned-llama")

$$mlflow.\log_{\text{artifact}}("training_{\text{config}}.yaml")$$

Automatic Logging:
import mlflow
$mlflow.pytorch.\operatorname{autolog}()$ # Captures loss, LR schedule, model architecture

trainer $= Trainer(\text{model}=\text{model}, \text{args}=training_{\text{args}}$, ...)

$$trainer.\operatorname{train}()$$

Everything logged automatically — no manual mlflow calls needed

Model Registration:

Register best run's model

$run_{id} =$ "abc123def456"
$mlflow.register_{\text{model}}(f"runs:/{run_id}/\text{fine-tuned-llama}"$, "production-llm")

Transition to production

client $= mlflow.tracking.MlflowClient()$
client.transition_model_version_stage("production-llm", version=3, stage="Production")

Querying Experiments Programmatically:
runs $= mlflow.search_{\text{runs}}($

$$experiment_{\text{names}}=["\text{llm-fine-tuning}"],$$
$$filter_{\text{string}}="metrics.val_{\text{loss}} < 0.5 \mathrm{AND} params.lora_{\operatorname{\operatorname{rank}}} = '16'",$$

$order_by=["metrics.val_{\text{loss}}$ ASC"]
)

$$best_{\text{run}} = runs.iloc[0]$$

MLflow UI Features:
- Compare multiple runs side-by-side with metric charts
- Filter runs by parameter values and metric thresholds
- View artifact files directly in the browser
- Diff hyperparameters between runs to identify what changed

MLflow Tracking vs Alternatives

ToolOpen SourceHosted OptionBest UIAuto-LoggingBest For
MLflowYes (self-host)DatabricksGoodExcellentTeams wanting self-hosted
W&BNo (SaaS)W&B CloudExcellentExcellentResearch teams, collaboration
Neptune.aiNo (SaaS)Neptune CloudGoodGoodEnterprise metadata
Comet MLPartialComet CloudGoodGoodHPO visualization

MLflow Tracking is the open-source experiment logging standard that brings reproducibility and accountability to machine learning — by automatically capturing the complete context of every training run (parameters, metrics, code, environment, and artifacts) in a searchable, comparable format, MLflow transforms chaotic model development into a systematic engineering practice where insights accumulate and results can always be reproduced.