Abstract
Adversarial robustness is one of the essential safety criteria for guaranteeing the reliability of machine learning models. While various adversarial robustness testing approaches were introduced in the last decade, we note that most of them are incompatible with non-differentiable models such as tree ensembles. Since tree ensembles are widely used in industry, this reveals a crucial gap between adversarial robustness research and practical applications. This paper proposes a novel whitebox adversarial robustness testing approach for tree ensemble models. Concretely, the proposed approach smooths the tree ensembles through temperature controlled sigmoid functions, which enables gradient descent-based adversarial attacks. By leveraging sampling and the log-derivative trick, the proposed approach can scale up to testing tasks that were previously unmanageable. We compare the approach against both random perturbations and blackbox approaches on multiple public datasets (and corresponding models). Our results show that the proposed method can 1) successfully reveal the adversarial vulnerability of tree ensemble models without causing computational pressure for testing and 2) flexibly balance the search performance and time complexity to meet various testing criteria.
Introduction
While deep learning dominates adversarial robustness literature, tree-based models—such as Random Forests and Gradient Boosted Decision Trees (GBDTs)—remain the industry standard for tabular data in domains like finance and healthcare. However, these models present a unique challenge: they are fundamentally discrete and non-differentiable. Traditional gradient-based attacks cannot be directly applied because decision tree outputs change in discontinuous jumps rather than smooth curves.
Existing whitebox attacks for trees often rely on Mixed Integer Linear Programming (MILP), which fails to scale to large ensembles. Consequently, practitioners frequently resort to slow blackbox attacks that rely on trial-and-error. This paper introduces STA (Smoothed Tree Attack), a scalable framework that enables efficient, gradient-based whitebox attacks on non-differentiable tree ensembles, achieving speeds over 100x faster than state-of-the-art blackbox methods.
Methodology
The STA framework overcomes the non-differentiability of tree ensembles through a combination of smoothing, efficient gradient estimation, and robust optimization techniques.
Tree Smoothing and the Temperature Parameter
The core of the approach involves replacing the hard "if-else" logic of decision nodes with a continuous sigmoid function. This transformation converts the discrete model into a differentiable function. A temperature hyper-parameter ($\tau$) is introduced to manage the approximation:
As shown in the figure above, a high $\tau$ results in a very smooth surface that is easy to optimize but may deviate significantly from the original model's behavior. Conversely, a low $\tau$ provides a more accurate approximation but can lead to vanishing gradients, making optimization difficult. Finding the "Goldilocks zone" for $\tau$ is essential for a successful attack.
Gradient Estimation via the Log-Derivative Trick
Calculating gradients for every possible path in a large forest is computationally prohibitive. To address this, the authors treat the tree ensemble as a stochastic policy, a concept borrowed from Reinforcement Learning. By applying the "log-derivative trick," they can estimate the gradient by sampling representative paths through the trees. This allows the attack to scale to massive ensembles without the need to traverse every leaf node.
Optimization and Noise Injection
Even after smoothing, the decision surface of a tree ensemble remains highly non-convex and prone to saddle points. To prevent the optimizer from becoming trapped in flat regions or local optima, the authors implement noise-injected gradient descent.
This technique injects sparse noise into gradient steps, facilitating the search for better adversarial examples by "climbing over" problematic regions of the loss landscape. Additionally, the framework uses Empirical Cumulative Distribution Functions (ECDF) to normalize perturbations, ensuring that adversarial changes remain realistic and within the specific bounds of tabular features.
Experimental Evaluation
The researchers evaluated STA using three standard datasets from the UCI repository: German Credit, Adult Salary, and Breast Cancer. These were tested against pre-trained Random Forest and XGBoost models, each consisting of 100 trees.
Key Results
- Computational Efficiency: The exhaustive version of STA was 10x faster than the whitebox NES approach and 100x faster than the blackbox GenAttack. The sampling-based variant (STA-Sampling) provided further acceleration, running up to 8x faster than the exhaustive version while maintaining similar success rates.
- Attack Success: On the Breast Cancer dataset, STA reduced Random Forest accuracy from 95.43% to nearly 0% under high perturbation budgets ($\epsilon = 0.8$).
- Scalability: The sampling-based approach proved that full gradient calculation is unnecessary, enabling the testing of models that were previously unmanageable.
Conclusion
STA bridges the gap between adversarial robustness research and the practical application of tree-based models. By smoothing discrete structures and leveraging RL-inspired sampling techniques, it provides a scalable, efficient tool for safety testing. While the requirement for whitebox access limits its use against hidden models, it serves as a powerful diagnostic tool for developers to ensure the reliability of industrial machine learning systems before deployment.
Summary updated