Constrained Machine Learning: The Bagel Framework

Guillaume Perez, Sebastian Ament, Carla P. Gomes, Arnaud LallouetarXiv 2021

Introduction

In real-world machine learning applications, models often operate under strict combinatorial constraints. For example, a hardware budget might limit the number of active sensors, or regulatory requirements might dictate that only specific combinations of features are permissible. While standard machine learning excels at optimizing continuous functions, these discrete, non-convex constraints (such as the $l_0$ norm) present a significant challenge.

Traditional approaches often rely on relaxations, such as using the $l_1$ norm (Lasso) as a proxy for sparsity. However, these proxies do not guarantee that the final model will strictly adhere to the original hard constraints. The BaGeL (Branch, Generate and Learn) framework addresses this by merging combinatorial optimization with machine learning, ensuring that models satisfy hard constraints while maintaining high performance.

The BaGeL Framework

BaGeL adapts the classic Branch and Bound (B&B) algorithm for machine learning. Instead of simply assigning values to discrete variables, each node in the BaGeL search tree generates and trains a specific machine learning model within a restricted hypothesis space.

The framework operates through four primary mechanisms:

  1. Branching: The algorithm recursively partitions the hypothesis space into smaller, more constrained sub-spaces.
  2. Training as Evaluation: The "evaluation function" for each search node is the training of an ML model. This allows the search to navigate discrete structures while the optimizer handles continuous weights.
  3. Pruning: If the best possible loss in a specific branch is already higher than the best valid model found so far, the entire branch is discarded. This "monotonic restrictiveness" ensures that as the search goes deeper, the lower bound on loss increases, enabling efficient pruning.
  4. Extended Table Constraints (ET): BaGeL introduces ET constraints, which generalize traditional logic table constraints by allowing a distance threshold. This enables the definition of valid sub-spaces for continuous features based on discrete sets of prior knowledge.
The BaGeL search tree illustrates how the hypothesis space is branched and pruned based on model loss and constraints.

Experimental Evaluation

The framework was evaluated on two synthetic benchmarks designed to test its ability to handle complex constraints:

  • Smart Design Instances: A linear regression task where models must select a subset of features (sensors) within a fixed cost budget.
  • Prior-Knowledge NMF: A Non-negative Matrix Factorization task for topic modeling. In this scenario, the topics are constrained to be subsets of a pre-existing database of known topics, even when the input data is noisy.
The Prior-Knowledge NMF task constrains document topics to a predefined database, ensuring the model uses valid structural templates.

Key Results

  • Accuracy and Constraint Satisfaction: In Smart Design tests, BaGeL consistently outperformed "Repair" heuristics, which often fail to find the optimal model within tight budget constraints.
  • Robustness: In NMF experiments, BaGeL successfully extracted "true" topics from corrupted data, whereas standard NMF methods drifted toward invalid solutions.
  • Computational Practicality: While tree search is inherently exponential, BaGeL remained practical for problems with up to 350 features, demonstrating that pruning and efficient search can make hard-constrained ML feasible.

Conclusion and Future Work

BaGeL demonstrates that treating model structure as a combinatorial problem and parameters as an optimization problem is a powerful approach for constrained ML. By enforcing hard constraints rather than relying on soft biases, it provides a robust solution for safety-critical and budget-constrained applications.

Future research will focus on improving scalability for high-dimensional problems, such as deep neural networks. Potential strategies include "warm-starting" model training from parent nodes to reduce computational overhead and integrating more advanced search heuristics into the framework.

Summary updated

BibTeX
@misc{perez2021constrained,
  author = {Guillaume Perez and Sebastian Ament and Carla P. Gomes and Arnaud Lallouet},
  title = {{Constrained Machine Learning: The Bagel Framework}},
  year = {2021},
  eprint = {2112.01088},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2112.01088},
}
Figure