Learning Constraints for Structured Prediction Using Rectifier Networks

Xingyuan Pan, Maitrey Mehta, Vivek Srikumar

Abstract

Structured prediction tasks often rely on domain-specific constraints to ensure valid outputs. While traditionally hand-crafted, this paper presents a method to automatically discover these constraints using two-layer rectifier (ReLU) networks. By leveraging the mathematical equivalence between ReLU networks and systems of linear inequalities, the authors demonstrate how complex dependencies can be learned from data and integrated into standard inference frameworks like Integer Linear Programming (ILP) or beam search.

Introduction

In tasks such as named entity recognition (NER) or relation extraction, outputs are not independent labels but structured entities like trees or sequences. Improving these models typically involves adding "domain constraints"—for instance, ensuring a "MarriedTo" relation only connects "Person" entities. However, manual engineering of these rules is labor-intensive and requires deep domain expertise. This research explores whether neural networks can automate this discovery process, overcoming the challenge that discrete logic-based constraints are typically non-differentiable.

Methodology: Bridging Deep Learning and Symbolic Logic

The authors propose a novel approach using a specific architectural insight:

  1. Threshold Network Equivalence: A system of linear inequalities defining a valid output space can be represented as a two-layer threshold network. Since threshold functions have zero gradients, they are difficult to train.
  2. The ReLU Solution: The authors utilize a two-layer Rectified Linear Unit (ReLU) network, which is mathematically equivalent to a system of linear inequalities. A network with $K$ hidden units can represent up to $2^K - 1$ constraints.
  3. Learning and Conversion:
    • Training: A small ReLU network is trained as a binary classifier to distinguish between valid structures (from training data) and invalid ones (generated via perturbations).
  4. Inference: The learned weights and biases are converted into linear inequalities.
  5. Integration: These inequalities are injected as hard constraints into an ILP solver or used to prune candidates during beam search.

Evaluation and Results

The method was tested across several NLP tasks, including Entity and Relation Extraction, Citation Field Extraction, and Chunking.

Near-Human Performance

One of the most significant findings is that learned constraints can rival those designed by experts. In the entity and relation extraction task, the automatically discovered constraints achieved performance levels nearly identical to manual rules.

Comparison of F-1 scores between human-designed and automatically learned constraints.

Manual inspection revealed that the model successfully recovered human logic, such as the rule that a "Location" cannot perform a "Kill" action, indicating that the network learns meaningful domain logic rather than just statistical noise.

Performance in Low-Data Regimes

Constraints are most valuable when training data is scarce. When the base model lacks sufficient examples to learn the output space's structure, these learned constraints provide essential guardrails.

Performance gains across varying percentages of training data, highlighting the effectiveness of learned constraints in low-resource settings.

In the chunking task, using only 1% of the training data, the learned constraints improved the baseline search accuracy by 5.23%. As data availability increases, the gap narrows, but the constraints consistently provide a performance floor.

Key Insights

  • Efficiency: The ReLU constraint method adds only about 1,000 parameters, making it a lightweight alternative to large pretrained models like ELMo for boosting accuracy.
  • Model Agnostic: Because constraints are converted into linear inequalities, they can be plugged into various inference techniques (ILP, Lagrangian Relaxation) without retraining the underlying model.
  • Compactness: A small number of hidden units can represent an exponential number of constraints. For example, 10 ReLUs can generate over 1,000 linear inequalities.

Conclusion and Future Work

This work demonstrates that the labor-intensive process of constraint engineering can be largely automated. Future research may focus on more sophisticated adversarial training to generate "invalid" examples and developing methods to translate high-dimensional inequalities back into human-readable "if-then" rules for better interpretability. Integrating the constraint-learning network directly into the global training process of the structured predictor also remains a promising avenue.

Summary updated

BibTeX
@inproceedings{pan2020learning,
  author = {Xingyuan Pan and Maitrey Mehta and Vivek Srikumar},
  title = {{Learning Constraints for Structured Prediction Using Rectifier Networks}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2020},
  doi = {10.18653/v1/2020.acl-main.438},
}
Figure