Machine Unlearning for Random Forests

Jonathan Brophy, Daniel LowdICML 2021

TL;DR

This paper introduces DaRE (Data Removal-Enabled) Forests, a variant of random forests designed for "exact unlearning"—efficiently removing specific training instances so the resulting model is identical to one retrained from scratch. By combining clever data caching with strategically placed random nodes, DaRE achieves speedups of 2 to 4 orders of magnitude over naive retraining while sacrificing less than 1% in predictive accuracy.

What Problem Does This Paper Address?

In the era of the "right to be forgotten" (driven by regulations like GDPR), machine learning models must be able to "unlearn" specific user data upon request. Beyond privacy, unlearning is crucial for removing noisy or corrupted data without wasting massive computational resources.

The standard solution—retraining the model from scratch on the updated dataset—is prohibitively expensive for large-scale applications. While researchers have developed efficient unlearning methods for models with continuous parameters (like logistic regression or neural networks), tree-based models like Random Forests present a unique challenge. Because decision trees have discrete structures, removing even a single data point can theoretically change every split decision from the root down, making "efficient" updates notoriously difficult.

Methods

The authors propose DaRE Forests, which leverage three main techniques to make deletions efficient:

  1. Minimal Subtree Retraining: Instead of retraining the whole tree, DaRE caches statistics (like class counts) at every node and keeps pointers to training instances at the leaves. When a point is deleted, the model updates these statistics and only retrains a subtree if the deletion causes a different split attribute or threshold to become "optimal."
  2. Random Splits (R-DaRE): The most expensive nodes to retrain are those near the top of the tree because they contain the most data. DaRE introduces a hyperparameter ($d_{\text{rmax}}$) to make the top $d$ layers completely random. Since these splits don't depend on data statistics, they almost never need to be updated.
  3. Threshold Sampling: For continuous attributes, instead of checking every possible split point, DaRE samples a small, fixed number ($k$) of "valid" thresholds. This significantly reduces the amount of metadata the model needs to track.

Crucially, DaRE provides exact unlearning. The model you get after a deletion is mathematically identical to the model you would have gotten if you had never seen that data point in the first place.

Datasets

The authors evaluated their approach on 13 real-world binary classification datasets and one synthetic dataset, including:

  • Large-scale: Higgs (11M instances), Twitter (1M), CTR (1M).
  • Medium-scale: Census, Credit Card, Diabetes, Adult.
  • Diverse domains: Medical (Surgical, Vaccine), Finance (Bank Marketing), and Logistics (Flight Delays, No Show).

Key Insights and Ideas

  • The Power of Randomness: One of the core insights is that making the top of the tree random acts as a "shield." By sacrificing a tiny bit of greedy optimization at the root, you gain massive stability because the most computationally expensive parts of the tree become data-independent.
Impact of random depth on deletion efficiency and prediction degradation.
  • Threshold Stability: You don't need to find the perfect split to get a good forest. Sampling just 5–25 thresholds per attribute is often enough to maintain high accuracy while making the bookkeeping for unlearning much lighter.
  • Exact vs. Approximate: Unlike "approximate unlearning" (which uses gradients to nudge a model away from data), DaRE’s structural approach ensures no "ghost" of the deleted data remains, which is a stronger guarantee for privacy-sensitive applications.

Key Results

Deletion efficiency speedups and test error increase across 14 datasets.
  • Massive Speedups: On the Higgs dataset (11 million instances), naive retraining takes about 1.3 hours to process a single deletion. R-DaRE can perform the same deletion in 0.28 seconds—a speedup of over 17,000x.
  • High Fidelity: Across all 14 datasets, the R-DaRE models typically stayed within 1% of the predictive power of a standard, fully greedy Random Forest.
  • Robustness: The authors tested the model against a "Worst-of-1000" adversary (which tries to delete the most disruptive possible data points). Even under this stress test, DaRE remained significantly faster than retraining.

Limitations and Future Work

  • Memory Overhead: The primary trade-off is memory. To enable fast deletions, DaRE must store class statistics and instance pointers. The paper notes that G-DaRE (the greedy version) uses 6x to 26x more memory than a standard Scikit-Learn implementation.
  • Privacy Timing Attacks: While the final model is "clean," the time it takes to perform an update could theoretically leak information about whether a specific point was influential.
  • Extension to Boosting: This work focuses on Random Forests (bagging). A natural next step is applying these "minimal retraining" principles to Gradient Boosted Decision Trees (like XGBoost or LightGBM), which are even more common in production but harder to update due to the sequential nature of the trees.

Summary updated

BibTeX
@inproceedings{brophy2021machine,
  author = {Jonathan Brophy and Daniel Lowd},
  title = {{Machine Unlearning for Random Forests}},
  booktitle = {International Conference on Machine Learning},
  year = {2021},
}
Figure