← Back to Machine Learning
cs.LG

Training neural networks with thousands of hard constraints

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

May 18, 2026

Training neural networks with constraints—for fairness, physics laws, or business rules—lacks a general solution for the messy non-convex setting that real deep learning creates. This work introduces SPBM, which combines penalty and barrier methods with exponential dual averaging and the Moreau envelope to handle constraints and non-smooth objectives simultaneously. Experiments show it matches or beats existing constrained optimization methods while adding just linear overhead, scaling to 10,000+ constraints.
Published as Stochastic Penalty-Barrier Methods for Constrained Machine Learning arXiv:2605.18618
Read the original paper →