NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Learning Binary Trees via Sparse Relaxation

Valentina Zantedeschi, Matt J. Kusner, Vlad Niculae

Abstract

We address the problem of learning binary decision trees that partition data for some downstream task. We propose to learn discrete parameters (i.e., for tree traversals and node pruning) and continuous parameters (i.e., for tree split functions and prediction functions) simultaneously using argmin differentiation. We do so by sparsely relaxing a mixed-integer program for the discrete parameters, to allow gradients to pass through the program to continuous parameters. We derive customized algorithms to efficiently compute the forward and backward passes. This means that our tree learning procedure can be used as an (implicit) layer in arbitrary deep networks, and can be optimized with arbitrary loss functions. We demonstrate that our approach produces binary trees that are competitive with existing single tree and ensemble approaches, in both supervised and unsupervised settings. Further, apart from greedy approaches (which do not have competitive accuracies), our method is faster to train than all other tree-learning baselines we compare with. The code for reproducing the results is available at https://github.com/vzantedeschi/LatentTrees.

Introduction

Decision trees are a staple of machine learning due to their interpretability and efficiency. However, training them has traditionally fallen into two suboptimal camps. Greedy induction methods, such as CART, build trees one split at a time; while fast, they are often "short-sighted" and fail to find globally optimal structures. Conversely, global optimization methods using Mixed-Integer Programming (MIP) attempt to find perfect structures but are computationally heavy, failing to scale beyond small datasets.

Recent "soft" or probabilistic trees attempt to bridge this gap by making branching decisions continuous. However, they often lose the very thing that makes trees useful: sparsity. In a soft tree, every input technically passes through every branch, destroying interpretability and inference efficiency. This paper introduces a "middle way"—a method that is globally trainable via gradients like neural networks but maintains the sparse, "hard" decision paths of traditional trees through a novel sparse relaxation.

Methodology

The Differentiable Tree Layer

The core of this approach is framing tree learning as a bi-level optimization problem using argmin differentiation. The authors represent tree traversal and pruning as an Integer Linear Program (ILP). To make this trainable via backpropagation, they apply a sparse relaxation, turning the ILP into a strongly convex quadratic program (QP). This relaxation allows gradients to flow through the "decision" logic to the split parameters ($\theta$).

Overview of the differentiable tree layer architecture, showing the flow of data and gradients through the relaxed quadratic program.

Unlike sigmoid-based soft trees, this quadratic relaxation naturally pushes many traversal values to exactly 0 or 1. This preserves the "hard" routing of data through the tree, maintaining the model's inherent sparsity and interpretability.

Efficient Optimization and Pruning

Solving a generic QP inside a neural network is typically slow. The authors identified that the tree-structured constraints of their program are equivalent to tree-structured isotonic regression. By adapting the Pool Adjacent Violators (PAV) algorithm, they developed a custom solver that handles the forward pass in $O(n|T| \log(n|T|))$ time, making the approach viable for modern, large-scale datasets.

Additionally, the model includes a pruning mechanism controlled by a hyperparameter $\lambda$ that penalizes active nodes. This allows the network to "learn" which parts of the tree are unnecessary and prune them automatically during training, smoothly trading off between a complex, deep tree and a simple, shallow one.

Evolution of the tree structure through the pruning mechanism, showing how nodes are deactivated to optimize the trade-off between complexity and performance.

Experiments and Results

The method was evaluated across several tasks, including regression (Year, Microsoft, Yahoo), binary classification (Click, Higgs, Mushrooms), and unsupervised hierarchical clustering (Glass, Covtype).

  • Competitive Accuracy: On tabular data, the method consistently outperformed single-tree baselines like CART and was competitive with state-of-the-art ensembles like XGBoost and NODE.
  • Massive Speedups: Compared to other differentiable tree methods (like ANT or NDF), this approach was significantly faster. For example, on the Higgs dataset, it was nearly 3x faster than its closest differentiable competitor while achieving better error rates.
  • Scalability: Unlike optimal tree methods (MIP) that struggle with large data, this method scaled to datasets with millions of samples by leveraging mini-batch stochastic gradient descent.

Conclusion

By treating the tree traversal and pruning logic as a differentiable optimization layer, this research provides a scalable framework for learning globally optimized binary trees. While greedy induction remains faster, this sparse relaxation approach offers a superior balance of accuracy, interpretability, and training speed compared to existing global or soft tree alternatives. Future directions include extending this logic to instance-specific trees and learning efficient nearest-neighbor search structures like ball trees.

Summary updated

BibTeX
@inproceedings{zantedeschi2021learning,
  author = {Valentina Zantedeschi and Matt J. Kusner and Vlad Niculae},
  title = {{Learning Binary Trees via Sparse Relaxation}},
  booktitle = {International Conference on Machine Learning},
  year = {2021},
  url = {https://openreview.net/forum?id=aiCz2EP2KJa},
}
Figure