Very Fast Bayesian Additive Regression Trees on GPU

Giacomo PetrilloNeurIPS 2026

TL;DR

Bayesian Additive Regression Trees (BART) is the statistician’s secret weapon: a tree-ensemble method that rivals XGBoost while giving you built-in uncertainty estimates and requiring almost zero hyperparameter tuning. Until now, it has been painfully slow on anything over 100,000 rows, relegating it to the sidelines of big data. By cleverly contorting dynamic decision trees into rigid, branchless arrays for GPU compilation, this paper achieves a 500x speedup over the previous state of the art—making Bayesian tree ensembles viable on multi-million-row datasets for the first time.

What Problem Does This Paper Address?

If you ask a data scientist to model tabular data, they will probably reach for gradient-boosted trees like XGBoost or LightGBM. Statisticians, however, often prefer BART—essentially a Bayesian cousin of tree boosting. Instead of greedily building one forest of decision trees to minimize loss, BART uses Markov Chain Monte Carlo (MCMC)—an iterative random-walk sampling method—to generate thousands of forests. The spread of predictions across these forests naturally quantifies how uncertain the model is.

There’s a catch: generating ~1,000 forests makes BART roughly 1,000 times slower than XGBoost. Datasets over 10,000–100,000 rows become a slog, which explains why BART is downloaded roughly 1,000 times less often than XGBoost. To bring BART into the modern era, the author needed to get it onto a GPU—a notoriously hostile environment for algorithms with dynamically changing tree shapes.

Methods

Instead of writing custom C++/CUDA kernels from scratch, the author built a pure Python package (bartz) using JAX and its XLA compiler. XLA makes code screaming fast on GPUs, provided every tensor size and sequence of operations is static and branchless (no data-dependent if/else detours).

Standard BART is the exact opposite of static: at every step, trees randomly sprout or lose branches, and subsets of data get routed down different paths. To shoehorn BART into JAX, the author embraces "sweeping de-optimizations" that paradoxically run much faster on parallel hardware:

  • Padded Heap Trees: Trees are capped at a shallow maximum depth (default $D=5$, up to 32 leaves) and padded into fixed-size matrices laid out like binary heaps. Unused nodes are masked out via simple arithmetic.
  • Branchless Traversal & Full Scans: Rather than routing specific subsets of data to specific nodes, every operation scans through all datapoints down to the maximum depth, carrying a boolean flag to ignore steps once a leaf is reached.
  • Simplified Moves & Caching: Standard BART uses four random tree-mutation moves; bartz uses only GROW and PRUNE. Because they are exact inverses, the GPU can compute both moves simultaneously without branching, sharing memory and updating a 1-byte-per-tree cache that tracks which leaf every datapoint lands in.
  • Quantized Predictors: Like LightGBM, continuous features are bucketed into grid indices ($\le 255$ cutpoints), shrinking each feature value to 1 byte so massive datasets fit into GPU RAM.
Figure 2: Heap representation of a decision tree, with the maximum depth set to D = 2.

While proposals and leaf sampling run in parallel across all trees, updating the running residuals remains sequential from tree to tree—meaning the GPU needs a large number of datapoints ($n$) to stay saturated during that bottleneck.

Datasets

  • Synthetic Sparse Quadratic Benchmark: A newly defined data-generating process allowing precise control over sample size ($n$), feature count ($p$), and signal-to-noise ratio, used to map computational scaling and verify statistical accuracy against existing R packages (dbarts, BART, bartMachine), plus simulated full-run tests ($n \approx 4\text{M}, p = 1000$).
  • Five Large OpenML Datasets: Used for the first systematic multi-million-row benchmark of BART ($n$ ranging from ~1M to ~11M, $p$ from 5 to 28): electricity, higgs, radar traffic, zurich delays, and poker.

Key Insights and Ideas

  • Brute force beats clever branching on GPUs: Doing wasted math on padded nodes and scanning every datapoint at every step sounds terrible on paper, but because BART relies on shallow trees ("weak learners"), the branchless uniformity lets the GPU chew through the workload effortlessly.
  • BART parallelizes better than XGBoost: Moving from CPU to GPU speeds up bartz by 100x at large $n$, whereas XGBoost only speeds up by ~20x. Furthermore, because BART amortizes feature-split searches randomly across MCMC steps rather than exhaustively scanning all features at every split, BART shines when the number of features ($p$) is large.
  • Big data exposes a hidden hyperparameter problem: Folk wisdom says untuned BART beats untuned XGBoost. At $n > 1,000,000$, that advantage vanishes unless you scale up the number of trees, because 200 shallow trees simply don't have enough total leaves to capture fine-grained signals in millions of rows.

Key Results

  • 500x Total Speedup: On large datasets ($n \gtrsim 10\text{M}$), bartz on an Apple M1 Pro CPU already beats the fastest existing C++ implementation (dbarts) by 5x. Moving to an Nvidia RTX PRO 5000 GPU yields another 100x jump, for a combined 500x speedup.
  • Closing the Gap with Boosting: Accounting for 2,000 MCMC iterations (at $p=100$ and equal tree counts, excluding preprocessing), a full BART run goes from ~250x slower than a single XGBoost run (with dbarts on CPU) to just ~10x slower on GPU.
  • Real-World Benchmarks: On the 11-million-row higgs dataset, default bartz finishes in 74 seconds vs. XGBoost's 1.6s, achieving virtually identical error (0.417 vs. 0.414 RMSE). On the 1,000-feature simulated dataset ($n \approx 4\text{M}$), bartz is only 4x slower than default XGBoost (43s vs. 11.1s), and with 2,000 trees beats early-stopped XGBoost in accuracy (0.601 vs. 0.621 RMSE).
Iteration timing comparing bartz against dbarts, XGBoost, and CatBoost on CPU and GPU.

Limitations and Future Work

  • No "Early Stopping" Equivalent: Boosting libraries effortlessly find the optimal number of trees on massive datasets via early stopping. BART lacks a fast, scalable way to infer the right number of trees dynamically—making scalable tree-count inference the most urgent next research step.
  • GPU Memory Ceilings: Because random tree mutations require random access to all features, the entire quantized predictor matrix ($n \times p$ bytes) plus the leaf-index cache ($n \times n_{\text{tree}}$ bytes) must live in GPU RAM. Sharding across GPUs only works well along $n$, not $p$, limiting ultra-high-dimensional datasets.
  • Small-$n$ Overhead: Below $n \approx 1,000,000$, the GPU isn't fully saturated during sequential tree updates. Implementing variants like Accelerated BART (XBART) on GPU could unlock better low-$n$ speed and feature-wise sharding.

Summary updated

Abstract

Bayesian Additive Regression Trees (BART) is a nonparametric Bayesian regression technique based on an ensemble of decision trees. It is part of the toolbox of many statisticians. The overall statistical quality of the regression is typically higher than other generic alternatives, and it requires less manual tuning, making it a good default choice. However, it is a niche method compared to natural competitors such as XGBoost, due to the longer running time, making sample sizes above 10000-100000 a nuisance. We present a GPU implementation of BART, up to 500x faster than the previous state of the art, making BART fast enough to be a viable option on large datasets, and showing that BART parallelizes better than its non-Bayesian counterparts. We also find that, to be as practical as tree boosting on large datasets, BART would need a scalable way to infer the number of trees, which we do not provide. Our implementation is available in the Python package bartz.
BibTeX
@inproceedings{petrillo2026very,
  author = {Giacomo Petrillo},
  title = {{Very Fast Bayesian Additive Regression Trees on GPU}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=F9wjjr9v8c},
}
Figure