[Paper Review] GPUTreeShap: Massively Parallel Exact Calculation of SHAP Scores for Tree Ensembles
GPUTreeShap proposes a GPU-optimized, massively parallel reformulation of the TreeShap algorithm for exact SHAP value computation in tree ensembles. By restructuring recursive subproblems into bin-packing-scheduled SIMT tasks, it achieves up to 19x speedup for SHAP values and 340x for interaction values over multi-core CPUs, enabling real-time interpretability at scale.
SHAP (SHapley Additive exPlanation) values provide a game theoretic interpretation of the predictions of machine learning models based on Shapley values. While exact calculation of SHAP values is computationally intractable in general, a recursive polynomial-time algorithm called TreeShap is available for decision tree models. However, despite its polynomial time complexity, TreeShap can become a significant bottleneck in practical machine learning pipelines when applied to large decision tree ensembles. Unfortunately, the complicated TreeShap algorithm is difficult to map to hardware accelerators such as GPUs. In this work, we present GPUTreeShap, a reformulated TreeShap algorithm suitable for massively parallel computation on graphics processing units. Our approach first preprocesses each decision tree to isolate variable sized sub-problems from the original recursive algorithm, then solves a bin packing problem, and finally maps sub-problems to single-instruction, multiple-thread (SIMT) tasks for parallel execution with specialised hardware instructions. With a single NVIDIA Tesla V100-32 GPU, we achieve speedups of up to 19x for SHAP values, and speedups of up to 340x for SHAP interaction values, over a state-of-the-art multi-core CPU implementation executed on two 20-core Xeon E5-2698 v4 2.2 GHz CPUs. We also experiment with multi-GPU computing using eight V100 GPUs, demonstrating throughput of 1.2M rows per second -- equivalent CPU-based performance is estimated to require 6850 CPU cores.
Motivation & Objective
- Address the computational bottleneck of SHAP value computation in large tree ensemble models, which can exceed training time.
- Overcome the challenge of mapping the complex TreeShap algorithm to GPU architectures due to irregular recursion and data dependencies.
- Enable high-throughput, low-latency SHAP computation for real-world ML pipelines by exploiting GPU-wide parallelism.
- Reduce the time cost of SHAP interaction value computation, which scales quadratically with feature count and is especially expensive for high-dimensional data.
- Provide a production-ready, open-source GPU backend for XGBoost that scales efficiently across multiple GPUs.
Proposed method
- Reformulate the recursive TreeShap algorithm into independent, variable-sized subproblems per tree path to enable data-parallel execution.
- Apply bin packing heuristics to group subproblems into warps for efficient GPU thread block scheduling and maximize occupancy.
- Map each subproblem to a single-instruction-multiple-thread (SIMT) task using CUDA kernels with warp-level primitives for dynamic programming.
- Leverage cover weighting from training data to estimate conditional expectations for missing features during path evaluation.
- Optimize algorithmic complexity for SHAP interaction values by omitting irrelevant feature pairs, reducing time from O(TLD²M) to O(TLD³).
- Integrate GPUTreeShap as a backend in XGBoost, enabling seamless GPU-accelerated SHAP inference without model retraining.
Experimental results
Research questions
- RQ1Can the recursive TreeShap algorithm be reformulated to enable efficient, scalable execution on massively parallel GPU architectures?
- RQ2To what extent can GPU-level parallelism and warp scheduling improve throughput for SHAP value computation in large tree ensembles?
- RQ3How does the performance of GPUTreeShap scale with increasing model size, dataset size, and number of GPUs?
- RQ4What performance gains are achievable for SHAP interaction values, which are significantly more expensive than standard SHAP values?
- RQ5Can the algorithmic complexity of SHAP interaction computation be reduced through preprocessing and feature pruning without sacrificing accuracy?
Key findings
- With a single NVIDIA Tesla V100-32 GPU, GPUTreeShap achieves up to 19x speedup for standard SHAP values and up to 340x for SHAP interaction values over a 40-core CPU setup.
- Throughput scales linearly with the number of GPUs; eight V100 GPUs achieve 1.2 million rows per second, equivalent to approximately 6,850 CPU cores.
- For high-dimensional datasets like fashion_mnist-large, SHAP interaction value computation is reduced from ~6 hours to ~1 minute using a single GPU.
- The algorithmic complexity for SHAP interaction values is reduced from O(TLD²M) to O(TLD³) through feature subset pruning, significantly improving performance on large feature sets.
- GPUTreeShap demonstrates superior throughput at large batch sizes, outperforming CPUs beyond 180 test rows due to higher parallelism and lower latency per row.
- The implementation is production-ready and integrated into XGBoost, enabling end-to-end GPU-accelerated explainability for gradient-boosted tree models.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.