Table of Contents
Fetching ...

Language Models That Walk the Talk: A Framework for Formal Fairness Certificates

Danqing Chen, Tobias Ladner, Ahmed Rayen Mhadhbi, Matthias Althoff

TL;DR

Large language models are vulnerable to adversarial perturbations that can impact fairness and safety in high-stakes contexts. The authors propose a holistic framework that pre-trains an embedding layer to cluster gender-related and toxicity-related terms, integrates this layer into a transformer, and applies zonotope-based formal verification to certify invariance under word substitutions. The methodology comprises four steps: gender-debias pre-training, general semantic pre-training, transformer-based LM training with a frozen embedding layer, and zonotope-based verification using perturbation balls in embedding space, yielding a dataset-wide fairness certificate via a defined fairness score. Empirically, the framework achieves 100% fairness on an 8-block salary model for gender bias mitigation and 75% fairness on a 3-block toxicity-detection model, demonstrating robust, formal guarantees for ethical AI deployment and content moderation while reducing combinatorial testing complexity.

Abstract

As large language models become integral to high-stakes applications, ensuring their robustness and fairness is critical. Despite their success, large language models remain vulnerable to adversarial attacks, where small perturbations, such as synonym substitutions, can alter model predictions, posing risks in fairness-critical areas, such as gender bias mitigation, and safety-critical areas, such as toxicity detection. While formal verification has been explored for neural networks, its application to large language models remains limited. This work presents a holistic verification framework to certify the robustness of transformer-based language models, with a focus on ensuring gender fairness and consistent outputs across different gender-related terms. Furthermore, we extend this methodology to toxicity detection, offering formal guarantees that adversarially manipulated toxic inputs are consistently detected and appropriately censored, thereby ensuring the reliability of moderation systems. By formalizing robustness within the embedding space, this work strengthens the reliability of language models in ethical AI deployment and content moderation.

Language Models That Walk the Talk: A Framework for Formal Fairness Certificates

TL;DR

Large language models are vulnerable to adversarial perturbations that can impact fairness and safety in high-stakes contexts. The authors propose a holistic framework that pre-trains an embedding layer to cluster gender-related and toxicity-related terms, integrates this layer into a transformer, and applies zonotope-based formal verification to certify invariance under word substitutions. The methodology comprises four steps: gender-debias pre-training, general semantic pre-training, transformer-based LM training with a frozen embedding layer, and zonotope-based verification using perturbation balls in embedding space, yielding a dataset-wide fairness certificate via a defined fairness score. Empirically, the framework achieves 100% fairness on an 8-block salary model for gender bias mitigation and 75% fairness on a 3-block toxicity-detection model, demonstrating robust, formal guarantees for ethical AI deployment and content moderation while reducing combinatorial testing complexity.

Abstract

As large language models become integral to high-stakes applications, ensuring their robustness and fairness is critical. Despite their success, large language models remain vulnerable to adversarial attacks, where small perturbations, such as synonym substitutions, can alter model predictions, posing risks in fairness-critical areas, such as gender bias mitigation, and safety-critical areas, such as toxicity detection. While formal verification has been explored for neural networks, its application to large language models remains limited. This work presents a holistic verification framework to certify the robustness of transformer-based language models, with a focus on ensuring gender fairness and consistent outputs across different gender-related terms. Furthermore, we extend this methodology to toxicity detection, offering formal guarantees that adversarially manipulated toxic inputs are consistently detected and appropriately censored, thereby ensuring the reliability of moderation systems. By formalizing robustness within the embedding space, this work strengthens the reliability of language models in ethical AI deployment and content moderation.
Paper Structure (49 sections, 8 equations, 17 figures, 17 tables)

This paper contains 49 sections, 8 equations, 17 figures, 17 tables.

Figures (17)

  • Figure 1: Overview of the framework explained in \ref{['sec:exp_setup']} involving transfer learning (step 1 and 2), transformer integration & training (step 3), and formal verification (step 4). The transformer architecture in step 3 is from vaswani2017attention.
  • Figure 2: Verifiability radar plot with gender-distance reference circle for 8-block transformer in gender fairness mitigation.
  • Figure 3: Verifiability radar plot with gender-distance reference circle for 10-block transformer in gender fairness mitigation.
  • Figure 4: Verifiability radar plot with toxicity-distance reference circle for the 3-block toxicity detection model in content moderation.
  • Figure 5: Zonotopic enclosure of some of the activation functions $\phi_k$.
  • ...and 12 more figures