Scaling XGBoost With Spark Connect ML on Grace Blackwell
Summary
- Vertical scaling: Grace Blackwell's ultra-fast chip-to-chip link between CPU and GPU enables XGBoost to scale training capacity to over 1.2TB on a single node.
- Out-of-core algorithms: Distributed implementation fetches data in batches, benefiting significantly from latest NVIDIA GPU technology and NVLink bandwidth.
- Spark integration: Combining XGBoost out-of-core algorithms with Spark Connect ML enables terabyte-scale model training workflows on GPU clusters.
Scaling XGBoost With Spark Connect ML on Grace Blackwell

Talk by Bobby Wang, Engineer, NVIDIA ; Jiaming Yuan, Engineer, NVIDIA Semiconductor Co., Ltd
XGBoost is one of the off-the-shelf gradient boosting algorithms for analyzing tabular datasets. Unlike deep learning, gradient-boosting decision trees require the entire dataset to be in memory for efficient model training. To overcome the limitation, XGBoost features a distributed out-of-core implementation that fetches data in batch, which benefits significantly from the latest NVIDIA GPUs and the NVLink-C2C’s ultra bandwidth. In this talk, we will share our work on optimizing XGBoost using the Grace Blackwell super chip. The fast chip-to-chip link between the CPU and the GPU enables XGBoost to scale up without compromising performance. Our work has effectively increased XGBoost’s training capacity to over 1.2TB on a single node. The approach is scalable to GPU clusters using Spark, enabling XGBoost to handle terabytes of data efficiently. We will demonstrate combining XGBoost out-of-core algorithms with the latest connect ML from Spark 4.0 for large model training workflows.
Databricks Named a Leader in the 2025 Gartner® Magic Quadrant™ for Data Science and Machine Learning Platforms: https://www.databricks.com/blog/databricks-named-leader-2025-gartner-magic-quadrant-data-science-and-machine-learning
Build and deploy quality AI agent systems: https://www.databricks.com/product/artificial-intelligence
See all the product announcements from Data + AI Summit: https://www.databricks.com/events/dataaisummit-2025-announcements
FAQs
Why does XGBoost need out-of-core algorithms?
XGBoost requires entire datasets in memory for efficient training. Out-of-core implementations fetch data in batches, benefiting from GPU technology and NVLink bandwidth to overcome memory limitations.
How does Grace Blackwell improve XGBoost performance?
The ultra-fast chip-to-chip link between Grace Blackwell's CPU and GPU enables XGBoost to scale training capacity to over 1.2TB on a single node without compromising performance.
How can I choose between CPU, single-GPU, and distributed GPU training?
Use CPU for small datasets and prototyping. Use single-GPU with Grace Blackwell for terabyte-scale data that fits on modern GPUs. Use distributed GPU via Spark Connect ML on the Databricks Data and AI platform for multi-terabyte datasets requiring horizontal scaling. This video demonstrates practical thresholds for each approach.
What are single-node alternatives to Spark?
Single-node systems include Dask, Ray, and GPU-native frameworks like RAPIDS. For most enterprise ML workloads on the Databricks Data and AI platform, Spark Connect ML provides the best balance of simplicity and scalability through a familiar Spark API with GPU acceleration.
How can organizations train deep learning models without managing GPU infrastructure?
Use Databricks Mosaic AI Model Serving and Training on the Databricks Data and AI platform, which provides managed GPU access without infrastructure management. Spark Connect ML automatically distributes training across GPU nodes, handling resource allocation and fault tolerance automatically.
Full transcript
Yeah. Uh thank you for joining us today. Uh we are here to talk about scaling extra boost with spark connect ML and with the latest Nvidia hardware and thank you for joining us. I am Jaming Yuen. I work for Nvidia and I help develop the extra book boost project. You can find me on GitHub, the guy who made a lots of commits there. Yeah, I regret the title, but it is what it is. It's way too specific. Uh, but the techniques we talk about here can be applied to other algorithms as well.
There are lots of toack uh unpack. So, we have XUS, we have Spark, we have connect ML and we have media hardware. the grace blackwell I need to set the main topic for this talk what we want to focus on and that is the first word of the title uh scaling we want to scale up extri training with all those uh frameworks and infrastructures in here is the application that we want to use to illustrate the infrastructure the hardware ware infrastructure the software infrastructure and those are the things we want to illustrate.
I will give a brief introduction to HTUS what it is what it does and then I will talk about vertical scaling with the emul chip to chip and that is the grace what I was talking about and then will talk about how to combine all these into all these pieces with a single framework with the help of spark connect ML Cool. Good. Uh let me give a brief introduction to ext. Wow, that is a lot. All right, great. So I don't have to give much of introduction.
Yeah, but anyway. Yeah. So it's a machine learning library for building decision trees. supports many target types from simple regression to recommendation systems and also you can define your custom objective for other tasks. Uh for example, maybe you want to do forecasting, maybe you want to do some causal inference and whatnot and like other decision tree based model is excels at tabular data sets not so good with some other things like text.
So the basic idea behind decision trees is that we can uh gradient boosting decision trees is that we can build one tree at a time and for each and every iteration and then we can combine all these trees into a single large model. The hus implementations supports both numerical features and categorical features and it is accelerated by a media GPU. again I work for Nvidia. So if I talk about GPU it's Nvidia. Yeah. So since here we are talk we are here to talk about scaling and when it comes to scaling there are two approaches that we usually talk about.
Uh the first one is vertical scaling which means we want to train with more data on a single node. Uh that brings us to the first topic of this talk which is the external memory version of HT boost. We sometime call it out of core just to be fancy but yeah we'll talk a lot more about out of core training. And the second thing we want to talk about is horizontal scaling which is the distributed training. And that means we want to train a model with a lots of workers, lots of nodes and bit CPUs or bit GPUs and with the help of distributed frameworks like spark pispark and in this talk the spark connect ML which is the latest iteration of spark uh it's available with spark 4.
- Yeah, that is the brief introduction. So I don't see I need to dive more into that. We have documentation, we have examples. Feel free to reach out after the talk. We'll be somewhere around this room. Yeah, just wondering around and see if someone wants to chat. Uh but if you are not familiar with extra boost that is fine as well. Just think of it as a library for building decision trees. It's not sophisticated. All right.
Does that make sense? All right. So, Husse is actually a quite popular libraries. So, people use it for various types of problem that may or may not fit. Sometimes you don't need machine learning at all, but they use it anyway. Yeah. So sometimes ext is not the optimal solutions but you can still use it as a baseline as a reference to your better solution and that's what people do but you never read decision tree on the news right you never see hey decision tree company is going to the slot market never happens and you read about large language model you read about open AI on the news they are making the splashes not attributes not decision trees and that is for good reasons.
Neon network is remarkable because it's so easy to scale. Uh if you have a background in neo network, you have probably use one of those uh stoistic gradient descent algorithm. Some some people call it graduate descent, but that's not my idea. So that means when you train a neuronet network, you usually fit batches of the data into the training algorithm. So you never load all the data into the main memory and then enables you to scale with larger and larger data.
But unfortunately that is not true for many other types of algorithm and in our case that's not true for decision tree with gradient boosting. We have to load the entire data set into the main memory for efficient training and that puts a severe limitation for what we can do with gradient boosting decision chase. You are limited by the size of the GPU memory which is not a lot. Let's say 60 gigabytes that is already a really expensive GPU and you can't go upper.
On the other hand, we have larger and larger data set to combat the bias and variance problem. There is no replacement for more data. That is the only solution and it is the best solution. To give you a bit more context for what I'm talking about, another colleague of mine wrote a blog post about scaling attributes and he was using task at the time, not important. He's a very nice person and this is what he said in the blog post in his blog post I posted the link there he said it is a common hurdle to scale issues because of the memory error and addressing these errors is challenging not important again so the important thing here is that I want you to know he's a very nice person because he didn't actually say any of this in his original blog post before publishing He he let me read the draft before publishing the blog post and I want to show you the original version.
Yeah. Ready? Yeah. He said it's riddles. We've heard those. He didn't say challenging and incredibly frustrating. Yeah. That's his inner voice. So I asked and so he he's trying to be nice with me and so he changed the wording but so he tried to be nice and honest at the same time. Difficult difficult line to walk. You can try uh but the message is clear. Um the pain is shared not just with him but with many other HTUS users always running into out of memory errors and we want to train with larger data sets but HTUS always wants you to load the entire data set into the main memory be GPU or CPU you are getting OM error and that's unfortunate.
So we have this conundrum for small data set you don't really care about acceleration right because small data sets are easy to train it's fast but when you have a large data set and you think of a GPU hey can I use a GPU to accelerate the training and the answer might disappoint you because you can't fit the data into the main memory so another solution is to use a lots of GPU and I wrote for a media so you are welcome to do that but on the other hand it might get get expensive so this is our conom we want the GPU to handle large data set but you cannot do that because you have to fit the data into the GPU memory so prior to the last release we had some other solutions as well uh these are still good solutions we are not abandoning in them anytime soon.
And the first one and the most important one is the direct contisation. We can compress the data batch by batch through contisation. And so during the process of contisation, we don't have to load the entire data set into the main memory and at the end we compress the data through condensation and we concatenate the result of the condensation. So in a way we can train larger than me uh GPU memory size of data set thanks to compraction.
Yeah. Uh how many people have used this data structure called the quantity matrix before? Okay. A few. Yeah. We don't talk about it enough. Yeah. But that is still a severe limitation, right? because we at the end we still have to concatenate all the data into a single batch and that is still bound by the size of the GPU memory and that's what we want to get rid of that bound. We want to go beyond the GPU memory. So at this point we ask ourself maybe it's over we just use neo network for everything.
Yeah, if you walk around this conference the conference enter a random room the chances is that it's talking about large language model not neo not decision trees. So yeah, obviously data bricks think the neo network is take has taken over the role now and that's for good reasons but we still want to use some other more traditional models like uh decision tree. It does what it does best. Uh for example it's easy easy to explain.
You can calculate the exact sharp values for decision trees. It runs with tabio data set and has builtin support for categorical features. These are not just advantage of hub boost. It's advantage for all decision trees and you will probably use other machine learning models as well. So we are not ready to just use neon network for everything. And then the second question is we want we want to ask is is it possible for us to scale decision tree training just like how those crazy people scale neo network.
Yeah if you are here I assume you have seen one of those large language models before but otherwise I don't know which rock you're living under but I I hope this talk is useful to you as well. Yeah, that's our goal. We want to scale decision trees just like how people scale deep learning models. And to answer that question, how do we do that? And the first solution that we came to is external memory. So what is it? We call it sometime out of core training.
And people might not be familiar with it. Even if you use extra boost before, we don't talk about it very often and we mark it as experimental features for a very long time since day one for many years and that was for good reason because it's really difficult to do and now we are just getting started with this feature in the latest release. So what is it? It's just a fancy way of saying that I want to store the data outside of the main memory.
So for GPU I want to store the data on the CPUs and which hopefully is larger than the GPU memory size and we want to fetch the data batch by batch so that we don't have to load the entire data set into the GPU memory. Here is a comparison between incore training and out of core training. So if you have used one of those machine learning libraries like the succulent then you are already familiar with incore training because you have to load the entire data set into a numpy array or appendance data frame maybe something else like polers but during training when you call the fit method you should have the entire data set in the main memory and that's in call training it's fast but on the other hand we have out of core training which is a bit more like training a torch model so neon network again so that means you can store the data on somewhere else maybe CPU memory maybe on a custom file system I don't know but in the end when you train the model you can load the data batch by batch and that what enables neuron network to do all this amazing thing because it can scale up is not limited by the machine by the size of the machine.
Yeah. So we haven't really talked about external memory for H boost before. we we don't even want to answer issues on GitHub because uh for external memory because it was so difficult to do um prior to 2024 in the last release we have make a lots of new features to enable that for GPU and we have a new streaming algorithm we have data backends and then we have access to the latest CUDA features so you see the CUDA item there that's the CUDA features that lets you access CPU directly from a GPU kernel.
And so most important thing here is the new quantile dmatrix for the contation. So I showed you the internal diagram for quantile D matrix earlier and the only difference here is that we don't want to concatenate the data as I said I want to load the data into the main memory batch by batch and that is the first step that I need to do sorry yeah uh the that is a starting point because we want to store all these budgetes without concatenate them and store them outside of the main memory and then we can fetch these batches during training on demand.
So there is a difference for HTUS external memory with the torch model neuronet networks uh stic gradient descent we still need the entire data set for each and every decision tree. It it is still not a statistic algorithm. Yeah. So if you train a decision tree with only a small batch of the data that is a very low subsampling rate and it will hurt the accuracy of your model and we don't want that. So uh this is available in the public documentation.
It's just a snappy. If you used hus before this should look familiar with you. You just have to define a iterator. We have some best practices for using the new external memory. The default parameters for training should be good. I just list them here explicitly but you don't have to change anything. The most important thing here is the external memory contact the matrix. There are some parameters you can tune and you are feel free to reach out after the talk you are if you are interested.
So we made a lots of changes and we make a new release even. Are we done yet? Can we just use external memory everything? Well, if so, then we can just go down the stage and say say hi. But no, it's still quite difficult to do. And when you work on optimization for any computer code, the first thing you come to mind is data locality. There is not not not a second thing that is more important than data locality. And when you put your data outside of the main memory, we need to read the data.
And reading data can be really expensive even if it's on the CPU memory. And for our case, it takes much longer to read the data than it is to train a model. And hence there is a significant overhead in there when we start training with external memory. We'll see more details through a profiler later in this talk. But this is the mental image that you should have. The overhead is caused by data rating and that's why we don't really work on it couple years before.
There's no way around it. But now we have one. So that's brings us to one of the major topic of this talk which is the latest hardware the amink chip to chip. It enables us to do radical scaling with extra boost. So yeah let me give a brief introduction to the chip to chip link. So it's available with the latest and media hardware uh grace plat and grace hot. So it's a hardware link that connects uh multiple chips together.
But in our case, what we care about here is the is it connects the CPU with the GPU. Here the name uh the grace is the name of the CPU and Her is the name for the GPU. Same goes for grace val. It's an ultra fast link. So it can transfer data through these different chips in a very high throughput. Uh let me recap here. So why why do we want to use this uh latest hardware is not cheap. So we want to train larger than GPU memory size.
But when we cache the data somewhere uh outside of the GPU memory reading the data can be expensive. So our solution is can we speed up the data rate and that is what M link is here to help us to do. We asked before so is it possible to train decision tree in a way that's as scalable as deep learning models. That is the problem. And with link we are getting much closer. So I don't want to jump the gun but it's not there yet but we are getting much much closer and with mink there is basically little to no overhead when you use external memory.
We'll see the results later but here it's quite remarkable to me because I have been dealing with this frustrations for years and now it's basically gone. Here is a comparison between the chip to chip link and normal PCIe4. So if you have assembled a PC before yourself then you should be familiar with PCIe. So when you connect the GPU with the motherboard that slot is consisted of PCIe and I want you to focus on the performance here.
So on on on one hand we have PCIe4 which has about 24 GB per second of the throughput. That means you can copy at most 24 gigabytes of the data from CPU to GPU per second. That's not fast. So if you have access to one of those gen five machines, so it can double that, but still 48 GB, not much. Fast enough for gaming, but not fast enough for training decision tree models. So on the other side we have the chip to chip link which has at least 350 gigabytes sorry of the transfer throughput that is more than 10 times.
Yeah that that is the throughput that enables us to scale the decision decision tree training and you can apply it to other types of algorithms as well as long as you need fast data rate. Yeah, I drew the diagram for how it looks like when we train HTUS model. This is the comparison. So if we can read the data with high throughput then we can eliminate all the overhead. Um this is diagram that I drew and I want you to look at what it looks like through a profiler.
This is a profiler uh the inside system. You can access it online and this is what it looks like when XUS is training models. On the PCIe4 side, you have a lots of Y gaps and those Y gaps are the overhead that I was talking about. the date uh the computation is waiting for the data to arrive from the CPU to GPU and that basically makes the GPU a nonsense because it's might be slower than the CPU because of it's waiting for data to arrive and that is what makes the chip to chip length amazing because when you look at the other picture there is little to no overhead there because there is little to no wide gaps between the computation Since the Mang chip to chip is a hardware so there's not much changes required from the user.
If you have access to one of those machines then you can just run the out of core chain linking on it. Yeah. So uh most of the previous slide was about the chip to chip link which is available with gracehapper and grace flatwell but now it's 2020 uh 2025 we are moving from gracehapper to grace blackwell and I want to talk about some of the things that we are currently doing this is still in development and it's not mature yet but yeah the first thing to notice is that Grace backrow the background GPU has much much larger GPU memory size.
So for the grace blackout platform I think the size of GPU memory is 196 gigabytes. That's quite amazing for a single GPU. So I could not imagine that a few years back then almost 200 gigabytes of GPU memory for a single GPU. On the other hand, there are multiple configurations for the CPU GPU combination. So in with grace hopper, you can access one grace with one hopper. That is the fixed configuration is one grace one hopper or two grace two hopper.
The ratio is one always one with grace hopper. But with grace blackwell this can be configurate. You can have one great CPU with two blackwell GPUs or you can have one great CPU with one blackwell GPU. And that's where the catch is because that actually kind of brought me some troubles. When you have one CPU and you connect it with two GPUs, the bandwidth is shared between these two GPUs and that means half of this bandwidth.
So that's for HG boost that is where the large GPU memory size comes in because we can split the data cach between the CPU and the GPU and that's how we work around the reduced bandwidth for the grace blackwell some variants. Another amazing feature about grace blackwell is that it has a hardware uh decompression engine. So for attributable contation does most of the compression. Um it does well with dense data but not true for sparse data. for sparse data is quite difficult for attributes itself to compress the data and we can use some extra help with some other compression algorithm like the LT4 and the hardware decompression engine supports all this decompression engine and we can decompress the data on demand on the fly during training batch by batch and that is quite amazing that helps us significantly when we try to reduce the memory usage and reduce the bandwidth usage.
Yeah, I want to talk more about numer but uh it seems I have a very short time limit. So here is a diagram that I drew manually. I hope that's good. So we have new CPU, we have new GPU, we have a hardware link that connects the CPU and GPU and we build a external memory version of HTUS on top of this hardware. Uh Bobby will talk more about the spark connect ML after I wrap up my talk. So that is a lots of talk but I want to show you the performance to show that is it worth it to do to do all this.
So how what's the largest data set you have trained on with HG boost less than 100 gigabytes maybe large GBM cat boost what's the largest data set with a GPU yeah for me that's about the number and now we are training decision trees with terabytes of data that's not a terabyte of data of CSV file sitting somewhere not a SVM file We are training terabytes of data with dense floating point matrix for gradient boosting decision trees on a single node.
Yeah. So I wrote for a media and that's got a grand tradition. I have to compare against CPU for performance. I use 500 gigabytes of the data for benchmarking here. You can go higher if you want, but just to know that it takes more than 10 hours for the CPU to finish. Yeah. Uh lastly to wrap up my talk, I want to share the road map for what we are going to do. And so most of the changes are already in the latest release and we are working on spark ML integration and we are working on the background support.
Also we are planning to expand the external memory capability with multi output and with cross validation. So unlike large language model we still need cross validation apparently. Yeah. Um my colleague will try to bring all this together. That is the rocket science. Thank you. Thank you. Thanks. Thanks everyone. Today I'm going to discuss XD boost with spark connect ML. So but uh first I I'd like to introduce a little bit about spark connect and spark connect ML.
So spark connect is a decoupled client uh client server architecture that allows uh connecting to the remote spark clusters by using the data frame APIs and uh you know use um the unreserve unreserved logic plans as a protocol. But uh before spark 4 uh spark collected many focused on the data applications which means there were no spark ml applications uh supported officially by the spark. Uh so this raises the question can we run the machine learning algorithms uh with the spark connect?
Well there will be two different cases. uh for the first case for the Python based libraries uh for example torch distributor uh actually we can use the mapping palace mapping arrow to achieve this but uh for the JM based ML libraries the answer is no we even uh even even for the spark built-in ML library we can't do it so with this limitation we introduced uh spark connect ML starting with spark actually spark uh spark 4.
- So spark connect ML is a new feature in the spark to now running the uh JM based ML libraries on the spark on the spark connect. Um so with spark connect ML actually we can run this piece of code on the both you know spark clux mode and the spark connect mode without changing any code without changing any of your code. So to achieve this spark connect ML defense some command specific protocols to align with the spark core ML framework.
For example, here the fed the fit protocol is true with the spark estimator fate. Uh the red write is to with the spark ml read right. Uh it also defends some um relation specific protocols for the ML for example uh I mean uh the protocol is to annihil with the uh some special cases like some API attributes that return to the frame. For example, here the transform protocol is to align with the transform dot transform you know which return data frame which is a relation.
So in this section I'm going to um show you how easy it is to extend actually boost gem package with spark connect ml. So first we need to start a spark cluster. Uh here I use the uh the spark salon cluster as an example. So the left side is to start a CPU cluster while the right side is to start a GPU cluster. Uh second we need to start a spark connect server. The left side is to start a cl server uh connecting to the CPU cluster while the left side the right side is to uh connect to the GPU cluster.
Uh actually currently we are working on a PR that puts the spark XT boost connect Python client into the existing it boost Python package. So in that case we can use the act boost class uh active boost estimators directly from the active boost package for example here active boost connect and then we can run below demo that enables active boost to run on the spark connect. So finally um we did the benchmarking test for both CPU cluster and the GPU cluster when enabling the uh external external memory for the GPU for the GPU case.
So here we use a data set uh which has uh five 12 features totaling one terabytes and we uh we trained 1,000 trees uh with most the default exe parameters here and for the CPU cluster we used 11 M5D 24x nodes. Uh each load each load has like uh 96 uh CPU cores and 384 gigabytes CPU memory. GPU we will use uh uh Gracehopper 2002 which has two uh Gracehopper uh 200 GPUs. So you can see from the right picture um when enabling the external memory the GPU training time is like uh just oneird of the CPU training time. uh the GPU cost here you can see from the red red picture is just 5% of the CPU cost which is quite amazing right so I guess that's um yeah that's all so here are some reference uh the PR to introduce the Spark connect ML uh the Jira and the PR to put the to support support connect uh in in active boost actually we are working on uh we will public the you know the script to reproduce the performance uh we will put here uh after talk after talking so uh yeah I guess that's all so any questions
Learn more about the Databricks Data and AI platform.
The information provided herein is for general informational purposes only and may not reflect the most current product capabilities or configurations.