Dynamically Disentangling Social Bias from Task-Oriented Representations with Adversarial Attack

Liwen Wang, Yuanmeng Yan, Keqing He, Yanan Wu, Weiran Xu

Abstract

Machine learning models often internalize social biases present in training data, leading to unfair representations. Traditional debiasing methods, such as static projection or Generative Adversarial Networks (GANs), often suffer from residual bias or training instability. We present a dynamic approach to debiasing through Adversarial Semantic Disentanglement. By injecting calculated adversarial noise into word embeddings during training, our method decouples protected attributes from task-oriented representations without compromising model performance.

Introduction

Large-scale NLP models frequently exhibit biased internal representations, where neutral terms like "doctor" or "nurse" are mathematically associated with specific genders or races. Previous efforts to mitigate this have relied on static projection—which can be easily bypassed by non-linear classifiers—or adversarial training (GANs), which are notoriously difficult to stabilize. This work proposes a more robust, dynamic solution that treats debiasing as an adversarial attack problem, aiming to disentangle bias from the main task on-the-fly.

Methodology: Adversarial Semantic Disentanglement

The core of the proposed method is the use of adversarial perturbations to confuse a "protected classifier" that attempts to identify sensitive attributes (e.g., gender or race) from text embeddings.

Architecture of the Adversarial Semantic Disentanglement framework.

The training process follows a four-step loop:

  1. Protected Forward: A classifier is trained to predict a protected attribute from the current embeddings.
  2. Debiasing Backward: Using the Fast Gradient Value (FGV) technique, the model calculates a "worst-case" perturbation—specific noise designed to maximize the loss of the protected classifier.
  3. Main Task Forward: This noise is added to the original input embeddings. The resulting "debiased" representation is then processed by the main task classifier.
  4. Parameter Update: The model updates its parameters to minimize the main task loss while simultaneously learning to ignore the features that the protected classifier relies on.

Experimental Setup

The method was evaluated on two benchmarks:

  • DIAL (Dialectal Tweets): 176k tweets labeled for sentiment and race, used to measure racial bias in sentiment analysis.
  • Biographies: ~393k professional biographies used to predict occupation across 28 classes while minimizing gender reliance.

Results and Discussion

The proposed adversarial method (Adv) consistently outperformed the state-of-the-art Iterative Null-space Projection (INLP) baseline in both fairness and accuracy.

Visualization of the representation space before and after adversarial debiasing.

As shown in the visualization above, the original representation space clearly separates gender groups, allowing a classifier to use gender as a proxy for profession. After applying the Adv method, the gender representations become "tangled" and inseparable, while the profession boundaries remain distinct.

Key Findings

  • Embedding Layer Targeting: Injecting noise at the word embedding layer is more effective than at later stages, catching bias early in the pipeline.
  • Encoder Flexibility: Keeping the context encoder trainable (non-fixed) allows the model to find a superior balance between task accuracy and fairness compared to frozen encoders.
  • On-the-Fly Training: Dynamically training the protected classifier alongside the main model ensures the debiasing mechanism adapts to shifting internal representations.

On the DIAL dataset, the Adv method reduced the bias gap (TPR-GAP) from 0.40 to 0.09, while maintaining a sentiment analysis accuracy of 0.73. In contrast, the INLP baseline saw accuracy drop significantly to 0.62.

Conclusion

Adversarial Semantic Disentanglement provides a powerful framework for building fairer NLP models. By dynamically decoupling bias from task-specific information, the model achieves high fairness without the performance degradation typical of static methods. Future work will explore multi-attribute debiasing and applications to large-scale generative models.

Summary updated

BibTeX
@inproceedings{wang2021dynamically,
  author = {Liwen Wang and Yuanmeng Yan and Keqing He and Yanan Wu and Weiran Xu},
  title = {{Dynamically Disentangling Social Bias from Task-Oriented Representations with Adversarial Attack}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2021},
  doi = {10.18653/v1/2021.naacl-main.293},
}
Figure