Abstract
Neural language models are known to have a high capacity for memorization of training samples. This may have serious privacy implications when training models on user content such as email correspondence. Differential privacy (DP), a popular choice to train models with privacy guarantees, comes with significant costs in terms of utility degradation and disparate impact on subgroups of users. In this work, we introduce two privacy-preserving regularization methods for training language models that enable joint optimization of utility and privacy through (1) the use of a discriminator and (2) the inclusion of a triplet-loss term. We compare our methods with DP through extensive evaluation. We show the advantages of our regularizers with favorable utility-privacy trade-off, faster training with the ability to tap into existing optimization approaches, and ensuring uniform treatment of under-represented subgroups.
Introduction
Neural language models (LMs) are highly effective at capturing linguistic patterns, but this capacity often leads to the unintended memorization of sensitive training data, such as private email snippets or account numbers. An adversary can exploit this by querying the model to elicit memorized strings.
While Differential Privacy (DP), specifically DP-SGD, is the standard defense, it introduces three significant challenges: substantial utility loss (higher perplexity), high computational overhead due to per-sample gradient clipping, and a disparate impact on fairness, where accuracy for under-represented users is disproportionately harmed. This research proposes two practical regularization alternatives that optimize for both privacy and utility simultaneously.
Methodology
The proposed methods focus on the model's last hidden state ($h_x$), aiming to make these representations "author-agnostic" to prevent attackers from linking text back to specific users.
Adversarial Training
This approach introduces a discriminator network that attempts to identify the author from the LM's hidden states. The LM is trained to "fool" this discriminator by flattening the output probability distribution, effectively scrubbing author-identifying features from its internal representations while maintaining its ability to predict the next word.
Triplet-based Loss
While standard triplet loss typically pulls similar samples together, this method inverts that logic for privacy. The loss function is designed to push representations of the same author further apart while pulling representations of different authors closer together in the embedding space. This prevents the formation of user-specific clusters, making it harder for the model to memorize unique user patterns.
Experimental Setup
The methods were evaluated on two datasets:
- Avocado: 60,000 corporate emails from 100 users.
- Reddit: 3 million samples from 10,000 users, representing informal social media text.
Key Results and Analysis
Utility-Privacy Trade-off and Attack Resistance
The researchers measured privacy using "exposure" metrics and reconstruction attacks. As shown in the results, the proposed regularizers achieved significantly lower perplexity (better utility) than DP at comparable privacy levels. Notably, DP proved less effective at protecting patterns that repeat frequently for a single user (e.g., signatures), whereas the data-driven regularizers handled these signals more robustly.
Computational Efficiency
Training efficiency is a major advantage of regularization. While DP-SGD was found to be 16.44x slower than standard training, the Adversarial method was only 1.06x slower, and the Triplet method was 1.8x slower. This allows these methods to scale to large production datasets where DP might be computationally prohibitive.
Fairness and Disparate Impact
DP often creates a large utility gap between well-represented and under-represented users. In these experiments, DP resulted in a 29-point perplexity gap between user groups. The proposed regularization methods reduced this gap to just 7 points, ensuring a more equitable distribution of model performance across the user base.
Conclusion
This work demonstrates that privacy regularization via adversarial training or triplet loss offers a compelling alternative to DP-SGD. These methods provide superior utility, significantly faster training times, and improved fairness. While they do not offer the same "worst-case" mathematical guarantees as DP against an adversary with infinite compute, they provide robust protection against realistic, finite-capacity adversaries in production environments. Future research will explore scaling these techniques to massive Transformer models and combining them with lightweight DP for hybrid protection.
Summary updated