On Regularization and Inference with Label Constraints

Kaifu Wang, Hangfeng He, Tin D. Nguyen, Piyush Kumar, Dan Roth

Abstract

In many machine learning applications, domain knowledge is expressed as constraints on the labels. Practitioners typically incorporate these constraints through two distinct strategies: regularization during training or constrained inference at test time. This paper provides the first rigorous theoretical comparison between these paradigms. By analyzing Rademacher complexity and optimal risk, the authors characterize a fundamental tension: while regularization improves generalization by simplifying the model space, it introduces inherent bias. Conversely, constrained inference acts as an error-correction mechanism that reduces risk only when the model's inconsistency exceeds that of the underlying data distribution. Finally, the paper demonstrates that "on-training"—training a model specifically to perform well after inference—is theoretically superior to post-hoc application of constraints.

Introduction

In real-world machine learning tasks, we often possess prior knowledge or symbolic rules that the output labels must satisfy. For instance, in temporal reasoning, transitivity must hold: if event A precedes B, and B precedes C, then A must precede C. Traditionally, these rules are handled in one of two ways. The first is Regularization, where a penalty is added to the loss function during training to discourage rule violations. The second is Constrained Inference, where a standard model is trained, but its outputs are "nudged" or forced to satisfy constraints at test time, often using frameworks like Constrained Conditional Models (CCMs).

While both methods are used empirically, their theoretical trade-offs have remained poorly understood. This paper addresses critical questions regarding the bias introduced by regularization and the conditions under which constrained inference actually improves model accuracy, particularly when the constraints themselves may be noisy.

Methodology

The authors analyze these strategies using the tools of statistical learning theory, specifically focusing on Rademacher complexity (a measure of model capacity) and optimal risk (the minimum achievable error).

Regularization Analysis

The paper defines an Empirical Risk and Violation Minimizer (ERVM). This objective function balances standard classification loss with a violation penalty weighted by a parameter $\rho$. The authors derive new error bounds to quantify how this penalty affects the gap between training and test performance, showing that constraints effectively shrink the search space to a subset of "well-behaved" models.

Inference Analysis

The analysis of constrained inference focuses on Constrained Conditional Models (CCMs). These models modify the softmax output by subtracting a penalty for constraint violations. The authors derive necessary and sufficient conditions for when this post-processing step improves accuracy, treating the inference step as a form of "correction fluid" for model errors.

Hybrid Approach

Finally, the paper explores On-training Constrained Inference. In this setup, the model is trained with the explicit knowledge that it will be subjected to inference constraints at test time. This allows the model to optimize its parameters specifically for the post-inference output.

Key Insights and Theoretical Results

The Generalization-Bias Trade-off

Regularization acts as a double-edged sword. By narrowing the model's search space, it significantly tightens Rademacher complexity bounds. In a linear regression setup, the authors prove that label constraints result in a bound strictly tighter than the standard $O(\sqrt{c/m})$ bound. However, this comes at the cost of bias: the model may favor a "legal" but incorrect prediction over a true prediction that appears to violate the constraints during the noisy training process.

Inference as Error Correction

A central finding is the "Violation Paradox." Regularization views violations as errors to be eliminated during training. In contrast, for constrained inference, a violation represents "potential"—it is an error that the inference step knows how to fix. The authors prove that constrained inference reduces risk if and only if the model violates the constraints more frequently than the true data distribution does.

Handling Noisy Constraints

If the ground truth occasionally violates the provided rules (noisy constraints), strictly enforcing those rules can be detrimental. The authors derive a specific threshold using the Lambert W function for the trade-off parameter $\mu$. If the inference "nudge" exceeds this threshold, the total error of the system is likely to increase rather than decrease.

The Superiority of On-Training

The paper argues that "On-training" is theoretically superior to "Post-training" (applying constraints only at the end). On-training allows the model to focus its limited capacity on the nuances that the inference step cannot fix. While computationally more expensive—often reaching #P-complexity—it provides the most robust theoretical guarantees for performance.

Limitations and Future Work

While providing a foundational framework, the study focuses primarily on multiclass classification with deterministic label constraints. Extending these proofs to structured prediction tasks, such as full sentence parsing or graph labeling, remains an open challenge. Additionally, the authors assume a deterministic oracle for the ground truth; future research could explore fully stochastic settings where the underlying truth is probabilistic. Finally, given the computational cost of on-training, investigating how approximate inference during training impacts these theoretical guarantees is a vital next step.

Summary updated

BibTeX
@inproceedings{wang2023regularization,
  author = {Kaifu Wang and Hangfeng He and Tin D. Nguyen and Piyush Kumar and Dan Roth},
  title = {{On Regularization and Inference with Label Constraints}},
  booktitle = {International Conference on Machine Learning},
  year = {2023},
  url = {https://openreview.net/forum?id=PsQJm6lG3s},
}
Figure