Stochastic Penalty-Barrier Methods for Constrained Machine Learning

Adam Bosák, Andrii Kliachkin, Jana Lepšová, Gilles Bareilles, Jakub MarečekarXiv 2026

TL;DR

The paper introduces the Stochastic Penalty-Barrier Method (SPBM), a novel optimization framework designed to handle general non-convex, non-smooth, and stochastic constraints in deep learning. By combining classical penalty-barrier methods with proximal tools like the Moreau envelope and exponential moving averages, SPBM successfully enforces complex constraints (such as fairness metrics or physical laws) with only linear runtime overhead compared to standard unconstrained Adam.

What Problem Does This Paper Address?

Enforcing constraints in deep learning is essential for applications like fairness-aware classification (e.g., ensuring equal accuracy across demographic groups) and Physics-Informed Neural Networks (PINNs), where models must obey differential equations.

However, deep learning models inherently introduce a trifecta of optimization challenges: objectives and constraints are typically non-convex, non-smooth, and stochastic (due to mini-batching).

Historically, practitioners rely on standard regularization (adding a weighted penalty term to the loss). But as shown in Figure 1, this is a delicate balancing act: if the penalty weight ($\rho$) is too large, optimization becomes unstable; if it is too small, the model violates the constraints. Existing constrained optimization alternatives are usually limited to simpler settings, such as deterministic or strictly convex constraints, leaving a gap for a general deep learning-compatible method.

Figure 1: Motivation for using SPBM over standard regularization with the penalized objective Fρ(x) = f(x) + ρ∥E[g(x, ξ)]∥2, with f = ||x||2 and a certain choice of g. For large ρ, SGD applied to Fρ(x) could be unstable, whereas for too small ρ, the solution produced by SGD applied to Fρ(x) could be infeasible. In contrast, SPBM is stable and converges to the feasible set; see Appendix A.

Methods

SPBM builds upon the classical deterministic Penalty/Barrier Multiplier Method (PBM) and adapts it to deep learning through three key innovations:

  1. Handling Non-Smoothness via the Moreau Envelope: The penalty-barrier formulation introduces non-smoothness. To resolve this, the authors leverage the Moreau envelope—a proximal smoothing technique. In practice, instead of solving an expensive inner optimization loop, they approximate it by taking a single step of the Adam optimizer (OneStepAdam) followed by an exponential moving average update of the proximal center.
  2. Noise Reduction via Exponential Moving Averages (EMA): Because constraints are evaluated on mini-batches, stochastic noise can destabilize dual variable updates. SPBM applies an EMA to the dual variables to smooth out mini-batch variance.
  3. Stabilized/Adaptive Penalty Schedule: In classical PBM, penalty parameters aggressively drive toward zero, which causes numerical instability in stochastic settings. SPBM introduces an adaptive updating function ($\hat{\pi}_{\text{adaptive}}$) that scales penalties dynamically based on whether a specific constraint is currently satisfied or violated.

Datasets

The authors evaluated SPBM across three distinct problem domains using six classification tasks and two physics simulations:

  • Fairness Datasets: ACSIncome (predicting if an individual's income exceeds \$50,000) and the Dutch Census dataset (predicting profession levels).
  • Image Classification: CIFAR-10 and CIFAR-100 used for evaluating fair/robust classification across multiple image categories.
  • Physics-Informed Neural Networks (PINNs): Synthetic datasets generated to solve the non-linear Helmholtz and viscous Burgers partial differential equations.

Key Insights and Ideas

  • Bypassing the Inner Loop: The most elegant aspect of SPBM is its practical implementation of the Moreau envelope. While proximal methods theoretically require finding an exact minimizer for the envelope, SPBM demonstrates that a single step of Adam is sufficient to maintain stability and converge to a feasible region.
  • The Power of Coordinate-Wise Adaptation: Rather than applying a blanket penalty across all constraints, SPBM adjusts parameters per-constraint. If a specific constraint is satisfied, its penalty relaxes; if violated, it tightens. This prevents the optimization from breaking down when dealing with thousands of simultaneous constraints.

Key Results

SPBM was benchmarked against unconstrained Adam, Stochastic Switching Subgradient (SSw), and Stochastic Smoothed Primal-Dual Augmented Lagrangian (SSL-ALM).

  • High-Constraint Scalability: In the CIFAR-100 experiment with 9,900 pairwise constraints, SPBM significantly outperformed SSL-ALM by minimizing train and test loss while effectively satisfying the constraint thresholds (see Figure 3).
  • Linear Runtime Overhead: Despite managing up to 10,000 constraints, SPBM scales linearly. On CIFAR-100, it incurred only a ~3x runtime overhead compared to completely unconstrained Adam (5.86s vs 1.92s per epoch).
  • Superior PINN Performance: For physical simulations (Helmholtz and Burgers equations), SPBM consistently found higher-quality solutions (lower Test MSE) and achieved better boundary condition satisfaction than both Adam with regularization and SSL-ALM.
Figure 3: (E6): CIFAR-100, Equal Accuracy, Pairwise, m = 9900: mean loss (top row: train and test) and mean largest constraint (bottom row: train and test) values over 3 runs of 30 epochs of each method with random parameter initialization. The shaded region corresponds to ±1 standard deviations. The red dotted line corresponds to the constraint threshold.

Limitations and Future Work

Despite its strong empirical performance, the paper notes a few limitations:

  • Lack of Theoretical Guarantees: Providing formal convergence proofs for fully stochastic, non-convex, and non-smooth settings remains an open theoretical challenge.
  • Hyperparameter Tuning: The introduction of the adaptive penalty schedule adds new hyperparameters (such as the proximal multiplier $\mu$ and the adaptive threshold $K$) that require careful grid searching depending on the dataset.

Future work will likely focus on establishing convergence bounds and automating hyperparameter selection for the penalty schedules.

Summary updated

BibTeX
@misc{bosak2026stochastic,
  author = {Adam Bosák and Andrii Kliachkin and Jana Lepšová and Gilles Bareilles and Jakub Mareček},
  title = {{Stochastic Penalty-Barrier Methods for Constrained Machine Learning}},
  year = {2026},
  eprint = {2605.18618},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2605.18618},
}
Figure