Source-linked AI summary

Generalization in NLI: Ways (Not) To Go Beyond Simple Heuristics

Prajjwal Bhargava, Aleksandr Drozd, Anna Rogers

arXiv:2110.01518v1cs.CL

TL;DR

Because NLP models can learn spurious dataset-specific patterns instead of the intended task, this paper studies generalization in NLI from MNLI to adversarial HANS using several BERT-based strategies. Across five strategies, increased model size is the most promising, while other approaches also yield negative results.

  • Problem

    NLP models may learn dataset-specific heuristics rather than the intended task, motivating study of how to generalize to adversarial data.

    Source: §1 · p. 1
  • Method

    The paper conducts an NLI generalization case study from MNLI to HANS using BERT-based architectures, subsampling, and increased model size.

    Source: §1 · p. 1
  • Results

    Across five strategies, increasing model size is the most promising, while Siamese networks and HEX reach chance on HANS and adapters trail vanilla fine-tuning.

    Source: §4.1 · p. 3, §4.2 · p. 4, §7 · p. 5
  • Takeaways & Limitations

    The mix of positive and negative findings contributes evidence about how Transformer-based models generalize.

    Source: §1 · p. 1, §7 · p. 5

    For Siamese models, the proposed explanation that separate representations encourage abstract patterns remains unverified, and whether independent representations are desirable remains open.

    Source: §4.1 · p. 3

Abstract

from arXiv · show

Much of recent progress in NLU was shown to be due to models' learning dataset-specific heuristics. We conduct a case study of generalization in NLI (from MNLI to the adversarially constructed HANS dataset) in a range of BERT-based architectures (adapters, Siamese Transformers, HEX debiasing), as well as with subsampling the data and increasing the model size. We report 2 successful and 3 unsuccessful strategies, all providing insights into how Transformer-based models learn to generalize.

1 Introduction

Popular NLP datasets can contain spurious patterns that models learn instead of the intended task. This paper studies generalization to adversarial data in NLI and reports positive and negative results across BERT-based approaches.

1 Introduction

  • Models may learn dataset-specific spurious patterns instead of the actual task.The paper frames this as a motivation for learning methods that could avoid the problem.Source: §1 · p. 1
  • The case study tests generalization in NLI using adversarial data.It considers a range of BERT-based approaches.Source: §1 · p. 1
  • The study reports both successful and unsuccessful strategies for generalization.Source: §1 · p. 1

2 Methodology

The study evaluates models fine-tuned on MNLI for generalization to HANS, a synthetic dataset targeting three NLI heuristics. It reports accuracy on HANS and the MNLI matched development set.

Data

  • MNLI is a three-class NLI resource with annotation artifacts and annotator bias; Figure 1 is its data map using RoBERTa-large.The map suggests most examples are easy to learn, helping explain why vanilla fine-tuning achieves high MNLI accuracy.Source: §2 · p. 1, Figure 1 · p. 1

Evaluation data

  • HANS is a synthetic test set targeting lexical overlap, subsequence, and constituent heuristics that MNLI-trained models may learn.One example is mistaking shared words for entailment even when the premise says the doctor was paid by the actor and the hypothesis says the doctor paid the actor.Source: §2 · p. 1

Methodology

  • Models are fine-tuned on MNLI; evaluation uses HANS accuracy and accuracy on the MNLI matched development set.HANS has 30K test examples, while the matched development set has 20K examples and MNLI training has 393K.Source: §2 · p. 1
  • For direct MNLI comparison, HANS accuracy averages the two label accuracies because HANS has two labels while MNLI has three.A fully random model would otherwise be biased toward HANS’s non-entailment label.Source: §2 · p. 1

3 Experiments

The experiments test changes to the training distribution and model architecture or size, including cartography-based subsampling, Siamese networks, adapters, HEX debiasing, and larger models.

§3.1 Subsampling the training data with cartography

  • Cartography-based subsampling trains on varying amounts of hard or ambiguous MNLI examples, preceded by 25% easy examples for two epochs.The training examples are partitioned using RoBERTa-large and BERT-base dynamics, and the approach is motivated by the idea that easy examples may be less informative.Source: §3 · p. 2

§3.2 Siamese Networks

  • Siamese Transformers encode premises and hypotheses separately, with pooled representations combined as [U, V, U −V, U ∗V] for an MLP classifier.The design is intended to bottleneck interactions compared with cross-attention; experiments use base and large BERT encoders, frozen or trainable.Source: §3 · p. 2

§3.3 Adapter Networks

  • Adapters add task-specific trainable MLPs within encoder sub-layers while keeping pretrained parameters intact.The BERT and RoBERTa adapters use a reduction factor of 16 and ReLU nonlinearity.Source: §3 · p. 2

