Source-linked AI summary
A Logic-Driven Framework for Consistency of Neural Models
Tao Li, Vivek Gupta, Maitrey Mehta, Vivek Srikumar
TL;DR
Neural models can be accurate on individual predictions yet inconsistent across examples, and standard prediction error does not capture that broader issue. The paper formalizes inconsistency through logic rules and trains models with losses derived from those rules. In NLI, the approach reduces inconsistency while preserving predictive accuracy, though its consistency losses require some label supervision in the reported setting.
Problem
Individual prediction accuracy does not capture whether a model's beliefs remain consistent across related inputs.
Source: §1 · p. 1Method
The framework measures violations of first-order-logic invariants and compiles them into differentiable losses, using labeled and unlabeled examples.
Source: §1 · pp. 1–2Results
On NLI, the approach significantly reduces inconsistency, and the framework can do so with a small amount of annotated data without sacrificing predictive accuracy.
Source: §1 · p. 2Takeaways & Limitations
The framework is presented as extensible to domains with rich output structure, including entity relation extraction and multilabel classification.
Source: §7 · p. 9With no label supervision, symmetry and transitivity losses can push predictions toward Neutral, so the authors conclude some label supervision is necessary.
Source: §4.4 · p. 7
Abstract
from arXiv · showhide
While neural models show remarkable accuracy on individual predictions, their internal beliefs can be inconsistent across examples. In this paper, we formalize such inconsistency as a generalization of prediction error. We propose a learning framework for constraining models using logic rules to regularize them away from inconsistency. Our framework can leverage both labeled and unlabeled examples and is directly compatible with off-the-shelf learning schemes without model redesign. We instantiate our framework on natural language inference, where experiments show that enforcing invariants stated in logic can help make the predictions of neural models both accurate and consistent.
1 Introduction
Leaderboard accuracy is necessary but insufficient: models should also keep their beliefs consistent across examples. The paper formalizes inconsistency and uses logic-derived losses to reduce it in NLI, including with limited labeled data.
1 Introduction
- Reasoning about language requires consistent beliefs across inputs as well as correct individual inferences, so leaderboard performance alone is insufficient.The paper argues that models are not trained or evaluated for consistency in this fashion.Source: §1 · p. 1
- About 46% of unlabeled triples with P entailing H and H contradicting Z violate the expected P-contradicts-Z relation, despite about 90% SNLI test F-score.The expected relation is an invariant over the three predictions, not an independent label for a single example.Source: §1 · p. 1
- The paper measures inconsistency against first-order-logic invariants over predictions, generalizing the standard definition of model error.Its framework compiles those invariants into differentiable losses using t-norms to soften logic.Source: §1 · p. 1
- The framework can use unlabeled examples to enforce consistency, and cross-entropy emerges as one specific instance of its losses.It is designed to work with modern neural architectures without redesign.Source: §1 · p. 2
- Even state-of-the-art NLI models can be highly inconsistent, while the proposed approach significantly reduces inconsistency.The paper also reports reducing prediction inconsistencies with a small amount of annotated data without sacrificing predictive accuracy.Source: §1 · p. 2
2 A Framework for (In)consistency
The framework represents labeled examples and logical constraints uniformly, evaluates violations as generalized errors, and turns softened logic rules into differentiable training losses.
2.1 Representing Knowledge
- Constraints are conjunctions of logical statements over example collections; labeled examples can be encoded as implications requiring the model to predict the annotated label.The same representation can express labeled data, unlabeled groups linked by constraints, or their combination.Source: §2.1 · p. 2
2.2 Generalizing Errors as Inconsistencies
- Global violation counts examples where any constraint fails, while conditional violation considers only examples where the antecedent holds.The two metrics are complementary: global violation reflects domain-knowledge impact, while conditional violation can prevent lowering the metric merely by avoiding antecedents.Source: §2.2 · pp. 2–3
- Both violation metrics strictly generalize classification error and equal model error when the available knowledge consists only of labeled examples.The framework treats prediction errors as concordance with declarative knowledge.Source: §2.2 · pp. 2–3
2.3 Learning by Minimizing Inconsistencies
- T-norms soften Boolean operations so logical rules can be compiled into differentiable losses optimized with standard methods.The product t-norm is used here to compare with prior work and strictly generalizes cross-entropy; choosing a t-norm is both a design and algorithmic choice.Source: §2.3 · p. 3
- Different t-norms have different numerical characteristics, and comparing them is left for future research.The paper notes that Łukasiewicz can yield zero gradients for large disjunctions, rendering learning difficult.Source: §2.3 · p. 3
3 Case Study: NLI
The NLI case study expresses annotation, symmetry, and transitivity requirements as logical constraints, then converts them into losses for training with labeled and unlabeled data.
3.1 Learning Objectives in Logic
- The case study defines annotation consistency as predicting the ground-truth label, symmetry consistency as contradiction holding in both pair orders, and transitivity consistency as restricting valid labels across three related pairs.For annotation consistency, minimizing violation is equivalent to maximizing accuracy.Source: §3.1 · p. 3
3.2 Inconsistency Losses
- With the product t-norm, the annotation loss becomes the familiar cross-entropy loss, while symmetry and transitivity constraints also receive derived losses.The paper focuses on annotation and symmetry derivations in the main text and refers to the appendix for the transitivity derivation.Source: §3.2 · p. 4
- The framework converts logical constraints into losses that can be added to the learning objective and optimized with off-the-shelf optimizers.Annotation consistency uses labeled examples, while symmetry and transitivity consistency can use unlabeled examples.Source: §3.2 · p. 4, §3.3 · p. 4
3.3 Training Constrained Models
- Because informative unlabeled data is difficult to obtain, the study proposes randomly sampling sentences from the same topic and evaluates symmetry inconsistency on 100k pairs, averaging three runs per point.The figure caption identifies M, U, and T as unlabeled datasets with corresponding losses.Source: §3.3 · pp. 4–5, Figure 1 · p. 5
4 Experiments
The experiments test whether logic-derived consistency losses reduce NLI prediction violations across labeled and unlabeled settings. The losses reduce inconsistencies, including when label supervision is limited, and generally do not reduce test accuracy.
4 Experiments
- The experiments use BERTbase and an LSTM, train constrained models on labeled and unlabeled examples, and select loss hyperparameters using development accuracy.They evaluate on SNLI and MultiNLI, including combined and individual training results and different amounts of label supervision.Source: §4 · p. 5, §4.1 · p. 5
4.1 Datasets
- Mirrored labeled pairs provide M for symmetry loss; U contains mirrored unlabeled pairs, and T contains unlabeled triples sampled from MS COCO captions for transitivity loss.The evaluation uses separate 100k example triples for transitivity and mirrored pairs for symmetry.Source: §4.1 · pp. 5–6
4.2 Inconsistency of Neural Models
- BERT and LSTM models show symmetry violations, while transitivity violations are lower; BERT has about a 60% chance of an inconsistent mirrored judgment after predicting Contradiction.More annotation reduces symmetry violations, but the same pattern does not apply to transitivity; SNLI- and MultiNLI-trained models are similarly inconsistent.Source: §4.2 · p. 6
4.3 Reducing Inconsistencies
- With M, U, and T losses, symmetry and transitivity violations fall substantially; even 1%-label constrained models can be more consistent than 100%-label baselines.The reported transitivity reductions are qualitative here; exact numbers are deferred to the appendix.Source: §4.3 · p. 6
4.4 Interaction of Losses
- Lower symmetry and transitivity inconsistency generally does not reduce test accuracy, although the experiments show no substantial accuracy improvement either.The authors infer that test sets do not explicitly measure these two forms of consistency.Source: §4.4 · p. 7, §4.3 · p. 7
- Models trained with both consistency losses are generally more consistent than symmetry-only models, and symmetry loss alone can also mitigate transitivity errors.With dataset P, symmetry loss strongly reduces transitivity inconsistency.Source: §4.4 · p. 7
- Mirrored-data training can show rising transitivity inconsistency as training data grows, while limited-label training can overfit to transitivity loss and zero-label training can push predictions to Neutral.The authors attribute the first pattern partly to vocabulary gaps and to training on symmetry but evaluating transitivity; they conclude some label supervision is necessary.Source: §4.4 · p. 7
5 Analysis
The analysis examines which unlabeled examples activate the losses and how consistency constraints affect prediction distributions. Coverage differs across constraints, and the constrained models reduce violations while increasing Neutral predictions.
5.1 Coverage of Unlabeled Dataset
- Coverage counts unlabeled examples with positive symmetry or transitivity loss; M and U have high first-epoch coverage, while T has lower coverage because its compositional antecedent holds less often.Coverage decreases in subsequent epochs as the model learns to minimize constraint violations.Source: §5.1 · p. 7, Table 4 · p. 8
5.2 Distribution of Predictions
- Symmetrically inconsistent predictions drop substantially in the constrained model, while Neutral predictions nearly double on pairs built from randomly sampled same-topic sentences.The table reports BERT predictions on 100k evaluation pairs.Source: §5.2 · pp. 7–8, Table 5 · p. 8
- Transitivity regularization raises the Neutral prediction share and mitigates violation rates for all four transitivity statements, while labeled-test accuracy remains uncompromised.The authors caution that the roughly 7k Neutral examples across SNLI and MultiNLI may not represent the potentially vast real-world negative space.Source: §5.2 · p. 8
6 Related Works and Discussion
The discussion situates logic-derived losses among approaches that combine symbolic knowledge with statistical models and among work on NLI robustness. It presents the closest prior work as differing in inconsistency definition, data construction, and treatment of labeled versus unlabeled examples.
6 Related Works and Discussion
- Soft relaxations of Boolean formulas have a history in AI; related neural approaches use Łukasiewicz t-norms, semantically informed losses, or bespoke mappings of Boolean operators.The cited examples include Kimmig et al. (2012), Li and Srikumar (2019), Xu et al. (2018), and Fischer et al. (2019).Source: §6 · p. 8
- Other related work integrates knowledge with statistical models through posterior regularization, constrained conditional models, rule transfer, logic embeddings, consistency constraints, or task-specific regularizers.Examples include Ganchev et al. (2010), Chang et al. (2012), Hu et al. (2016), Rocktäschel et al. (2015), and Alberti et al. (2019).Source: §6 · p. 8
- NLI robustness work studies performance declines under perturbations, stress tests, adversarial examples, and dataset inoculation; the paper identifies Minervini and Riedel (2018) as its closest related work.The authors distinguish their work by its generalized inconsistency definition, lack of reliance on adversarial datasets, and study of constraints with limited annotation.Source: §6 · p. 9
7 Conclusion
The framework derives loss functions from logic-based domain knowledge to measure and mitigate model inconsistency. In an NLI case study, it shows that models can be highly accurate and consistent at the same time.
7 Conclusion
- The framework derives loss functions from logic rules to constrain model training and mitigate inconsistencies.It is presented as a general framework for measuring and mitigating model inconsistencies.Source: §7 · p. 9
- The NLI case study shows that models can be highly accurate and consistent at the same time.Source: §7 · p. 9
- The framework is described as extensible to entity relation extraction and multilabel classification.Source: §7 · p. 9
A.1 Violations as Generalizing Errors
With only labeled examples and no additional constraints, the violation measures reduce to the fraction of mislabeled examples. The unified representation and violation definition also apply to arbitrary constraints.
A.1 Violations as Generalizing Errors
- With only labeled examples and no additional constraints, both global and conditional violation equal classifier error.The conditional-violation denominator counts examples because every example’s antecedent is true; the numerator counts examples with an incorrect label.Source: §A.1 · p. 11
- In this setting, ρ and τ each represent the fraction of examples in D that are mislabeled.Source: §A.1 · p. 11
- The unified representation and violation definition apply to arbitrary constraints, not only labeled examples.Source: §A.1 · p. 11
A.2 Loss for Transitivity Consistency
For the NLI transitivity constraint, the paper applies the product t-norm to obtain a loss for an individual example and sums that loss over the dataset.
A.2 Loss for Transitivity Consistency
- For an individual NLI example (P, H, Z), the product t-norm is applied to the transitivity constraint to obtain a loss.Source: §A.2 · p. 11
- The loss is defined for an individual example (P, H, Z) under the transitivity consistency constraint.Source: §A.2 · p. 11
- The total transitivity loss Ltran is the sum of the individual-example expression over the entire dataset.Source: §A.2 · p. 11
A.3 Details of Experiments
The experiment appendix describes training and weighting choices, then reports full NLI results in Table 8. Larger λ values worsened development accuracy, while baselines finetuned twice had slightly better accuracy and roughly comparable consistency to once-finetuned models.
A.3.1 Setup
- BERTbase baselines were finetuned for three epochs, and constrained models received three additional epochs at a lower learning rate.When dataset U was present, the learning rate was lowered further; Adam was used across runs.Source: §A.3.1 · p. 11
A.3.2 Results
- Table 8 reports symmetry/transitivity inconsistencies for 1%, 5%, 20%, and 100% training data, alongside SNLI and MultiNLI accuracies.Its caption identifies M as mirrored labeled examples, U as unlabeled instance pairs, and T as unlabeled instance triples.Source: Table 8 · p. 12
A.3.1 Setup
- The λ weights varied with data type and annotation amount; larger λ values significantly worsened development accuracy, especially on SNLI.The authors hypothesize that cross-domain differences between SNLI and MultiNLI may explain the effect, while MS COCO shares SNLI’s domain.Source: §A.3.1 · pp. 11–12
A.3.2 Results
- Baselines finetuned twice had slightly better accuracies than once-finetuned models, while symmetry and transitivity consistencies were roughly on par.The appendix says this pattern held across different finetuning hyperparameters.Source: §A.3.2 · p. 12, Table 8 · p. 12
- Table 9 summarizes the chosen λ values by consistency type, unlabeled dataset, and annotation size.Source: Table 9 · p. 12
Related papers
This paper cites
- Attention Is All You Need2017
- BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding2018
- Microsoft COCO: Common Objects in Context2014
- GLUE: A Multi-Task Benchmark and Analysis Platform for Natural Language Understanding2018
- Long Short-Term Memory-Networks for Machine Reading2016
- A Semantic Loss Function for Deep Learning with Symbolic Knowledge2017