DBR: Divergence-Based Regularization for Debiasing Natural Language Understanding Models

Zihao Li, Ruixiang Tang, Lu Cheng, Shuaiqiang Wang, Dawei Yin, Mengnan Du

Abstract

Pre-trained language models (PLMs) often rely on superficial shortcuts—spurious correlations between specific tokens and labels—rather than genuine semantic understanding. This behavior leads to high performance on in-domain benchmarks but catastrophic failure on out-of-domain (OOD) data. We present Divergence-Based Regularization (DBR), a novel framework that identifies shortcut tokens, applies a soft-masking strategy based on the degree of bias, and utilizes a divergence-based loss to encourage the model to ignore these shortcuts. Our results across multiple Natural Language Understanding (NLU) tasks demonstrate that DBR significantly enhances OOD generalization while maintaining competitive in-domain accuracy.

Introduction

Modern Pre-trained Language Models like BERT and RoBERTa have set new benchmarks in Natural Language Understanding. However, research increasingly suggests these models are prone to "shortcut learning." For instance, in Natural Language Inference (NLI) tasks, a model might learn that the presence of negation words like "not" or "never" is a reliable indicator of a "contradiction" label, regardless of the actual logical relationship between the premise and the hypothesis.

While these shortcuts are effective for standard datasets, they fail when the model encounters OOD scenarios where such correlations do not hold. Existing debiasing methods often require manual identification of biases or rely on "bias-only" models that lack transparency. DBR addresses these limitations by providing an automated, transparent framework to suppress reliance on shortcut features and prioritize semantic comprehension.

Methodology

The DBR framework operates in four distinct stages to systematically reduce model bias:

1. Shortcut Token Identification

To identify which tokens the model relies on most, DBR employs Integrated Gradients (IG). This gradient-based interpretability technique calculates attribution scores for each token in a sentence. The top-$N$ tokens with the highest scores are flagged as potential shortcuts.

2. Quantifying Shortcut Degree

Not every highly predictive word is a spurious shortcut; some are essential to the sentence's meaning. To distinguish between the two, DBR trains a simple "bias-only" model (a 1-layer MLP) using only the flagged tokens. If this model can predict the label with high confidence—measured by the variance of its output probabilities—the sample is assigned a high "shortcut degree."

3. Soft Masking Strategy

Rather than using a "hard mask" that might strip away vital semantic information, DBR utilizes soft masking. Tokens are masked based on a Bernoulli distribution tied to the sample's shortcut degree. This ensures that only samples with a high likelihood of being biased are heavily modified, preserving the semantic integrity of the training data.

4. Divergence-Based Regularization

During the training phase, the NLU model processes both the original input and the soft-masked version. A Jensen-Shannon Divergence (JSD) regularization loss is applied to align the output distributions of both inputs. This forces the model to produce consistent predictions even when shortcut tokens are removed, effectively teaching it to ignore those tokens in favor of deeper semantic features.

Experimental Results

Datasets and Tasks

DBR was evaluated on three core NLU tasks, each paired with challenging OOD test sets:

  • Natural Language Inference: Trained on MNLI; tested on MNLI (in-domain), HANS (OOD), and MNLI-hard (OOD).
  • Fact Verification: Trained on FEVER; tested on FEVER (in-domain) and Symmetric v1/v2 (OOD).
  • Paraphrase Identification: Trained on QQP; tested on QQP (in-domain) and PAWS (OOD).

Performance Analysis

DBR consistently outperformed the BERT-base baseline on all OOD benchmarks. Notably, on the PAWS dataset (Paraphrase Identification), DBR achieved an accuracy of 41.8%, a significant improvement over the baseline's 33.5%. On MNLI-hard, DBR reached 78.8% compared to the baseline's 77.0%.

Crucially, DBR maintains a superior balance between in-domain and out-of-domain performance. While many debiasing techniques suffer from a "debiasing-accuracy trade-off," DBR matched the BERT-base accuracy of 84.5% on the MNLI development set while simultaneously providing the aforementioned OOD gains.

Discussion and Insights

  • The Efficacy of Soft Masking: Experimental data suggests that hard-masking predictive words often degrades performance because those words can be core semantic drivers. The soft-masking approach successfully mitigates bias without sacrificing the model's ability to learn from valid features.
  • Mitigating Overconfidence: PLMs are frequently overconfident when processing biased examples. DBR shifts the model's confidence distribution, making it more robust and less likely to make high-confidence errors on adversarial or OOD data.
  • Learning Dynamics: Training with DBR results in slower convergence compared to standard training. This indicates that the model is being forced to engage with more complex semantic features rather than quickly memorizing simple shortcuts.

Conclusion and Future Work

Divergence-Based Regularization offers a robust and transparent method for debiasing NLU models. By identifying and suppressing shortcut tokens through a combination of interpretability techniques and regularization, DBR improves generalization to unseen data distributions. Future research will explore more sophisticated masking strategies, such as semantic substitution, and investigate the application of DBR to modern Large Language Models (LLMs) operating within prompting paradigms.

Summary updated

BibTeX
@article{li2025dbr,
  author = {Zihao Li and Ruixiang Tang and Lu Cheng and Shuaiqiang Wang and Dawei Yin and Mengnan Du},
  title = {{DBR: Divergence-Based Regularization for Debiasing Natural Language Understanding Models}},
  journal = {SIGKDD Explor.},
  year = {2025},
  doi = {10.1145/3748239.3748241},
}
Figure