What you will be able to do
- Explain what Databricks Runtime ML pre-installs and why that beats installing ML libraries at cluster start
- Describe how top-tier libraries are updated and how a pre-installed library gets deprecated and removed
- Configure GPU compute on the ML runtime and say what the GPU variant installs for you
- Predict which workloads Photon and Graviton speed up, and which they do not
- State the access mode the ML runtime needs for Unity Catalog and when AI Runtime is the better choice for GPU work
Key concept
Databricks Runtime for Machine Learning — A classic-compute runtime that comes with the common ML and deep learning libraries already installed and tested together, so a cluster is ready for training the moment it starts. You turn it on with the Machine learning checkbox when creating compute.
1.A cluster that starts with the ML stack installed
Databricks Runtime for Machine Learning (Databricks Runtime ML) is a version of the Databricks Runtime built for model training. When you create compute with it, you get ML and deep learning infrastructure already in place. That includes the libraries most teams install by hand: scikit-learn, XGBoost, PyTorch, TensorFlow and MLflow. The runtime does not just install these packages. They are tested together, so the versions on a given release are known to work alongside each other.
Here is the problem it solves. A team on the general-purpose runtime runs a setup step every time a cluster starts, pip install-ing scikit-learn, XGBoost and MLflow before any notebook can run. Every project repeats that step, and every cluster waits for it. Making the install faster or moving it somewhere else still leaves the team maintaining it. Choosing the ML runtime when the cluster is created removes the step completely, and every project starts from the same library set.
Install scripts also cause problems of their own. Init scripts can bring in library conflicts that break workloads, and installing libraries at the compute level makes environments drift apart across jobs. The runtime's own library set is versioned with the runtime, so two clusters on the same ML release have the same libraries. One caveat: the ML runtime installs a large set of libraries, and these can conflict with your own dependencies. Pick it when your work actually needs the ML stack.
You can still add libraries. The pre-installed set is a starting point, not a limit. Pick the scope based on who needs the library:
| Mechanism | Who sees the library | When it is installed |
|---|---|---|
| Compute-scoped library | All notebooks running on that compute resource | Attached to the compute resource |
| Init script | The whole compute resource | During compute creation |
| Notebook-scoped Python library (%pip install) | Only the current notebook session | When the notebook runs it |
Checkpoint 1 of 9· Check yourself
A data science team uses the general-purpose Databricks Runtime. Each time a cluster starts, a setup step runs pip install for scikit-learn, XGBoost and MLflow, and notebooks wait until it finishes. Every project repeats this step. What removes the step?
Databricks Runtime ML comes with scikit-learn, XGBoost, MLflow and other common ML libraries already installed, so there is nothing to install when the cluster starts. Running the install in parallel, moving it into an init script or importing packages from files still leaves the team maintaining the step.
“automates the creation of a compute resource with pre-built machine learning and deep learning infrastructure including the most common ML and DL libraries”Source: docs.databricks.com
Checkpoint 2 of 9· Exam question
A data science team currently spins up a general-purpose Databricks Runtime cluster and then runs a setup script on every cluster start to install scikit-learn, XGBoost, and MLflow before any notebook can execute. The team wants to remove this manual step and standardize the environment for every new project. Which change addresses this directly?
Correct answer: A — Select Databricks Runtime for Machine Learning when creating the cluster, since it ships with scikit-learn, XGBoost, and MLflow already installed and version-tested together.
- A. Databricks Runtime for Machine Learning is a purpose-built variant that pre-installs and version-tests popular ML libraries including scikit-learn, XGBoost, and MLflow, so clusters are ready for ML work without a setup script.
- B. Parallelizing the pip installs still requires the team to write and maintain the same setup script on every cluster start; it reduces install time but does not remove the manual dependency management the team wants to eliminate.
- C. Importing libraries from files stored on DBFS does not install compiled packages or their native dependencies into the cluster's Python environment, so this approach would not make scikit-learn, XGBoost, or MLflow usable.
- D. Lakeflow Spark Declarative Pipelines orchestrate streaming and batch data transformations; they do not provide a mechanism for pre-installing general-purpose ML libraries onto interactive cluster environments.
2.Top-tier libraries and the maintenance policy
Libraries in the ML runtime are updated with each release, but not all of them get the same treatment. Databricks marks a subset as top-tier libraries. These are updated to the latest package release with every runtime release, unless that would cause a dependency conflict. They also get advanced support, testing and built-in optimizations. The current top-tier list is datasets, GraphFrames, MLflow, PyTorch, scikit-learn, streaming, TensorBoard and transformers. Libraries are added to or removed from this list only in major releases. The list does change: starting with Databricks Runtime 18.0 ML, TensorFlow and spark-tensorflow-connector are no longer top-tier.
A pre-installed library is not guaranteed forever. Databricks removes one when it is no longer actively maintained or when no stable release works on the new runtime. "Not actively maintained" has specific triggers: no new commits in three months together with no new release in more than nine months, an archived repository, or an announced end of maintenance. Hyperopt is a real example. It is not included in Databricks Runtime ML after 16.4 LTS ML, and code that relied on it had to move to something else.
A removal is announced before it happens, in three places:
- a deprecation warning in the runtime release notes, saying the library leaves in the next major ML release
- a notification when you import the library
- updated Databricks documentation marking the library as planned for removal
If you see that import-time notification, you have three options. You can install the library yourself, stay on an earlier ML runtime, or move to a supported replacement. Staying on an old runtime is a short-term fix. The lasting answer is the replacement the current runtime supports.
Distributed deep learning shows how this plays out. Databricks recommends training neural networks on a single machine when possible. When the model or data won't fit in one machine's memory, Databricks Runtime ML includes TorchDistributor, the DeepSpeed distributor and Ray. TorchDistributor is an open-source PySpark module that runs PyTorch training as Spark jobs across the cluster's workers. It is available on Databricks Runtime ML 13.0 and above, and it comes pre-installed on the ML runtime.
from pyspark.ml.torch.distributor import TorchDistributor
def train_fn(learning_rate):
# ...
num_processes=2
distributor = TorchDistributor(num_processes=num_processes, local_mode=True)
distributor.run(train_fn, 1e-3)Checkpoint 3 of 9· Check yourself
Your team's training code depends on PyTorch and scikit-learn in Databricks Runtime ML. Both are top-tier libraries. What does that status mean when a new ML runtime release ships?
Top-tier libraries get the faster update cadence: each runtime release moves them to the latest package release unless that would cause a dependency conflict. Changes to the top-tier list happen only in major releases, and losing top-tier status is not the same as being removed from the runtime.
“updating to the latest package releases with each runtime release (barring dependency conflicts)”Source: docs.databricks.com
Checkpoint 4 of 9· Exam question
A team is migrating a PyTorch model training job that currently uses HorovodRunner to distribute training across multiple GPU workers on a Databricks Runtime for Machine Learning cluster. They want a supported path that does not depend on a library Databricks is phasing out of the ML runtime. Which approach should they take?
Correct answer: C — Rewrite the distributed training loop to use TorchDistributor, the API Databricks now recommends for distributed PyTorch training as Horovod is removed from newer ML runtime releases.
- A. Horovod and HorovodRunner are deprecated and are being removed from Databricks Runtime for Machine Learning in releases after the last LTS version that shipped them, so assuming indefinite support would leave the job broken on a future runtime upgrade.
- B. Lakeflow Spark Declarative Pipelines orchestrate data transformation workloads, not distributed deep learning training loops, so it is not a replacement for HorovodRunner in a PyTorch training job.
- C. TorchDistributor is the API Databricks now recommends for distributed PyTorch training now that Horovod and HorovodRunner are deprecated and are being removed from newer Databricks Runtime ML releases, making it the correct migration target.
- D. Databricks Runtime for Machine Learning continues to support distributed multi-GPU PyTorch training through TorchDistributor, so leaving the platform is unnecessary and discards the pre-configured GPU environment the runtime already provides.
3.GPU variants of the ML runtime
GPU compute uses the ML runtime too, and the runtime handles the hardest part of the setup: matching drivers to libraries. To create GPU compute, check the Machine learning checkbox and choose a GPU instance type as the worker type. You do not pick a separate GPU runtime by hand. The GPU ML version is selected automatically from the worker type. Through the Clusters API, you either set "use_ml_runtime": true with kind = CLASSIC_PREVIEW, or set spark_version to a GPU-enabled version such as 15.4.x-gpu-ml-scala2.12.
On GPU instances, Databricks installs the NVIDIA driver and GPU libraries on the Spark driver and on every worker:
- the CUDA Toolkit, under
/usr/local/cuda - cuDNN, the NVIDIA CUDA Deep Neural Network library
- NCCL, the NVIDIA Collective Communications Library used for communication between GPUs
Library versions are tied to the release. Each Databricks Runtime ML version lists its own library versions in its release notes. So for a fine-tuning job, choose a GPU-enabled ML runtime release. It comes with drivers matched to that release and GPU builds of PyTorch and TensorFlow. Compiling frameworks from source on a standard runtime is the slow path, and Unity Catalog does not add GPU libraries to a cluster. Unity Catalog handles data governance, not drivers.
The standard runtime does have one GPU use: custom Docker images. To build your own GPU image with Databricks Container Services, you must select a standard runtime version, not Databricks Runtime ML for GPU. Those images are based on the official CUDA containers, and you cannot change their NVIDIA driver version because it has to match the host.
Checkpoint 5 of 9· Check yourself
An engineer sets up classic compute for a PyTorch fine-tuning job on GPU instances. Which of these settings will cause a problem?
Photon is not supported with GPU instance types, so its checkbox must be unchecked. Photon also does nothing for Python training libraries like PyTorch. The other settings are correct: the Machine learning checkbox and a GPU worker type are both required, and library versions are tied to each runtime release.
“The Photon acceleration checkbox must be unchecked. Photon is not supported with GPU instance types.”Source: docs.databricks.com
Checkpoint 6 of 9· Exam question
A machine learning engineer is configuring a cluster to fine-tune a deep learning model and needs the cluster to use GPU-accelerated instance types with the correct NVIDIA CUDA drivers and GPU-enabled builds of TensorFlow and PyTorch already in place. What should the engineer do when creating the cluster?
Correct answer: B — Choose a GPU-enabled Databricks Runtime for Machine Learning version, preconfigured with CUDA drivers matched to that release and GPU-enabled TensorFlow and PyTorch builds.
- A. Compiling deep learning frameworks from source against a specific CUDA toolkit is exactly the manual, error-prone setup the ML runtime is designed to avoid, and doing it on a standard runtime forfeits the pre-built GPU stack entirely.
- B. The GPU variant of Databricks Runtime for Machine Learning is built and version-tested specifically for GPU instances, bundling the CUDA drivers and GPU-enabled TensorFlow and PyTorch builds so the engineer does not have to assemble that stack manually.
- C. GPU-enabled ML runtime images are tied to specific releases with matched driver and library versions; picking an arbitrary version without checking that it targets GPU hardware can leave the cluster without the correct CUDA stack for the instance type.
- D. Unity Catalog governs data and model access control and lineage; it has no role in detecting cluster hardware or installing GPU drivers and libraries at startup.
Sources9
4.What Photon and Graviton actually speed up
On CPU compute running Databricks Runtime 15.2 ML or above, you can enable Photon. Photon accelerates work that runs on the JVM side of Spark: Spark SQL, Spark DataFrames, feature engineering, GraphFrames and xgboost4j. Code in non-JVM languages such as Python is not expected to improve, and neither are Spark RDDs or Pandas UDFs. An ML workload is usually a mix of Spark data preparation and Python model training, and only the first part gets faster.
The exception in that list is xgboost4j, the JVM build of XGBoost. Photon helps it, while the Python XGBoost package gets no benefit. Photon also has limited compatibility with Spark RDD APIs and Spark MLlib, and processing large datasets through either can cause Spark memory issues. Photon gives the biggest gains on SQL and DataFrame work with heavy transformations such as joins, aggregations and large table scans.
Graviton is a different kind of option. It is an AWS instance family, not an engine, and Databricks Runtime 15.4 LTS ML and above support it. It covers more of the ML stack than Photon does. It can speed up the Python gradient-boosting libraries that Photon cannot help, and it may also give better price-to-performance than other EC2 instance types.
| Aspect | Photon | Graviton |
|---|---|---|
| What it is | Acceleration you enable on the compute | AWS instance type |
| Minimum ML runtime | 15.2 ML | 15.4 LTS ML |
| Speeds up | Spark SQL, Spark DataFrames, feature engineering, GraphFrames, xgboost4j | Spark, Photon, feature engineering, XGBoost, LightGBM, Spark MLlib gradient boosting |
| Caveat or extra benefit | No gain for Spark RDDs, Pandas UDFs, Python XGBoost, PyTorch, TensorFlow; limited compatibility with Spark MLlib | May give better price-to-performance than other AWS EC2 instance types |
Checkpoint 7 of 9· Check yourself
On CPU compute, the slow part of a pipeline is model training with the Python XGBoost and LightGBM packages. Feature preparation is already fast. Which change is most likely to speed up the training?
Graviton instance types on 15.4 LTS ML and above can speed up gradient-boosting libraries such as XGBoost and LightGBM. Photon helps only xgboost4j, the JVM build of XGBoost. It does nothing for Python packages, Pandas UDFs or Spark RDDs, and it has limited compatibility with RDD APIs.
“Using Graviton instance types can improve performance for Spark, Photon, feature engineering, machine learning libraries such as XGBoost and LightGBM”Source: docs.databricks.com
5.Dedicated access mode, and AI Runtime for GPU work
To read Unity Catalog data from Databricks Runtime ML, the compute must use Dedicated access mode. A Dedicated compute resource is assigned to a single user or to a group. You rarely set this by hand. Checking the Machine learning checkbox switches the access mode to Dedicated and assigns you as the dedicated user. Under Advanced, you can reassign the compute to another user or to a group. When a group owns it, each member's permissions are reduced to the group's permissions, so members can share the cluster safely.
The runtime version matters here too. On dedicated access mode, two features need Databricks Runtime 15.4 LTS ML or above: fine-grained access control, and querying tables created by Lakeflow pipelines, including streaming tables and materialized views. A cluster on an older ML release can reach Unity Catalog but cannot read a materialized view.
Keep Dedicated access mode and assign the compute to a group. Unity Catalog access from Databricks Runtime ML requires Dedicated mode, and assigning it to a group reduces each member's permissions to the group's permissions.
For GPU work there is now a second option. AI Runtime is serverless GPU compute built for custom deep learning, such as fine-tuning LLMs or training computer vision models. It is in Public Preview. For custom fine-tuning or training on GPUs, Databricks recommends AI Runtime over Databricks Runtime ML. There is no cluster configuration, driver selection or autoscaling policy to manage, provisioning is faster, and you can start from a Standard environment or an AI environment that comes with packages such as Transformers and Ray.
| Aspect | Databricks Runtime ML | AI Runtime |
|---|---|---|
| Compute model | Classic compute you configure | Serverless GPU, no cluster infrastructure to manage |
| Workloads | Classic ML and deep learning, on CPU or GPU | Custom single-node and multi-node deep learning |
| Hardware options | CPU and GPU instance types, including AWS Graviton | A10 GPUs and H100 GPUs |
| Libraries | Pre-installed libraries such as PyTorch, TensorFlow and XGBoost | Default base environment, or AI environment with packages like Transformers and Ray |
Databricks Runtime ML is still the right choice for CPU-based classic ML, for Spark-integrated pipelines, and when you need the full pre-installed library set on a cluster you control. AI Runtime is the better choice for a GPU deep learning job that you want running quickly without managing drivers or clusters. On AI Runtime, only the 8xH100 and 8xB300 accelerators support multi-GPU distributed training. The 1xA10 and 1xH100 options are single-GPU.
Checkpoint 8 of 9· Check yourself
A cluster runs Databricks Runtime 14.3 ML in Dedicated access mode. It reads ordinary Unity Catalog tables without trouble, but a query on a materialized view created by a Lakeflow pipeline fails. What fixes this?
On Dedicated access mode, querying tables created by Lakeflow pipelines, including streaming tables and materialized views, needs Databricks Runtime 15.4 LTS ML or above. Leaving Dedicated mode would break Unity Catalog access from the ML runtime, and neither assigning the compute to a group nor enabling Photon changes the runtime version.
“When using dedicated access mode, the following features are only available on Databricks Runtime 15.4 LTS ML and above:”Source: docs.databricks.com
Checkpoint 9 of 9· Check yourself
Which compute does Databricks recommend for fine-tuning a custom LLM on GPUs when the team wants the job running quickly without managing drivers or clusters?
For custom deep learning such as fine-tuning or training on GPUs, Databricks recommends AI Runtime over Databricks Runtime ML because it is serverless and provisions faster. Custom GPU images cannot change the NVIDIA driver version, and Graviton is a CPU instance family.
“Databricks recommends using AI Runtime instead of Databricks Runtime ML.”Source: docs.databricks.com
Sources
(10)
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.
“automates the creation of a compute resource with pre-built machine learning and deep learning infrastructure including the most common ML and DL libraries”
↩︎ A cluster that starts with the ML stack installed“To install a library that is available only to a specific notebook session, use Notebook-scoped Python libraries.”
↩︎ A cluster that starts with the ML stack installed“Photon improves performance for applications using Spark SQL, Spark DataFrames, feature engineering, GraphFrames, and xgboost4j.”
↩︎ What Photon and Graviton actually speed up“It is not expected to improve performance on applications using Spark RDDs, Pandas UDFs, and non-JVM languages such as Python.”
↩︎ What Photon and Graviton actually speed up“Graviton instances may also provide better price-to-performance value than other AWS EC2 instance types.”
↩︎ What Photon and Graviton actually speed up“To access data in Unity Catalog on a compute resource running Databricks Runtime ML, you must set the access mode to Dedicated.”
↩︎ Dedicated access mode, and AI Runtime for GPU work“When a compute resource has Dedicated access mode, the resource can be assigned to a single user or a group.”
↩︎ Dedicated access mode, and AI Runtime for GPU work“This automatically sets the access mode to Dedicated with your account as the dedicated user.”
↩︎ Dedicated access mode, and AI Runtime for GPU work“When using dedicated access mode, the following features are only available on Databricks Runtime 15.4 LTS ML and above:”
↩︎ Dedicated access mode, and AI Runtime for GPU work“Databricks recommends using AI Runtime instead of Databricks Runtime ML”
↩︎ Dedicated access mode, and AI Runtime for GPU work“Python packages such as XGBoost, PyTorch, and TensorFlow will not see an improvement with Photon.”
↩︎ Exam trap 1“To access data in Unity Catalog on a compute resource running Databricks Runtime ML, you must set the access mode to Dedicated.”
↩︎ Exam trap 4“Python packages such as XGBoost, PyTorch, and TensorFlow will not see an improvement with Photon.”
↩︎ Prediction“Using Graviton instance types can improve performance for Spark, Photon, feature engineering, machine learning libraries such as XGBoost and LightGBM”
↩︎ Checkpoint“Databricks recommends using AI Runtime instead of Databricks Runtime ML.”
↩︎ Checkpoint - 2.
“pre-configured cluster environments with major ML libraries pre-installed and tested together”
↩︎ A cluster that starts with the ML stack installed“pre-configured cluster environments with major ML libraries pre-installed and tested together”
↩︎ Key concept - 3.
“Includes popular libraries like PyTorch, TensorFlow, and XGBoost, which receive frequent updates and optimized support.”
↩︎ A cluster that starts with the ML stack installed - 4.
“Init scripts can introduce unexpected behaviors, including library conflicts that break workloads and make environments less predictable.”
↩︎ A cluster that starts with the ML stack installed“Installing libraries at the compute level creates environment drift across jobs.”
↩︎ A cluster that starts with the ML stack installed“Databricks Runtime for ML installs a large set of libraries that can conflict with your own dependencies if not needed”
↩︎ A cluster that starts with the ML stack installed“it is most beneficial for SQL workloads and DataFrame operations involving complex transformations, such as joins, aggregations, and data scans on large tables”
↩︎ What Photon and Graviton actually speed up - 5.
“Top-tier libraries are added or removed only with major releases.”
↩︎ Top-tier libraries and the maintenance policy“Starting with Databricks Runtime 18.0 ML, TensorFlow and spark-tensorflow-connector are no longer top-tier libraries.”
↩︎ Top-tier libraries and the maintenance policy“No new commits in three months and no new releases in more than nine months.”
↩︎ Top-tier libraries and the maintenance policy“A notification is displayed when importing the library, indicating that the library will be removed in the next major Databricks Runtime ML release.”
↩︎ Top-tier libraries and the maintenance policy“you can either install the library manually or use an earlier version of Databricks Runtime ML”
↩︎ Top-tier libraries and the maintenance policy“updating to the latest package releases with each runtime release (barring dependency conflicts)”
↩︎ Checkpoint - 6.https://docs.databricks.com/aws/en/machine-learning/automl-hyperparam-tuning/hyperopt-distributed-mlOfficial docs
“Hyperopt is not included in Databricks Runtime for Machine Learning after 16.4 LTS ML.”
↩︎ Top-tier libraries and the maintenance policy“Hyperopt is not included in Databricks Runtime for Machine Learning after 16.4 LTS ML.”
↩︎ Exam trap 3 - 7.
“For these workloads, Databricks Runtime ML includes the TorchDistributor, DeepSpeed distributor and Ray packages.”
↩︎ Top-tier libraries and the maintenance policy“so it lets you launch PyTorch training jobs as Spark jobs”
↩︎ Top-tier libraries and the maintenance policy - 8.
“Most of these errors can likely be resolved with TorchDistributor, which is available on Databricks Runtime ML 13.0 and above.”
↩︎ Top-tier libraries and the maintenance policy - 9.https://docs.databricks.com/aws/en/compute/gpuOfficial docs
“The GPU ML version is chosen automatically based on the worker type.”
↩︎ GPU variants of the ML runtime“Databricks installs the NVIDIA driver and libraries required to use GPUs on Spark driver and worker instances”
↩︎ GPU variants of the ML runtime“For the versions of the libraries included, see the release notes for the specific Databricks Runtime version you are using.”
↩︎ GPU variants of the ML runtime“To create custom images for GPU compute, you must select a standard runtime version instead of Databricks Runtime ML for GPU.”
↩︎ GPU variants of the ML runtime“Photon is not supported with GPU instance types.”
↩︎ GPU variants of the ML runtime“The GPU ML version is chosen automatically based on the worker type.”
↩︎ Exam trap 2“The Photon acceleration checkbox must be unchecked. Photon is not supported with GPU instance types.”
↩︎ Checkpoint - 10.
“Only 8xH100 and 8xB300 support multi-GPU distributed training.”
↩︎ Dedicated access mode, and AI Runtime for GPU work