§3.4 Explicit De-biasing

  • HEX debiasing projects Transformer representations into an affine space most different from a naive model’s representation.The main model uses pooled BERT-base representations, while the naive model is CBOW with self-attention; inference uses BERT logits only.Source: §3 · p. 2

§3.5 Increasing Model Size

  • The model-size experiment compares standard MNLI fine-tuning across BERT, RoBERTa, and ALBERT variants from small to large.The motivation is that models absorbing more pretraining data might acquire transferable linguistic knowledge; results are compared across the HuggingFace Trainer and a custom trainer.Source: §3 · pp. 2–3

4 Results and Discussion

Larger models and longer fine-tuning improved MNLI-to-HANS generalization, while Siamese networks, HEX debiasing, and adapters did not provide a consistent alternative to vanilla fine-tuning. Subsampling hard examples yielded a promising RoBERTa-large result, but not a consistent one across models or sample types.

4.1 Negative Results

  • Siamese networks and HEX reached chance-level HANS performance, while adapters generalized worse than vanilla fine-tuning of their base models.The authors therefore judged these approaches not the most promising for the generalization problem studied, while noting that this negative conclusion cannot be proven definitively.Source: §4.1 · p. 3
  • The Siamese model’s bottleneck was expected to fail if vanilla BERT’s HANS performance depended on cross-attention learning specific patterns such as hypothesis negation.The authors report that the bottleneck MLP also failed to find more abstract patterns in its input representations.Source: §4.1 · p. 3
  • For HEX, the authors support the hypothesis that access only to BERT’s final output leaves little to debias, while noting that qualitative research is still needed.The proposed explanation is that the final output may encode predicted NLI labels more strongly than the input sequence itself.Source: §4.1 · p. 3
  • Adapters performed worse than vanilla fine-tuning overall, and at 1,024 examples diverse sampling yielded 80.7% MNLI versus 85% for random sampling, but 67.8% versus 57.5% on HANS.The diverse sample appeared more informative for MNLI, not for HANS.Source: §4.1 · p. 3

4.2 (Cautiously) Positive Results

  • At about 25% of MNLI training data, a RoBERTa-large model trained on hard examples performed well on both HANS and MNLI, but BERT-base had no comparable subset.Adding a further 13% of biased MNLI data made RoBERTa-large lose HANS performance; ambiguous-example subsampling did not show the same result.Source: §4.2 · p. 4, Figure 2 · p. 4
  • Large BERT, RoBERTa, and ALBERT models generalized more consistently than their base versions, and longer fine-tuning improved HANS performance.The size benefit had a threshold: BERT-tiny to BERT-medium did not help, and MNLI performance on larger models changed little with longer tuning.Source: §4.2 · p. 4, Figure 3 · p. 4

5 Related work

Related work reports successful MNLI-to-HANS generalization through data augmentation, while this paper’s cartography-based subsampling was inconsistent. Prior studies also motivate debiasing and model-scale explanations, and the section highlights implementation variability as an important factor in reported performance.

5 Related work

  • Prior data-based approaches improved MNLI-to-HANS generalization by adding predicate-argument structures or syntactic transformations, with augmentation proposed to nudge models toward syntax use (Moosavi et al., 2020).Min et al. (2020) argue that pretraining alone does not provide a strong inductive bias to use syntax downstream.Source: §5 · p. 4
  • Cartography-based subsampling did not work consistently, possibly because MNLI contains little counter-evidence to spurious patterns and the useful subset is hard to find reliably.The authors also report negative results for K-means subsampling.Source: §5 · p. 4
  • Prior shallow-model debiasing successes provide a contrast to this paper’s negative results for HEX debiasing applied after training (Utama et al., 2020; Clark et al., 2020; Sanh et al., 2021).Source: §5 · p. 4
  • Earlier studies also report improved generalization with larger models and longer fine-tuning; one attributes the latter to HANS-like MNLI examples taking longer to learn (Tu et al., 2020).Source: §5 · p. 4
  • Vanilla BERT-base HANS scores in published studies ranged from 50.0% to 62.5%, while this paper’s custom trainer reached 69% over 16 runs; implementation variability may contribute.The authors report higher run-to-run variability in their implementation, possibly due to batch-size differences.Source: §5 · pp. 4–5

6 Analysis: Bias Under Low Confidence

Randomly corrupting hard MNLI samples exposed a label-skewed response: entailment accuracy rose while contradiction accuracy fell. The authors suggest that even reduced lexical overlap can still nudge low-confidence predictions toward entailment.

  • A strong learned pattern can prompt over-reliance, leaving models biased toward a label at low confidence even when they score well on a generalization benchmark.The paper notes this concern for high-cost-of-error applications where false positives are preferable to false negatives.Source: §6 · p. 5
  • Hard samples were corrupted after four prior exposures, with random character insertions in 30% of content words and additional substitution, deletion, and swapping strategies.The perturbations reduced direct lexical-match signals while leaving the sequences relatively readable to humans.Source: §6 · p. 5
  • Contradiction accuracy drops 10–20 points, entailment improves 10–30 points, and neutral mostly gains 5–13 points after corruption across both models and all strategies.The changes are reported for BERT-base and RoBERTa-base on hard samples.Source: §6 · p. 5, Table 2 · p. 5
  • Even decreased lexical overlap nudges low-confidence predictions toward entailment rather than contradiction, despite MNLI’s balanced entailment and contradiction classes.The authors suggest that corruption may hinder learning from scarce non-entailment evidence, while remaining overlap may encourage the model to default to entailment.Source: §6 · p. 5

