Source-linked AI summary
Adversarially Regularising Neural NLI Models to Integrate Logical Background Knowledge
Pasquale Minervini, Sebastian Riedel
TL;DR
The paper addresses automatic generation of NLI adversarial examples that violate given logical constraints. It optimises for constraint violations while using a language model to generate plausible examples, then adversarially trains models; accuracy improves by up to 79.6% relatively on adversarial datasets, though gains on SNLI and MultiNLI may be limited.
Problem
Automatically generating NLI adversarial examples that violate given First-Order Logic constraints addresses the reliance on pre-specified semantic transformations that require substantial manual effort and domain knowledge.
Source: §1 · pp. 1–2Method
The paper maximizes a continuous measure of logical-rule violation, uses a language model to generate plausible examples, and adversarially regularises neural NLI models.
Source: §9 · p. 9Results
Up to 79.6% relative accuracy improvement on adversarially crafted datasets accompanied a drastic reduction in background-knowledge violations; adversarial examples transferred across architectures and training produced generally more robust models.
Source: §9 · p. 9Takeaways & Limitations
Adversarial examples can expose logical inconsistencies and support training NLI models that are more robust to such examples.
Source: §1 · p. 2, §9 · p. 9Despite a drastic reduction in background-knowledge violations, improvement on SNLI and MultiNLI may not be significant, and their strong-performing models may capture annotation artefacts and idiosyncrasies.
Source: §8.2 · p. 8
Abstract
from arXiv · showhide
Adversarial examples are inputs to machine learning models designed to cause the model to make a mistake. They are useful for understanding the shortcomings of machine learning models, interpreting their results, and for regularisation. In NLP, however, most example generation strategies produce input text by using known, pre-specified semantic transformations, requiring significant manual effort and in-depth understanding of the problem and domain. In this paper, we investigate the problem of automatically generating adversarial examples that violate a set of given First-Order Logic constraints in Natural Language Inference (NLI). We reduce the problem of identifying such adversarial examples to a combinatorial optimisation problem, by maximising a quantity measuring the degree of violation of such constraints and by using a language model for generating linguistically-plausible examples. Furthermore, we propose a method for adversarially regularising neural NLI models for incorporating background knowledge. Our results show that, while the proposed method does not always improve results on the SNLI and MultiNLI datasets, it significantly and consistently increases the predictive accuracy on adversarially-crafted datasets -- up to a 79.6% relative improvement -- while drastically reducing the number of background knowledge violations. Furthermore, we show that adversarial examples transfer among model architectures, and that the proposed adversarial training procedure improves the robustness of NLI models to adversarial examples.
1 Introduction
The introduction motivates NLI adversarial examples as a way to expose model errors against logical background knowledge and to regularise models. It reports stronger accuracy on adversarial datasets despite little improvement on SNLI and MultiNLI.
1 Introduction
- Machine-learning models can rely on test-set predictive patterns while missing deeper phenomena, motivating ways to probe their behavior.Adversarial examples are presented as useful for understanding model shortcomings and for regularisation.Source: §1 · p. 1
- NLI models receive a premise and hypothesis and determine their semantic relationship, making the task a benchmark for language understanding.The introduction notes that NLI requires handling phenomena including quantification, coreference, tense, modality, and ambiguity.Source: §1 · pp. 1–2
- The method uses adversarial examples to identify violations of logic-rule background knowledge and train models to be robust to those violations.The rules express structural constraints such as contradiction symmetry and entailment reflexivity and transitivity.Source: §1 · p. 2
- Up to 79.6% relative accuracy improvement on adversarial datasets contrasts with little improvement on SNLI and MultiNLI.The authors also report transfer across models and more robust NLI models.Source: §1 · p. 2
2 Background
This background describes neural NLI models, their three-way classification task, and their standard differentiable scoring and training setup. The paper uses this setup to study adversarial consistency with logical knowledge.
2 Background
- Neural NLI models are end-to-end differentiable systems trained by gradient-based optimisation and have achieved state-of-the-art results on SNLI and MultiNLI.Examples include cBiLSTM, Decomposable Attention, and ESIM.Source: §2 · p. 2
- NLI models assign a premise–hypothesis pair to entailment, contradiction, or neutral.The sentences are represented by matrices whose columns are k-dimensional word embeddings.Source: §2 · p. 2
- A model-dependent scoring function produces class scores that softmax converts into probabilities, and differentiability enables back-propagation.The scoring function maps the sentence representations to three class scores.Source: §2 · pp. 2–3
- Training minimizes cross-entropy on labeled NLI examples, with each label indicating one of the three relationships.The model’s class probabilities are used in the loss.Source: §2 · p. 3
- The paper defines its adversary as finding NLI-instance sets whose predictions violate background knowledge encoded as First-Order Logic rules.This frames adversarial generation as an optimization problem with an efficient solution developed in later sections.Source: §2 · p. 3
3 Background Knowledge
The paper represents desired NLI relationships as first-order logic rules and uses violations of those rules to generate adversarial examples and regularise models.
3 Background Knowledge
- The rules express NLI classes as binary logic predicates, with atoms representing relations between sentences.The predicates are ent, con, and neu for entailment, contradiction, and neutrality.Source: §3 · p. 3
- Table 1 presents the First-Order Logic rules defining desired properties of NLI models.Source: Table 1 · p. 3
- The background knowledge comprises universally quantified rules whose bodies imply their heads, encoding desired properties of NLI models.The rules cover entailment reflexivity and transitivity, contradiction symmetry, and formal relations among entailment, neutrality, and contradiction.Source: §3 · p. 3
- The method generates sentence sets that violate the rules, then generates such examples during training to regularise model parameters adversarially.Source: §3 · p. 3
4 Generating Adversarial Examples
The section generates NLI adversarial examples by searching for sentence substitutions that violate first-order logic rules while remaining linguistically plausible.
4 Generating Adversarial Examples
- The method generates NLI examples that violate background-knowledge rules by casting example generation as an optimization problem.It searches for sentence substitutions that maximize inconsistency while constraining sentence perplexity.Source: §4 · p. 3, §4.1 · p. 3, §4.3 · p. 4
4.1 Inconsistency Loss
- The continuous inconsistency loss measures how strongly a sentence substitution violates a first-order rule.It compares the probability of a rule’s body with that of its head; implication requires the head probability to be at least as large as the body probability.Source: §4.1 · p. 4
4.2 Constraining via Language Modelling
- A language model constrains generated sentences to have low perplexity because maximizing inconsistency alone may yield ill-formed or meaningless examples.The paper uses an LSTM language model to generate low-perplexity examples.Source: §4.2 · p. 4
4.3 Searching in a Discrete Space
- The search jointly maximizes inconsistency and sentence probability subject to a perplexity threshold.It starts from low-perplexity corpus or language-model sentences and makes small edits, including word changes and parse-tree removals or insertions.Source: §4.3 · pp. 4–5
5 Adversarial Regularisation
Adversarial regularisation jointly trains NLI models on labelled data and generated examples that expose violations of background knowledge.
5 Adversarial Regularisation
- Training jointly minimizes the data loss and inconsistency loss on generated adversarial examples.The optimization combines dataset cross-entropy with the inconsistency loss on generated substitution sets.Source: §5 · p. 5
- The weight λ sets the trade-off between data loss and inconsistency loss on generated substitutions.The regularised objective maximizes inconsistency over substitutions while constraining generated-sentence perplexity below a threshold.Source: §5 · p. 5
- Training alternates between generating adversarial examples and updating model parameters using the regularised loss gradient.The paper’s algorithm generates substitution sets at each iteration before computing the gradient and taking a descent step.Source: §5 · p. 5
- Table 2 presents sample adversarial NLI sentences generated with the DAM model by maximizing inconsistency loss.The caption identifies the examples’ model and generation objective.Source: Table 2 · p. 6
6 Creating Adversarial NLI Datasets
The paper constructs adversarial NLI datasets by selecting highly inconsistent test instances and including their premise-hypothesis reversals.
6 Creating Adversarial NLI Datasets
- The dataset construction selects the k SNLI test instances with the highest inconsistency scores under rules R1–R4, as measured by a chosen model.The resulting dataset is named A_k^m, where m identifies the selection model and k the number of selected examples.Source: §6 · p. 6
- For each selected pair, the dataset includes both the original and reversed premise-hypothesis order, with the reversed pair’s label assigned manually.Selection scores combine inconsistency in both sentence orders and do not depend on the original label.Source: §6 · p. 6
- Table 3 reports SNLI and MultiNLI accuracy by model, with results before regularisation on the left and after regularisation on the right.The caption specifies the table’s datasets, metric, model grouping, and before/after layout.Source: Table 3 · p. 6
7 Related Work
The related-work discussion contrasts this approach with NLP adversarial methods based on input perturbations and highlights its use of inconsistency-based generation and training.
7 Related Work
- Prior NLP adversarial examples include distracting text for question answering, character changes for translation and toxicity models, and paraphrases [Jia and Liang, 2017; Belinkov and Bisk, 2017; Hosseini et al., 2017; Iyyer et al., 2018].Source: §7 · p. 6
- The paper distinguishes its method by requiring no labelled data to generate examples and by using them during training to target robustness [Jia and Liang, 2017; Kannan and Vinyals, 2017; Minervini et al., 2017].It maximizes inconsistency by making an NLI model produce inconsistent results.Source: §7 · p. 6
- Unlike common computer-vision adversaries, which use small semantically invariant image perturbations, NLP perturbations are difficult to identify [Buck et al., 2017; Szegedy et al., 2014; Goodfellow et al., 2014; Nguyen et al., 2015].Source: §7 · p. 6
8 Experiments
Adversarial regularisation sharply reduces background-knowledge violations and improves accuracy on adversarial datasets, although gains on SNLI and MultiNLI may be insignificant. Automatically generated examples expose model weaknesses, and adversarial examples transfer across architectures.
8 Experiments
- On the SNLI training set, cBiLSTM failed entailment reflexivity 23.76% of the time, while DAM and ESIM violated it in 0.09% and 1.00% of cases.For contradiction symmetry, violations occurred 16.70% of the time with DAM, 9.84% with ESIM, and 46.17% with cBiLSTM.Source: §8 · p. 7
- Violations of rules R2 and R3 were often correlated with sentence length, with models tending to infer entailment from longer, more specific sentences to shorter, more general ones.The examples were selected to maximise the inconsistency loss.Source: §8 · p. 7
8.1 Generation of Adversarial Examples
- Generated examples expose failures involving negation, hyponymy, antonymy, and commonsense relations, including a mistaken entailment for “male” and “man.”The examples provide insights into neural NLI models that can be leveraged to improve robustness.Source: §8.1 · pp. 7–8
8.2 Adversarial Regularisation
- Regularised models were much more likely to make predictions consistent with the background rules, despite potentially insignificant accuracy improvements on SNLI and MultiNLI.The models were fine-tuned for 10 epochs using the adversarially regularised loss.Source: §8.2 · p. 8
- On A100, increasing λ yielded relative accuracy improvements up to 75.8% for DAM and 79.6% for cBiLSTM.The method also reduced background-knowledge violations, while accuracy improvements on SNLI and MultiNLI may not be significant.Source: §8.2 · pp. 8–9
- Adversarial examples transfer across models, and adversarially regularised models are generally more robust even to examples generated with other architectures.ESIM was more robust among the unregularised models; cBiLSTM remained vulnerable to examples generated using DAM and ESIM, while cBiLSTMAR was generally more robust.Source: §8.2 · p. 9
9 Conclusions
The paper presents automatic generation of NLI adversarial examples that violate given First-Order Logic constraints, alongside adversarial regularisation for incorporating background knowledge. The approach improves accuracy on adversarially crafted datasets while reducing rule violations, and adversarial examples transfer across architectures.
9 Conclusions
- The paper reduces adversarial-example identification to optimisation of a continuous relaxation of constraint violations, using a language model to generate linguistically plausible examples.It also proposes adversarial regularisation of neural NLI models to incorporate background knowledge.Source: §9 · p. 9
- The method consistently increased accuracy on adversarially crafted datasets, with relative improvement up to 79.6%, while drastically reducing background-knowledge violations.Adversarial examples also transferred across model architectures, and adversarial training produced generally more robust models.Source: §9 · p. 9
A.1 Accuracy on Adversarial Datasets
The appendix reports model accuracy across adversarial datasets, presents examples of logical-rule violations, and describes algorithms for adversarial example generation and training.
A.1 Accuracy on Adversarial Datasets
- Accuracy is reported for DAM, ESIM, and cBiLSTM across adversarial datasets generated for different models.The supplied passages provide evaluation headings but no accuracy values.Source: §A.1 · p. 11
A.2 Adversarial examples
- DAM produces inconsistent predictions on SNLI training examples and generated adversarial examples, with examples violating rules R2, R3, R4, and R5.Table 7 identifies R2 and R3 violations; Table 8 identifies R2, R4, and R5 violations.Source: §A.2 · p. 11, Table 7 · p. 12, Table 8 · p. 12
A.3 Background Knowledge Violations
- The appendix reports the percentage of rule violations by DAM, ESIM, and cBiLSTM on the SNLI test set.No violation percentages are included in the supplied passage.Source: §A.3 · p. 13
A.4 Optimisation algorithms
- The generation algorithm perturbs dataset sentences and uses a language model to constrain candidates; adversarial training jointly minimizes data and inconsistency losses after generating examples.The examples are generated by maximizing inconsistency loss before the model is trained.Source: §A.4 · p. 13