🤖 AI Summary
Existing neural networks struggle to strictly satisfy input-dependent arbitrary affine hard constraints, and soft-constraint or post-processing approaches cannot guarantee constraint satisfaction at all times. This work proposes a trainable Constrained Affine (CAffine) layer, which can be seamlessly integrated into both feedforward networks and Transformer architectures. By enabling end-to-end joint optimization, the CAffine layer ensures that affine constraints of any dimensionality are rigorously satisfied for all inputs. The method requires no predefined projection form, supports differentiable optimization, and retains universal approximation capability while providing theoretical guarantees on constraint adherence. Empirical results demonstrate that the approach is effective, broadly applicable, and reliably enforces constraints across multiple tasks where strict compliance is essential.
📝 Abstract
We present a novel framework for embedding hard constraint satisfaction into neural network (NN) architectures, specifically feedforward neural networks and transformers, with input-dependent affine constraints of arbitrary cardinality. Traditional constraint enforcement approaches either rely on penalty-based soft constraints, which offer no guarantee of satisfaction, or on post-processing methods that enforce constraints after the NN is trained, which may lead to suboptimality. We introduce a trainable constraint-affine (CAffine) layer into NNs, yielding CAffNet, which goes beyond enforcing affine constraints via fixed orthogonal or parallel projections and enables joint optimization with network parameters. Moreover, we impose no restrictions on the constraint space dimensions and establish that our construction preserves the universal approximation properties of NNs, while providing provable guarantees on constraint adherence for all inputs. Experimental validation demonstrates robust performance across diverse domains requiring guaranteed constraint satisfaction.