7 Conclusion

The paper tests five strategies for improving BERT-class NLI generalization and finds increasing model size the most promising. It also reports unsuccessful strategies as evidence about generalization in BERT-based models.

  • Increasing model size is the most promising of five tested strategies for improving generalization in BERT-class NLI models.The other strategies are explicit debiasing, bottlenecking, adapters, and data subsampling.Source: §7 · p. 5
  • The study reports both successful and negative results, which the authors say contribute to knowledge about generalization in BERT-based models.Source: §7 · p. 5
  • The authors frame task-independent techniques for improving NLP model generalization as crucial for further advances because supervised datasets are often biased.Source: §7 · p. 5

A Additional details and samples from the used datasets

The study uses MNLI for training and HANS for testing, with different label schemes and HANS examples designed to probe three heuristics. The datasets differ in size and availability of test data.

B Cartography

Cartography characterizes training examples by how the model predicts them across training, grouping them as easy, ambiguous, or hard. In these experiments, easy examples were used first, while training on hard or ambiguous examples alone did not improve performance.

  • Cartography characterizes examples as easy, ambiguous, or hard by analyzing model predictions during training; easy examples have high confidence and hard examples low confidence across epochs.Source: B Cartography · p. 10
  • Examples were sampled in ranked order, with the easiest example placed first in the sampled batch.The ranked-order implementation was based on the method authors’ original implementation.Source: B Cartography · p. 10
  • Training solely on hard or ambiguous examples did not improve performance, so the experiments began with 25% easy examples before adding hard-data subsets.The hard-data subsets ranged from 1% to 75% of the hard examples.Source: B Cartography · p. 10
  • Figure 4 evaluates generalization on ambiguous samples as training progresses, with markers indicating the percentage of MNLI training data used.Source: Figure 4 · p. 10, B Cartography · p. 10

C Stabilizing HEX

HEX uses paired representations and a λ-regularized inverse, but the pseudo-inverse is unstable and can make optimization difficult. The authors adjust the matrix setup and inference path to address this.

C Stabilizing HEX

  • HEX forms F_A and F_G with a shared classifier from paired representations, using a zero matrix in place of U for F_G.The representations come from pooled BERT output and an intermediate CBOW representation.Source: C Stabilizing HEX · p. 10
  • The pseudo-inverse is unstable and can make optimization difficult, so the authors use square U and V matrices to obtain an inverse instead.They also report that L1 and L2 normalization of U and V did not noticeably improve results.Source: C Stabilizing HEX · pp. 10–11
  • At inference, the authors feed main-network outputs directly to the MLP for logits rather than using F_L.They report this choice makes inference faster and cite prior work reporting no profound impact on the logits.Source: C Stabilizing HEX · pp. 10–11
  • Values of λ greater than 0.0001 do not aid network learning; 1e−4 worked well for initialization before λ became a model parameter.The authors used 1e−4 to initialize λ.Source: C Stabilizing HEX · pp. 10–11

D Subsampling the Training Data with K-means clustering

The authors test whether selecting MNLI subsamples by diversity improves transfer to HANS. Neither random nor diversity-based subsampling improves HANS generalization.

D Subsampling the Training Data with K-means clustering

  • The motivating problem is the mismatch between MNLI and HANS distributions, for which a useful subsample might support performance on both.The passage frames this as a possible solution for a biased dataset.Source: D Subsampling the Training Data with… · p. 11
  • The experiment clusters BERT [CLS] embeddings into 512 groups, increases sample size in 10% steps, and compares random with diversity-maximizing selection across five seeds.At the smallest size, sampling covers all clusters; as data grows, smaller clusters are exhausted and sample diversity decreases.Source: D Subsampling the Training Data with… · p. 11
  • Neither subsampling strategy improves HANS generalization; the model still predicts entailment for most HANS examples.The authors characterize this strategy's overall result as negative.Source: D Subsampling the Training Data with… · p. 11
  • With small data amounts, diverse sampling yields more variation on MNLI than random sampling, but performance converges as the sample approaches the full dataset.Figure 6 shows in-domain and generalization performance for fine-tuning BERT-base on varied amounts of MNLI data.Source: D Subsampling the Training Data with… · p. 11
Loading 2110.01518v1…