Deep learning models are notorious for "shortcut learning"—picking up on spurious correlations (like a background color) rather than robust features (like the actual object shape). While many Out-of-Distribution (OoD) algorithms exist to penalize these shortcuts, they face a severe optimization-generalization dilemma.
If the penalty for non-invariant features is too strong, the optimization becomes too difficult for the model to converge. If it’s too weak, the model simply ignores the constraint and learns the shortcut anyway. To bypass this, researchers often "warm-start" their models with standard Empirical Risk Minimization (ERM). However, this introduces extreme sensitivity; too much or too little pre-training can lead to massive drops in performance.
The authors argue that the problem isn't just the objective function, but the starting point of the optimization. To address this, they introduce the Rich Feature Construction (RFC) algorithm, nicknamed Bonsai.
The Bonsai Algorithm: Building a Feature Palette
Bonsai addresses the struggle of OoD generalization by first building a "palette" of diverse, potentially useful features before applying invariance constraints. It operates in two main phases:
- Discovery Episodes: Instead of training one model on all data, the algorithm iteratively identifies subsets of data where the current model performs poorly. It uses a form of Distributionally Robust Optimization (DRO) to force the network to find new features that explain these difficult examples, effectively building a library of diverse features.
- Synthesis Episodes: Once a collection of models (each specializing in different features) is created, the algorithm uses knowledge distillation. It trains a single "rich" feature extractor to simultaneously represent all the features discovered in the previous phase.
The resulting "Bonsai representation" can then be used to initialize any OoD algorithm. By initializing networks with this rich representation, researchers can bypass the treacherous optimization landscapes that usually cause OoD methods to fail. The authors also highlight Bonsai-cf, where the rich representation is frozen, and the OoD algorithm only trains a simple linear classifier on top.
Key Insights and Results
The core philosophy behind Bonsai is that it is much easier for an algorithm to select the right feature from a rich set than to construct it under heavy penalty constraints. The authors show that even when a model is initialized with the "perfect" solution, standard OoD penalties are often too weak to keep it there; the training process actually pulls the model away from the correct solution toward spurious shortcuts.
Bonsai significantly reduces result variance and makes validation accuracy a much more reliable indicator of test performance. While standard OoD methods show chaotic sensitivity to penalty weights and training epochs, Bonsai-initialized models show smooth, predictable performance curves.
The paper evaluates the method on several benchmarks, yielding impressive results:
- ColoredMNIST: Bonsai-initialized methods consistently achieved ~70% accuracy, approaching the "oracle" performance of 72.1% (the limit when color is removed entirely).
- Camelyon17 (WILDS benchmark): On this real-world dataset of histopathology images, Bonsai-cf achieved 78.6% accuracy, outperforming standard ERM (~70%) and exceeding previously reported top results on the leaderboard by roughly 5%.
Limitations and Future Work
While highly effective, Bonsai does have limitations. Because it requires multiple training "episodes" (discovery and distillation) before the final OoD training begins, it is more computationally expensive than a single ERM run.
Additionally, adding too many discovery rounds can eventually introduce weaker or noisier features, which might slightly degrade performance or increase the difficulty of the synthesis phase. Finally, the current synthesis phase uses linear classifiers for distillation to keep the architecture simple; exploring non-linear classifiers could further improve the richness of the representation in future work.
Summary updated