Orchestrate Model Training
Track and compare runs with MLflow
Log one line, mlflow.log_metric("accuracy", 0.94), inside a job that runs on Azure Machine Learning, and that value is already saved to your workspace and plotted on the job's Metrics tab. That works because Azure Machine Learning uses MLflow[1] as its native experiment-tracking framework, and the workspace itself is the tracking backend. MLflow calls a tracked execution a run; Azure Machine Learning calls the same thing a job, and the two words name the same record.
There is no separate MLflow tracking server to install or point at. A job that runs on Azure ML managed compute has its MLflow tracking URI (the address MLflow logs to) set to the workspace automatically, so jobs that use MLflow and run on Azure Machine Learning log their tracking information to the workspace[2] with no configuration. The common trap is assuming you must stand up and configure your own MLflow server first; the workspace already is that backend.
Log automatically with autolog
You can hand-log each value, or let MLflow capture the standard ones. Insert a single call before your training code and MLflow logs the parameters, metrics, and the trained model artifact for supported frameworks such as scikit-learn, PyTorch, TensorFlow, and XGBoost.
Turn on automatic logging (place before training):
import mlflow
mlflow.autolog() # capture params, metrics, and the model automatically
# ... your existing training code, unchanged ...
model.fit(X_train, y_train)
The mlflow.autolog() call decides what to track per framework[2], so you do not write a log_metric line for every value.
Tracking from outside Azure ML compute
Code that runs off Azure ML managed compute, such as a script or notebook on your own laptop, does not inherit the workspace tracking URI. Point MLflow at the workspace once and the same logging calls flow to the same place.
Point MLflow at the workspace from a local run:
import mlflow
mlflow.set_tracking_uri(azureml_mlflow_uri) # the azureml-mlflow URI of your workspace
For how to obtain that azureml_mlflow_uri, see Configure MLflow for Azure Machine Learning[3]. On managed compute you skip this step; off it, the run is not recorded until you set it.
Compare runs to pick a model
Because every job logs to the workspace, comparing models is comparing runs. Select several runs in an experiment and view their logged metrics side by side[4] in the studio, or query them with the MLflow API[5]. Compare on the agreed validation metric, not on training loss: a model can post the lowest training loss and still generalize worse. This shared metric history is what later lets a sweep or AutoML job hand you a single best trial instead of a pile of runs to sort by hand.
Where training runs: notebooks vs jobs
Two kinds of work need two kinds of compute. Interactive exploration in a notebook wants a machine that stays up while you think; a submitted training job wants machines that appear for the run and disappear after. Azure Machine Learning splits these across a compute instance and a compute cluster. This page covers the two you train on; the full catalog of compute targets, including serverless and inference endpoints, lives in Machine Learning Workspace Resources.
Compute instance: your notebook workstation
A compute instance is a single-node managed cloud workstation, personal to one user, with Jupyter, JupyterLab, and VS Code[6] preinstalled. It is where you author code and run notebooks interactively. Because it is one dedicated VM that keeps billing compute hours the whole time it runs, and it does not scale to zero the way a cluster does, its cost control is different: you enable idle shutdown and attach start/stop schedules.
- Idle shutdown: set
idle_time_before_shutdown_minutesand the instance stops itself after that much inactivity. The window must be at least 15 minutes and at most 3 days (configure idle shutdown[7]). It counts as inactive only when there are no running kernels, terminals, jobs, VS Code connections, or custom apps, so an idle-looking browser tab with a live kernel still bills. - Schedules: attach up to four start/stop schedules per instance to bring it up before work hours and shut it down after (schedule automatic start and stop[7]).
Compute cluster: where jobs run
A compute cluster, whose resource type is AmlCompute, is multi-node and job-oriented. It autoscales dedicated nodes for each submitted job[8] and can scale back to zero nodes when idle, so between runs it can cost nothing while each job still gets its own isolated nodes. Training jobs, sweeps, and distributed jobs run here.
The distinction the exam tests sits right at the reconciliation of those two facts: a compute instance bills while running and does not scale to zero, whereas a compute cluster runs submitted jobs and does. Trying to open notebooks directly on a cluster is the mismatch, because clusters run jobs, not the interactive notebook environment. Picking a single-node compute instance for a distributed multi-node training job is the opposite mismatch.
Command jobs: run a training script
The workhorse of Azure ML training is the command job: it runs one training script on a compute target and records the result as a tracked run whose outputs and MLflow-logged metrics land in the workspace (the same tracking described in Track and compare runs with MLflow above). You describe four things and submit, and Azure ML does the rest. A command job binds together:
code— the folder holding your training script.command— what to run, for examplepython train.py --epochs 20.environment— the dependencies, as a curated or custom Docker/conda image. An environment is the software stack, not the hardware.compute— the compute target (the hardware) the job runs on.
The last two are the pair people conflate. The environment supplies libraries; the compute supplies CPUs or GPUs. A job needs both, and you set them independently (train models with Azure Machine Learning[9]).
Submit with the CLI
A command job defined in YAML (job.yml):
$schema: https://azuremlschemas.azureedge.net/latest/commandJob.schema.json
code: ./src
command: python train.py --data ${{inputs.training_data}}
environment: azureml:AzureML-sklearn-1.5@latest # curated environment
compute: azureml:cpu-cluster
inputs:
training_data:
type: uri_folder
path: azureml://datastores/workspaceblobstore/paths/data/
# ...
Submit it:
az ml job create -f job.yml
Bind data with typed inputs and outputs
Notice the ${{inputs.training_data}} token in the command above. A command job's inputs mount or download data assets and URIs into the script, and its outputs write results back to workspace-managed storage. You reference them in the command with ${{inputs.<name>}} and ${{outputs.<name>}} placeholders instead of hardcoding a blob or datastore path (access data in a job[10]). Hardcoding a storage path in the script breaks portability and severs the lineage Azure ML would otherwise record between the data asset and the job. Data assets and environments are workspace assets in their own right; see Machine Learning Workspace Assets.
Scale out with distributed training
When a model is too large or too slow to train on one machine, a command job can spread it across several. The lever is a distribution config added to the command job, and one rule governs it: the distribution type must match the framework your script uses (distributed GPU training guide[11]).
Match the distribution type to the framework
pytorch— for scripts usingtorch.distributedandDistributedDataParallel.tensorflow— fortf.distributescripts; addworker_count, plusparameter_server_countfor the parameter-server strategy.mpi— for MPI or Horovod[11] launchers.
DeepSpeed is not a fourth type. You launch it through either the pytorch or the mpi distribution (DeepSpeed on Azure ML[11]). Selecting mpi for a plain PyTorch DistributedDataParallel script, which needs the pytorch type, is the classic mismatch.
Size the job: nodes and processes
Two numbers size a distributed job:
instance_count— the number of nodes (VMs).process_count_per_instance— the processes per node, typically set to the number of GPUs on each node[11].
So a two-node job with four GPUs per node sets instance_count to 2 and process_count_per_instance to 4, for eight worker processes in total, and it requires a compute cluster whose VM SKU actually provides those GPUs.
A PyTorch distribution on a command job:
command: python train.py
environment: azureml:AzureML-acpt-pytorch@latest
compute: azureml:gpu-cluster
resources:
instance_count: 2 # 2 nodes
distribution:
type: pytorch
process_count_per_instance: 4 # 4 GPUs per node -> 8 processes total
# ...
The trap to avoid: setting instance_count above one with no distribution block at all. The extra nodes then run the script independently, each training its own copy, instead of coordinating a single distributed run.
Automate hyperparameter tuning with sweep jobs
Your training script already works, but you want the best learning rate and batch size. Wrap it in a sweep job: it runs your command job many times over a range of hyperparameter values and reports the best. Three choices define a sweep, namely how it samples, what it optimizes, and when it gives up on weak trials.
Sample the search space
A search space is the set of values each hyperparameter can take. A sweep explores it with one of three sampling algorithms[12]:
- Grid — every combination; only sensible for small, discrete spaces.
- Random — values drawn from the space; a strong default for large or continuous spaces.
- Bayesian — each new trial is chosen from the results of prior trials, converging toward good regions.
Reaching for grid on a large or continuous space is the wrong reflex; random or bayesian is far more efficient there.
Optimize a primary metric
You set a primary_metric (the exact metric name your script logs) and a goal of Maximize or Minimize (specify the objective of the sweep[12]). Every trial is scored on that one metric, and the sweep ranks its trials by it.
Terminate weak trials early, except under bayesian
To cut cost, an early-termination policy cancels trials that are clearly losing before they finish (early termination policies[12]):
- Bandit — ends a trial whose metric falls outside a
slack_factor(a ratio) orslack_amount(an absolute value) of the best trial so far. - Median stopping — stops a trial doing worse than the median of running averages across trials.
- Truncation selection — cancels a fixed percentage of the lowest performers at each interval.
evaluation_interval and delay_evaluation control how often the policy runs and how long to wait before it starts acting. Two criteria are easy to confuse: bandit measures distance from the best run (slack), while truncation selection cuts a fixed percentage of the worst.
Here is the exception the exam loves: bayesian sampling does not support early termination. Because each bayesian trial is chosen from earlier results, there is no partial-trial signal to prune on, so the policy is set to None. Random and grid sampling do support early termination.
Let AutoML find the model
When you would rather not choose the algorithm at all, an automated ML (AutoML) job does it for you. You supply labeled data, name the task type and a metric to optimize, and AutoML tries many algorithm-and-hyperparameter combinations in parallel, returning the best (what is automated ML?[13]).
Five task types
AutoML covers five task types: classification, regression, time-series forecasting, computer vision, and natural language processing (NLP) (AutoML task types[13]). Assuming it only does classification is a common underestimate. You pick the task type and a primary_metric, for example accuracy, AUC_weighted, or normalized_root_mean_squared_error, and AutoML optimizes that metric when ranking models.
Featurization runs by default
Featurization is the preparation that turns raw columns into model-ready features: scaling and normalization, missing-value handling, and text-to-numeric encoding. In an AutoML job this runs automatically by default[13], and those steps become part of the produced model, so the same transformations are reapplied automatically at inference. You can set featurization to custom to override the defaults, but you do not have to engineer every feature by hand first.
Exit criteria and ensembles
An AutoML job does not run forever; it stops on the exit criteria you configure[14], such as an experiment timeout, a maximum number of trials, or a metric score threshold. Toward the end, AutoML builds voting and stacking ensemble models[13], which are enabled by default, and these combined models often appear as the final, best-scoring iterations. Because AutoML already ranks trials by your primary_metric, choosing a production candidate means taking that best trial rather than re-ranking by a different metric, which could pick a worse model.
Assemble training pipelines from components
A single command job trains one script, but real MLOps workflows have several stages, such as prepare data, train, and evaluate, that should run as one repeatable, versioned unit. That unit is a pipeline job, built from components (what are Azure Machine Learning pipelines?[15]).
Components are the reusable building block
A component is a self-contained pipeline step with typed inputs and outputs, its own environment, and its own code (Azure ML component[16]). Unlike a one-off command job, a component is a registered, versioned asset that can be shared and reused across pipelines, and each step can run on its own compute target. The shift the exam checks: the reusable, shareable unit is the component, not a standalone command job.
A pipeline chains components into steps
A pipeline job wires components into an ordered workflow and lets Azure ML manage the dependencies between steps (build a pipeline with the Python SDK[17]). Different people can own different steps, a data engineer the prep component and a scientist the training component, then integrate them into one graph.
Reuse skips unchanged work
Pipelines improve efficiency partly by reusing outputs from unchanged steps[15]. When a component's code and inputs have not changed since a prior run, Azure ML can reuse that step's cached output and skip recomputation, so re-running a pipeline after editing only the training step need not repeat data preparation. Components and environments are workspace assets; the deeper treatment lives in Machine Learning Workspace Assets.
Exam-pattern recognition
Orchestrate-training questions are mostly "pick the right mechanism for this described requirement." Map the trigger phrase to the answer:
- Track metrics without running your own tracking server points to the workspace as the MLflow backend; on managed compute the tracking URI is already set, so just log, or call
mlflow.autolog(). - Record runs from a script on my laptop points to
mlflow.set_tracking_uriwith the workspace azureml-mlflow URI, because off-compute code does not inherit it. - Interactive notebook development is a compute instance (single node, idle shutdown). A compute cluster is wrong: it runs jobs, not the notebook environment.
- Stop paying for an idle notebook workstation is idle shutdown (15 minutes to 3 days) or a start/stop schedule; a compute instance does not scale to zero like a cluster.
- Tune hyperparameters efficiently over a large or continuous space is a sweep job with random or bayesian sampling, not grid.
- Cut sweep cost by stopping weak trials is an early-termination policy (bandit, median stopping, or truncation selection). If the sampling is bayesian, early termination is not supported, so the answer is random or grid, or no policy.
- Get a good model with minimal code is an AutoML job: set the task type and
primary_metric; featurization is automatic. - Train a deep-learning model across multiple GPUs or nodes is a command job with a distribution config matching the framework (
pytorch,tensorflow, ormpi),instance_countnodes, andprocess_count_per_instanceGPUs per node. - Reusable, versioned multi-step workflow is a pipeline of components; the component is the reusable unit, and unchanged steps reuse cached output.
- Choose the production model from many runs means comparing on the
primary_metricin MLflow; a sweep or AutoML job already surfaces the best trial. Never select on training loss.
The meta-pattern is to move up the automation ladder only as far as the requirement asks: write a command job when you own the script, wrap it in a sweep to tune it, reach for AutoML when you want the model chosen for you, and compose a pipeline when the workflow has reusable stages.
Choosing a training job type
| Decision criterion | Command job | Sweep job | AutoML job | Pipeline job |
|---|---|---|---|---|
| What you provide | A training script, environment, and compute | A command job plus a search space | A dataset, task type, and primary_metric | Components wired into ordered steps |
| What Azure ML decides | Nothing; it runs your code | Which hyperparameter values to try | The algorithm and the hyperparameters | Step scheduling and output reuse |
| Best for | Running a single training script | Tuning an existing script's hyperparameters | Finding a good model with little code | Repeatable multi-step workflows |
| Reusable unit | The job itself (not reusable) | The wrapped command job | The job itself | Each registered, versioned component |
| Typical submission | az ml job create -f job.yml | sweep() over a command job | AutoML job in SDK, CLI, or studio | Pipeline job of components |
Decision tree
Sharp facts the exam loves — give these one last read before exam day.
Cheat sheet
Sharp facts the exam loves — scan these before test day.
- MLflow is Azure ML's native experiment-tracking framework
Azure Machine Learning uses MLflow as its native tracking framework. A job run on Azure ML compute automatically has its MLflow tracking URI set to the workspace, so parameters, metrics, and artifacts logged with mlflow.log_param / mlflow.log_metric are stored in the workspace and shown on the job's Metrics tab.
Trap Assuming you must stand up and configure a separate MLflow tracking server; the Azure ML workspace already IS the tracking backend.
7 questions test this
- A team runs many MLflow training jobs in one Azure Machine Learning workspace for two different projects. Right now every run lands in the same automatically created default experiment, making the two
- A data scientist prototypes a model on a local workstation today but must be able to move the same training code to Azure Machine Learning compute later, while having every run's parameters and metric
- After running several MLflow-tracked training jobs in an Azure Machine Learning workspace, a reviewer wants to visually compare the logged accuracy and loss values across those runs to pick the best m
- An engineer trains a scikit-learn classifier in an Azure Machine Learning job and currently writes a separate MLflow log call for every parameter and metric, which is tedious and error-prone. The engi
- A data science team runs dozens of independent training jobs each week in an Azure Machine Learning workspace and wants one central place where the parameters, metrics, and model artifacts from every
- You submit a training script as a job to an Azure Machine Learning compute cluster, and the script logs parameters and metrics with MLflow. A teammate insists the job will lose its metrics unless you
- After several MLflow-tracked training jobs finish in your Azure Machine Learning workspace, a reviewer wants to open the workspace and visually compare the logged accuracy and loss curves across those
- mlflow.autolog() auto-captures params, metrics, and the model
Calling mlflow.autolog() before training enables automatic logging of parameters, metrics, and the trained model artifact for supported frameworks (scikit-learn, PyTorch, TensorFlow, XGBoost) without writing explicit log calls for each value.
Trap Believing you must hand-log every metric; autolog captures the standard framework metrics automatically.
6 questions test this
- A team relies on MLflow automatic logging to capture parameters and metrics for their Azure Machine Learning training jobs, which they value. For one model, however, they must log the trained model th
- You enable mlflow.autolog() in an Azure Machine Learning training job so the scikit-learn model's standard parameters and metrics are captured automatically. You also compute one custom business metri
- You are training a scikit-learn classifier in an Azure Machine Learning job and want the run to capture the model's hyperparameters, its evaluation metrics, and the trained model itself, but you do no
- An engineer trains a scikit-learn classifier in an Azure Machine Learning job and currently writes a separate MLflow log call for every parameter and metric, which is tedious and error-prone. The engi
- A team enables MLflow automatic logging in an Azure Machine Learning job that trains a supported scikit-learn model, and they now want the fitted model itself captured as an artifact for the run, not
- An engineer adds mlflow.autolog() to a training script but places the call at the very end, after the model has already been fit and evaluated, and then finds the run's parameters and metrics are miss
- Interactive runs off Azure ML compute need the tracking URI set
Code running outside Azure ML managed compute (for example on a local machine) does not inherit the workspace tracking URI. You point MLflow at the workspace with mlflow.set_tracking_uri() so those runs are also recorded in the workspace.
- AutoML supports five task types and optimizes a primary metric
Automated ML explores algorithms and hyperparameters in parallel for classification, regression, time-series forecasting, computer vision, and NLP tasks. You set the task type and a primary_metric (for example accuracy, AUC_weighted, or normalized_root_mean_squared_error) that AutoML optimizes to pick the best model.
Trap Thinking AutoML only handles classification; it also covers regression, forecasting, vision, and NLP.
5 questions test this
- You configure an automated ML classification job on a fraud dataset in which genuine transactions vastly outnumber fraudulent ones. You want automated ML to explore many algorithms and then automatica
- A team has a labeled dataset of support-ticket text and wants Azure Machine Learning automated ML to train a model that assigns each ticket to a category. They need to integrate with the workspace dat
- A retailer's data science team must generate weekly product-demand predictions and wants Azure Machine Learning to explore algorithms and hyperparameters automatically rather than hand-coding a model.
- A data science team submits an automated ML classification job on a highly imbalanced fraud dataset and wants Azure Machine Learning to compare every trial automatically and recommend a single best mo
- A retail analytics team wants Azure Machine Learning automated ML to build a model that predicts weekly product demand for the next quarter from three years of historical, date-stamped sales records.
- AutoML runs featurization automatically by default
In an AutoML job, featurization (scaling and normalization, missing-value handling, text-to-numeric encoding) runs automatically by default, and those steps become part of the produced model so they are reapplied at inference. You can set featurization to custom to override the defaults.
Trap Assuming you must manually engineer and encode all features first; AutoML featurizes automatically unless you customize it.
3 questions test this
- During an automated ML classification job, the default featurization is acceptable for most columns, but a numeric-looking account-ID column must be treated as categorical and one column needs a diffe
- An automated ML run selects a best model that a team now plans to deploy to a managed online endpoint for real-time scoring. An engineer worries the scoring script must re-implement the scaling, imput
- A data science team is about to spend a sprint manually scaling numeric columns, imputing missing values, and encoding text to numbers before submitting an automated ML classification job. They want t
- AutoML stops on configurable exit criteria
An AutoML job ends when it meets the exit criteria you configure, such as experiment_timeout_minutes, max_trials (iterations), or a metric score threshold. Voting and stacking ensemble models are enabled by default and usually appear as the final trials.
Trap Expecting AutoML to run indefinitely; it halts at the timeout, trial cap, or score threshold you set.
4 questions test this
- An MLOps engineer schedules an automated ML classification job on an autoscaling compute cluster and is concerned it could keep searching indefinitely and run up compute cost. The job must stop on its
- A team runs an automated ML regression job and wants to conserve compute by ending the search as soon as any trial produces a model that reaches an acceptable quality score, instead of exhausting ever
- A governance policy requires that an automated ML experiment must never run past a fixed nightly maintenance window, even if its metric has not yet plateaued. Separately, to control cost, the team wan
- After an automated ML classification job completes, a team reviews the ordered list of trials and notices that the two top-scoring models, appearing as the final iterations, are named VotingEnsemble a
- Notebooks run on a compute instance
Interactive experimentation and notebooks run on an Azure Machine Learning compute instance, a managed single-node cloud workstation (personal to one user) with Jupyter, JupyterLab, and VS Code. You start and stop it, and you can configure idle shutdown to avoid paying while it sits unused.
Trap Trying to open notebooks directly on a compute cluster; clusters run submitted jobs, not the interactive notebook environment.
8 questions test this
- A junior analyst attaches to an Azure Machine Learning compute cluster and tries to open JupyterLab on it to explore data interactively, but the cluster only spins up nodes when a job is submitted and
- A new team member provisions a compute cluster to write and debug notebooks interactively and is frustrated that no interactive environment appears. Separately, the team must run a four-node distribut
- Your team must run a distributed, multi-node hyperparameter sweep that provisions several dedicated GPU nodes per submitted job, runs them in parallel, and releases all of them back to zero when the s
- You enabled idle shutdown on a compute instance, but it never stops automatically overnight even though nobody is authoring notebooks on it. Investigating, you discover that a custom application you a
- Your team has been authoring notebooks on a single-node Azure Machine Learning compute instance. They now need to run a large distributed hyperparameter sweep that must execute across many dedicated n
- A data scientist joining your Azure Machine Learning workspace needs a personal, fully managed cloud workstation where they can open Jupyter, JupyterLab, or VS Code and run exploratory notebooks inter
- A data scientist joining your Azure Machine Learning workspace needs a personal, fully managed cloud workstation to author and interactively run Jupyter, JupyterLab, and VS Code notebooks for explorat
- Each data scientist on your Azure Machine Learning team needs their own single-owner managed development box in the cloud, preloaded with common ML frameworks and offering Jupyter, JupyterLab, and VS
- Compute instance vs compute cluster
A compute instance is single-node and stays running while started, for interactive authoring; a compute cluster (AmlCompute) is multi-node, autoscales dedicated nodes per submitted job, and can scale to 0 nodes when idle. Use the instance for notebooks and the cluster for training jobs and sweeps.
Trap Picking a cluster for interactive dev, or an instance for a distributed multi-node training job.
8 questions test this
- To control spend, your governance team requires that every Azure Machine Learning compute instance is automatically stopped at 7 PM and started again at 8 AM on weekdays, whether or not anyone is acti
- A junior analyst attaches to an Azure Machine Learning compute cluster and tries to open JupyterLab on it to explore data interactively, but the cluster only spins up nodes when a job is submitted and
- A new team member provisions a compute cluster to write and debug notebooks interactively and is frustrated that no interactive environment appears. Separately, the team must run a four-node distribut
- Your team must run a distributed, multi-node hyperparameter sweep that provisions several dedicated GPU nodes per submitted job, runs them in parallel, and releases all of them back to zero when the s
- You want an Azure Machine Learning compute target that automatically provisions dedicated nodes each time you submit a training job, runs the job in isolation, and then de-allocates those nodes on its
- Your team has been authoring notebooks on a single-node Azure Machine Learning compute instance. They now need to run a large distributed hyperparameter sweep that must execute across many dedicated n
- Each data scientist on your Azure Machine Learning team needs their own single-owner managed development box in the cloud, preloaded with common ML frameworks and offering Jupyter, JupyterLab, and VS
- An MLOps engineer leaves an Azure Machine Learning compute instance running after a notebook session and is surprised the next morning to see it still billing all night, having expected it to drop to
- Idle shutdown and start/stop schedules are how you stop paying for an idle compute instance
A compute instance is a single dedicated VM that keeps billing compute hours the whole time it is running and does not scale to zero like a compute cluster, so its main cost control is enabling idle shutdown (set idle_time_before_shutdown_minutes; the inactivity window must be at least 15 minutes and at most 3 days) and attaching start/stop schedules (up to four per instance). It only counts as inactive when there are no running kernels, terminals, jobs, VS Code connections, or custom apps.
Trap Expecting a compute instance to auto-scale to zero when idle like a compute cluster; it keeps billing until idle shutdown or a schedule stops it.
7 questions test this
- To control spend, your governance team requires that every Azure Machine Learning compute instance is automatically stopped at 7 PM and started again at 8 AM on weekdays, whether or not anyone is acti
- You enabled idle shutdown on an Azure Machine Learning compute instance, but it keeps billing hour after hour and never shuts down, even though every Jupyter notebook and terminal is closed and no tra
- You enabled idle shutdown on a compute instance, but it never stops automatically overnight even though nobody is authoring notebooks on it. Investigating, you discover that a custom application you a
- You want an Azure Machine Learning compute target that automatically provisions dedicated nodes each time you submit a training job, runs the job in isolation, and then de-allocates those nodes on its
- A data scientist joining your Azure Machine Learning workspace needs a personal, fully managed cloud workstation where they can open Jupyter, JupyterLab, or VS Code and run exploratory notebooks inter
- A data scientist joining your Azure Machine Learning workspace needs a personal, fully managed cloud workstation to author and interactively run Jupyter, JupyterLab, and VS Code notebooks for explorat
- An MLOps engineer leaves an Azure Machine Learning compute instance running after a notebook session and is surprised the next morning to see it still billing all night, having expected it to drop to
- Sweep jobs sample a search space with grid, random, or bayesian
A sweep job automates hyperparameter tuning by exploring a defined search space with a sampling algorithm: random, grid, or bayesian sampling. You also set a primary_metric plus its goal (maximize or minimize) that the sweep optimizes across trials.
Trap Choosing grid sampling for a large or continuous search space, where random or bayesian sampling is far more efficient.
6 questions test this
- You configure an Azure Machine Learning sweep job to tune several continuous hyperparameters, such as learning rate and dropout, across a wide range of values. Your compute budget is limited, and you
- Your team has already narrowed an Azure Machine Learning sweep job to a few important hyperparameters and has enough compute budget to run many trials sequentially. You want each new trial to be selec
- An MLOps engineer must tune a model whose search space includes continuous hyperparameters over wide ranges. Two requirements apply at once: the sweep must attach an early-termination policy to cancel
- You are setting up an Azure Machine Learning sweep job to tune a classification model. You have already defined the search space and chosen a sampling algorithm, but the sweep still needs to know what
- An MLOps engineer sets up a sweep job in Azure Machine Learning to tune a model whose search space mixes discrete and continuous hyperparameters over wide ranges. The team has a limited compute budget
- Your Azure Machine Learning sweep job tunes continuous hyperparameters with Bayesian sampling, and a teammate suggests adding an early-termination policy to cancel weak trials and save cost. You need
- Early-termination policies cancel poorly performing trials
To cut cost, a sweep job can apply an early-termination policy that cancels underperforming trials early: bandit (slack_factor or slack_amount off the best run), median_stopping, or truncation_selection. Policies use evaluation_interval and delay_evaluation to control when they start acting.
Trap Confusing bandit's slack (distance from the best run) with truncation selection's fixed percentage of worst trials.
8 questions test this
- Your Azure Machine Learning sweep job trains many trials, and you want a conservative early-termination policy that saves cost with little risk of cancelling a trial that might still become the best.
- You run an Azure Machine Learning sweep job with many trials and want a cost-saving rule that, at every evaluation interval, cancels a fixed percentage of the worst-performing trials so far and keeps
- Your Azure Machine Learning sweep job uses Bayesian sampling to tune a model, and to reduce compute cost you plan to attach a bandit early-termination policy so that weak trials are cancelled before t
- An MLOps engineer must tune a model whose search space includes continuous hyperparameters over wide ranges. Two requirements apply at once: the sweep must attach an early-termination policy to cancel
- A sweep job runs a large number of trials, and the team wants an early-termination policy that, at each evaluation interval, cancels a set proportion of the worst-performing trials so far, rather than
- A sweep job in Azure Machine Learning runs many trials with random sampling to tune a classification model. To control cost, the team wants to automatically cancel any trial whose primary metric falls
- Your Azure Machine Learning sweep job tunes continuous hyperparameters with Bayesian sampling, and a teammate suggests adding an early-termination policy to cancel weak trials and save cost. You need
- A colleague configured an Azure Machine Learning sweep job with Bayesian sampling and also set a bandit early-termination policy, expecting underperforming trials to be cancelled and cut cost. After t
- Bayesian sampling does not support early termination
Bayesian sampling chooses each new set of hyperparameter values from the results of prior trials and does NOT support early-termination policies (set the policy to None). Random and grid sampling do support early termination.
Trap Pairing bayesian sampling with a bandit or median-stopping policy; only random and grid sampling allow early termination.
4 questions test this
- Your Azure Machine Learning sweep job uses Bayesian sampling to tune a model, and to reduce compute cost you plan to attach a bandit early-termination policy so that weak trials are cancelled before t
- An MLOps engineer must tune a model whose search space includes continuous hyperparameters over wide ranges. Two requirements apply at once: the sweep must attach an early-termination policy to cancel
- Your Azure Machine Learning sweep job tunes continuous hyperparameters with Bayesian sampling, and a teammate suggests adding an early-termination policy to cancel weak trials and save cost. You need
- A colleague configured an Azure Machine Learning sweep job with Bayesian sampling and also set a bandit early-termination policy, expecting underperforming trials to be cancelled and cut cost. After t
- A command job runs a training script on a compute target
You run a training script as a command job that specifies the command (for example python train.py), the code folder, an environment (a curated or custom Docker/conda image), and a compute target. Submit it with az ml job create -f job.yml.
Trap Confusing environment with compute; a command job needs both an environment (dependencies) and a compute target (hardware).
7 questions test this
- You define a command job to train a model. You have already written the training script, its start command, and identified the source code folder. Before the job can run in the cloud, two more pieces
- You submit a training script as an Azure Machine Learning command job on a compute cluster. The job reaches the cluster and starts, but the run fails within seconds with a ModuleNotFoundError because
- A data scientist has been running train.py interactively on an always-on Azure Machine Learning compute instance. The team now needs each training run to be reproducible, tracked with its inputs and o
- A team wants to run a single Python training script that they package with its code folder, a curated environment, and a compute target, and submit it as one reproducible, tracked run in Azure Machine
- An engineer authors a command job that sets the training script's start command, the code folder, and an Azure Machine Learning compute cluster as the target, then submits it. The run reaches the clus
- A training command job needs a Python library that is not present in any Azure Machine Learning curated environment, and the team wants every future run of the job to resolve to the exact same set of
- A data scientist has a single Python training script in a source folder and wants to run it in the cloud on an Azure Machine Learning compute cluster, packaging the script, its start command, and its
- Typed inputs/outputs bind data to the job
A command job's inputs mount or download data assets and URIs into the script, and its outputs write results back to workspace-managed storage. You reference them in the command with ${{inputs.}} and ${{outputs.}} placeholders instead of hardcoding storage paths.
Trap Hardcoding blob/datastore paths in the script rather than using typed inputs/outputs, which breaks portability and lineage.
9 questions test this
- A command job's training script writes its trained model and metrics to a local folder on the compute node. After the job finishes and the node is de-allocated, the team cannot find the results. They
- An MLOps engineer must feed a specific versioned data asset that is already registered in the workspace into a training command job, and the team requires each run to record exactly which data version
- Your command job's script needs a large registered data asset that lives in the workspace. You want Azure Machine Learning to make that data available to the script at runtime, either by mounting it o
- A data scientist has been running train.py interactively on an always-on Azure Machine Learning compute instance. The team now needs each training run to be reproducible, tracked with its inputs and o
- A command job trains a model and must persist its output metrics and model files so they are captured as tracked job outputs in workspace-managed storage and remain available after the compute scales
- A command job runs correctly in a development workspace, but the team must promote the identical job to separate test and production workspaces without editing the training script for each one. Today
- A command job runs today against data referenced by an absolute storage account URL written into the training code. The team must run the identical job in another workspace whose data sits in a differ
- An engineer's training script currently opens its dataset directly from a hard-coded blob storage URL. When the data is later moved to a different container the command job breaks, and the workspace s
- A training script for a command job currently opens its dataset by reading a hardcoded blob storage URL embedded in the code. The team wants the same job to run unchanged against different registered
- Distribution config scales training across nodes
To train large or deep-learning models across multiple nodes, a command job sets a distribution with type pytorch, tensorflow, or mpi (for example Horovod), together with instance_count (number of nodes) and process_count_per_instance (processes or GPUs per node).
Trap Setting instance_count greater than 1 without a distribution config; the workers then run independently instead of coordinating.
9 questions test this
- A team must cut the training time of a large deep-learning model that currently trains on a single Azure Machine Learning node. They want each node in a GPU cluster to hold a full copy of the model, p
- You already run a working distributed PyTorch command job in Azure Machine Learning, and its distribution type and per-node process count are set correctly. Training is still too slow, so you decide t
- You scale an Azure Machine Learning command job that trains a deep-learning model onto a four-node GPU cluster by raising the job's node count. The job now runs on every node, but training finishes no
- An engineer scales a PyTorch DistributedDataParallel job onto a two-node Azure Machine Learning cluster whose virtual machines each expose four GPUs. She adds a PyTorch distribution and sets instance_
- A machine learning engineer submits an Azure Machine Learning command job to train a large deep-learning model on a four-node GPU compute cluster. She sets instance_count to four, but training runs no
- A team ports a legacy TensorFlow 1.x training script that uses the parameter-server strategy to Azure Machine Learning. They correctly choose the TensorFlow distribution for the command job and set a
- Your team wants to train a very large language model on Azure Machine Learning and plans to use DeepSpeed's ZeRO memory optimizations to fit the model across many GPU nodes. An engineer starts writing
- A data science team trains a very large deep-learning model that now takes several days on a single powerful GPU virtual machine, and the deadline no longer allows that. They want the training run its
- An engineer wants a training command job to run across three nodes of an Azure Machine Learning compute cluster. The cluster already allows up to eight nodes, and a PyTorch distribution is configured
- process_count_per_instance usually equals GPUs per node
process_count_per_instance is typically set to the number of GPUs on each node, and scaling out with a larger instance_count requires a compute cluster whose VM SKU provides those GPUs.
- Distribution type must match the training framework
Set distribution.type (or use the typed PyTorchDistribution, TensorFlowDistribution, or MpiDistribution object) to match the framework the script uses: PyTorch for torch.distributed/DistributedDataParallel scripts, TensorFlow for tf.distribute (using worker_count, plus parameter_server_count for the parameter-server strategy), and mpi for MPI or Horovod. DeepSpeed is not a separate distribution type; you launch it through either the PyTorch or the MPI distribution.
Trap Selecting mpi for a plain PyTorch DistributedDataParallel script, which needs the PyTorch type, or treating DeepSpeed as its own distribution.type instead of launching it through the PyTorch or MPI distribution.
7 questions test this
- An engineer scales a PyTorch DistributedDataParallel job onto a two-node Azure Machine Learning cluster whose virtual machines each expose four GPUs. She adds a PyTorch distribution and sets instance_
- Your training script initializes torch.distributed and wraps the model in PyTorch DistributedDataParallel, and you now configure an Azure Machine Learning command job to run it across several GPU node
- A data science team's training script uses Horovod to run synchronous distributed training and calls hvd.init() to set up communication between the workers. You are configuring an Azure Machine Learni
- You are configuring an Azure Machine Learning command job for a training script that uses torch.distributed with DistributedDataParallel and the NCCL backend on a multi-node GPU cluster. A colleague s
- You are moving a TensorFlow 2 deep-learning training script to Azure Machine Learning. The script uses the tf.distribute.Strategy API (MultiWorkerMirroredStrategy) to synchronize gradients across work
- A team ports a legacy TensorFlow 1.x training script that uses the parameter-server strategy to Azure Machine Learning. They correctly choose the TensorFlow distribution for the command job and set a
- Your team wants to train a very large language model on Azure Machine Learning and plans to use DeepSpeed's ZeRO memory optimizations to fit the model across many GPU nodes. An engineer starts writing
- A training pipeline chains reusable components
A training pipeline is a pipeline job made of components, where each component is a self-contained step with typed inputs/outputs, an environment, and code. Components are registered, versioned assets that can be reused across pipelines and shared, and each step can run on its own compute.
Trap Treating a standalone command job as reusable; the component is the registerable, shareable unit that pipeline steps consume.
11 questions test this
- In an Azure Machine Learning workspace, you want to register the reusable data-preparation step of your training pipeline as a first-class, versioned asset — the same way you register models and envir
- You are building an Azure Machine Learning training pipeline in which a data-preparation component produces a processed dataset that the downstream model-training component must consume. You need the
- A data engineer built a data-preparation step as a standalone Azure Machine Learning command job. Several other teams now want to reuse that identical step inside their own training pipelines, without
- On a data science team, one engineer owns data preparation, another owns model training, and a third owns evaluation. You want each engineer to develop, test, and optimize their own step independently
- In Azure Machine Learning v2, resources such as compute and datastores are separate from assets, which are versioned and can be registered in the workspace. Within a pipeline job, each step consumes o
- Your data science team keeps three separate scripts that prepare data, train a model, and evaluate it, and today an engineer runs them by hand in sequence for every experiment. You want to orchestrate
- Your organization runs separate Azure Machine Learning workspaces for the development, test, and production teams. A data-preparation component built by the development team must be discoverable and r
- A training step must run identically no matter which team's Azure Machine Learning pipeline uses it, with the exact same Python code and package dependencies every time, so that no team has to re-crea
- In an Azure Machine Learning training pipeline, the data-preparation step is CPU-bound while the model-training step needs GPUs. You want the preparation step to run on an inexpensive CPU cluster and
- You author three reusable Azure Machine Learning components — data preparation, model training, and model evaluation. You need to run them as one automated, end-to-end workflow in which Azure Machine
- A shared Azure Machine Learning training component is registered and consumed by several teams' production pipelines. You need to ship an improved version of the component's logic, but the existing pi
- Pipeline steps can reuse unchanged outputs
Azure ML can reuse a prior step's cached output when that component's code and inputs are unchanged, skipping recomputation to save time and cost on subsequent pipeline runs.
- Compare metrics across runs to choose the best model
Because each run logs metrics to the workspace via MLflow, you compare model performance across jobs by selecting multiple runs in an experiment and viewing their logged metrics side by side in the studio (or querying them with the MLflow API) to identify the best model.
Trap Comparing on training loss instead of the agreed primary/validation metric used to select the production candidate.
9 questions test this
- When you open Azure Machine Learning studio to compare several completed training jobs, a few of the runs show no value for the agreed validation metric, so you cannot rank them against the others. Yo
- Your team agreed before training that the model with the highest validation AUC would be promoted to production. After a dozen MLflow runs finish in the experiment, a colleague suggests choosing the w
- Several completed runs in an Azure Machine Learning experiment each logged both a training-set loss and a validation metric that the team agreed in advance is the criterion for selecting the productio
- Different members of your team logged runs for the same model into several separate Azure Machine Learning experiments over multiple project iterations. You must pull every run's logged metrics into a
- The same model was trained by different teammates who each logged their runs in a separate Azure Machine Learning experiment. You must compare all of those runs against the one agreed validation metri
- An engineer needs to compare the logged metrics of every run in an Azure Machine Learning experiment from a script, with no studio UI, and then select the best run by the agreed validation metric. The
- A data science team runs many independent training jobs inside a single Azure Machine Learning experiment, and every job logs its evaluation metrics to the workspace through MLflow. The team now wants
- An Azure Machine Learning experiment holds fifteen finished training jobs, each having logged its evaluation metrics to the workspace with MLflow. Before registering a model, you need to determine whi
- A data science team completes a dozen independent training jobs for the same model in one Azure Machine Learning experiment, each logging its metrics to the workspace through MLflow. To choose the pro
- Sweep and AutoML surface the best trial by primary_metric
AutoML and sweep jobs already rank trials by the configured primary_metric and surface the single best trial, so choosing a production candidate means taking that best trial's model rather than manually re-ranking every run.
Trap Re-picking a model by a different metric than the primary_metric the job optimized, which can select a worse model.
8 questions test this
- You configure an Azure Machine Learning AutoML classification job, set its primary_metric to accuracy to match the agreed business goal, and let it train and evaluate many candidate models across seve
- You add an Azure Machine Learning AutoML training step to an MLOps pipeline, and a downstream step must automatically register the single best model that the AutoML job produced, judged by the job's c
- You run an Azure Machine Learning hyperparameter sweep job whose objective sets primary_metric to "accuracy" with the goal to maximize. After all trials finish, you need the single model that performe
- A colleague finished an Azure Machine Learning sweep job that maximized F1-score as its primary metric across forty trials. To save time they plan to skip the sweep's own ranking and instead scroll th
- You configure an Azure Machine Learning AutoML classification job with AUC_weighted set as the primary metric because your dataset is imbalanced. When the job completes, dozens of trials have run. You
- An Azure Machine Learning AutoML regression job used normalized_root_mean_squared_error as its primary_metric, chosen to match the business need, and finished by recommending a best model. A colleague
- In Azure Machine Learning studio you open a completed AutoML regression job that optimized normalized_root_mean_squared_error as its primary metric. Leadership asks which of the many trained models th
- You submit an Azure Machine Learning hyperparameter sweep job whose objective sets a primary_metric and a goal to maximize it, and the sweep runs many trials as child jobs. After the sweep completes,
Also tested in
References
- MLflow and Azure Machine Learning - Azure Machine Learning
- Track Experiments and Models by Using MLflow - Azure Machine Learning
- Configure MLflow for Azure Machine Learning - Azure Machine Learning
- Log metrics, parameters, and files with MLflow - Azure Machine Learning
- Query & compare experiments and runs with MLflow - Azure Machine Learning
- What is an Azure Machine Learning compute instance? - Azure Machine Learning
- Create a compute instance - Azure Machine Learning
- Create compute clusters - Azure Machine Learning
- Train ML models - Azure Machine Learning
- Access data in a job - Azure Machine Learning
- Distributed GPU training guide (SDK v2) - Azure Machine Learning
- Hyperparameter tuning a model (v2) - Azure Machine Learning
- What is automated ML? AutoML - Azure Machine Learning
- Set up AutoML with Python (v2) - Azure Machine Learning
- What are machine learning pipelines? - Azure Machine Learning
- What is a component - Azure Machine Learning
- Create and run machine learning pipelines using components with the Machine Learning SDK v2 - Azure Machine Learning