Cert EspressoLearn. Practise. Find your flow.

A LITTLE FOCUS.
A BIG NEXT STEP.

Your pace. Your space.
Databricks · Databricks Machine Learning Professional

Scaling up or out, data or model parallelism

Databricks Machine Learning Professional · Lesson 4 of 22 · 21:58

YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗

Learning with these videos? Subscribe for new courses and exam-style questions.

In this lesson

Prepare for the Databricks Certified Machine Learning Professional exam. In this lesson: scaling up to a bigger node or out to more nodes, the cost of distributed code, data parallelism with TorchDistributor, and model parallelism when a model does not fit on one device. Includes three original practice questions.

Study notes

The text of this lesson, to read at your own pace. Information as of November 2026.

More compute, but which kind

Pebblecove's photo team wants a deep learning model that flags misleading listing photos, trained on millions of images, while the pricing team trains gradient boosted trees on a table of a few gigabytes. Both teams ask for more compute, but not the same kind. This lesson covers vertical and horizontal scaling, and data and model parallelism.

Scaling up

Scaling up, or vertical scaling, means a bigger machine: more memory, more CPU cores, or more and larger GPUs on one node. The code does not change, so a single node library like scikit-learn, XGBoost, or PyTorch simply runs faster, or fits a larger dataset in memory. Its limits are the largest machine available, and a higher price per node. And Databricks recommends training a neural network on a single machine when possible, because distributed code is more complex, and slower because of the communication between machines.

Scaling out

Scaling out, or horizontal scaling, adds machines and splits the work across them. Spark ML, Ray, and the TorchDistributor all scale out, which removes the memory limit of one machine, and lets the cluster grow with the data. The cost is code written for distribution, and time spent moving data and synchronizing the workers, so a small job can even run slower than on one node. Scale out when the data or the model does not fit on the largest sensible machine, or when many independent tasks, like tuning trials or one model per group, can run side by side.

Data parallelism

When training itself is distributed, there are two main strategies. In data parallelism, each worker holds a full copy of the model and trains on its own share of the data, and the workers then synchronize their gradients, so the copies stay identical. This is the usual choice when the model fits in the memory of one GPU but the data is large, and it is what distributed data parallel training does in PyTorch. On Databricks, the TorchDistributor launches PyTorch training as a Spark job, with a number of processes, and GPUs when you ask for them.

Model parallelism

In model parallelism, the model itself is split across devices, because its parameters do not fit in the memory of one GPU. Different layers, or parts of layers, sit on different devices, and the data flows through them in turn, as in pipeline parallelism. It is more complex, and it adds communication at every step, so use it only when the model is too large. DeepSpeed, which Databricks Runtime ML includes, reduces the memory use of large models, and supports this kind of parallelism. And for tuning, the simplest parallelism of all is one full model per trial, each trial on its own worker.

Recap

Let's recap. Scaling up means a bigger machine, with no code change, up to the largest machine and at a higher price per node. Scaling out adds machines with Spark ML, Ray, or the TorchDistributor, and pays for it in distributed code and communication. Databricks recommends a single machine for neural networks when possible. Data parallelism copies the model to each worker and splits the data, when the model fits on one GPU. And model parallelism splits the model across devices, with tools like DeepSpeed, when it does not.

Quick checks for this lesson

The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.

  1. The pricing table is six gigabytes, its XGBoost training is too slow on a small node, and the code should stay unchanged. What fits?

    • Rewrite the training in Spark ML
    • A node with more cores and memory
    • Model parallelism across GPUs
    • The TorchDistributor on four nodes
    Show the answer

    A node with more cores and memory

    The data fits on one machine, so a node with more cores and memory speeds up the same code. “Rewrite the training in Spark ML” would rewrite the training for a cluster that the data does not need. “Model parallelism across GPUs” would split a model across GPUs, which only helps a model too large for one device. And “The TorchDistributor on four nodes” would distribute PyTorch training, not XGBoost on a few gigabytes.

  2. The photo model fits on one GPU, but training it on millions of images takes days. Which strategy fits?

    • Data parallelism across several GPUs
    • Model parallelism across several GPUs
    • A larger CPU-only node
    • One independent model per trial
    Show the answer

    Data parallelism across several GPUs

    The model fits on one GPU and the data is the problem, so each GPU trains a copy on its share of the images. “Model parallelism across several GPUs” would split the model itself, which adds communication that this model does not need. “A larger CPU-only node” would slow down deep learning, which runs best on GPUs. And “One independent model per trial” would train independent models, which does not speed up one training run.

  3. The parameters of a large language model do not fit in one GPU’s memory, even before any data is loaded. What does training need?

    • Data parallelism, one full copy per GPU
    • More CPU cores on the driver
    • One model per tuning trial
    • Model parallelism across several GPUs
    Show the answer

    Model parallelism across several GPUs

    The model is too large for one device, so its parameters must be split across GPUs, for example with DeepSpeed. “Data parallelism, one full copy per GPU” would copy the full model to each GPU, which still does not fit. “More CPU cores on the driver” would add CPU cores, which does not help a model that needs GPU memory. And “One model per tuning trial” would help tuning, but each trial still holds a full model.