A machine learning engineer is building a scikit-learn model with hyperparameter tuning on Databricks. They want each trial to be tracked as a nested run under a single parent run in MLflow so that all trials are grouped together and the best parameters can be compared easily. Which MLflow API call should they use to start each trial run so that it is nested under the currently active run?
Using start_run with nested=True creates a child run under the active parent run, keeping trial metrics and parameters grouped. This is the standard MLflow pattern for hyperparameter tuning, where the parent run represents the overall tuning job and each trial is a nested run that can be compared and selected. The child run inherits the parent's experiment and tags, and the UI displays the hierarchy clearly.
Why this answer
Nested runs are created by calling mlflow.start_run with nested=True while a parent run is active. This groups all trial runs under one parent, making it easy to compare metrics and select the best hyperparameters. Other MLflow APIs either create separate experiments or log artifacts, and manually setting parentRunId is not the supported nesting mechanism.
Exam trap
The trap here is confusing experiment creation or manual tagging with nested run creation, when MLflow provides a dedicated nested parameter on start_run.