03. MLflow Setup

Chapter 3 of 24 · 20 min

MLflow is the open-source standard for local MLOps. It provides four components: Tracking (experiment logging), Models (model packaging), Model Registry (version management), and Projects (reproducible runs). For local AI, you need at minimum the Tracking component.

Installation is straightforward:

pip install mlflow

That's the core package. Additional components for specific needs:

pip install mlflow[extras]  # Includes sqlalchemy for database backend
pip install mlflow[typecheck]  # Type validation

For production use, you'll want a database backend. SQLite suffices for single-user local setups; PostgreSQL for multi-user or high-volume scenarios.

Local verification checkpoint

Run the smallest example from this chapter in a local workspace and record the package version, runtime, data path, and observed output. If the result depends on model size, vector count, CPU/GPU backend, or available memory, note that constraint beside the exercise so the lesson remains reproducible.

EXERCISE

Install MLflow and configure it with a SQLite backend. Run three experiment variations (different hyperparameters) and verify all runs appear in the backend store. Check the SQLite file directly with sqlite3 mlflow.db ".schema".