DEPN: Detecting and Editing Privacy Neurons in Pretrained Language Models

Xinwei Wu, Junzhuo Li, Minghui Xu, Weilong Dong, Shuangzhi Wu, Chao Bian, Deyi Xiong

Abstract

Large Language Models (LLMs) are prone to memorizing sensitive training data, leading to potential privacy breaches through "data regurgitation." We introduce DEPN (Detecting and Editing Privacy Neurons), a novel framework designed to identify and neutralize the specific neurons responsible for storing private information. By selectively "silencing" these neurons—setting their activations to zero—DEPN significantly reduces privacy exposure while maintaining model utility, offering a computationally efficient alternative to retraining or differential privacy methods.

Introduction

As LLMs are trained on increasingly massive datasets, they often inadvertently memorize specific strings of text, such as names, phone numbers, and private communications. This phenomenon poses a significant security risk. Traditional mitigation strategies, such as data pre-processing or Differential Privacy (DP) during training, are often insufficient or computationally prohibitive. Pre-processing is difficult to scale perfectly, and DP frequently results in a substantial loss of model accuracy (utility). DEPN addresses this by providing a surgical, post-training method to remove private information without compromising the model's general capabilities.

The DEPN Framework

The DEPN framework operates through a three-stage pipeline designed to locate and edit privacy-related parameters within a transformer architecture.

Overview of the DEPN framework for detecting and erasing privacy neurons.
  1. Privacy Neuron Detector: Utilizing gradient integration, the framework identifies neurons that contribute most significantly to the generation of specific private sequences. Neurons are ranked by a "privacy attribution score," pinpointing where sensitive data is localized.
  2. Privacy Neuron Aggregator: To address large-scale privacy concerns, an aggregator employs a voting mechanism. It identifies neurons frequently implicated across a batch of private sequences, ensuring that common privacy-leaking components are prioritized for editing.
  3. Privacy Neuron Editor: The identified neurons are "silenced" by setting their activation values to zero. This simple yet effective modification blocks the flow of private information through the network during inference.

Experimental Setup

The framework was evaluated using the Enron Email Dataset, focusing on unique names, phone numbers, and private text sequences. Performance was compared against three baselines: an unexposed oracle model (BERT-O), a standard model trained on the data (BERT-F), and a model trained with Differential Privacy (BERT-DP).

Results and Discussion

Privacy Risk Reduction

DEPN demonstrated a significant reduction in privacy risk metrics. For phone numbers, the "Exposure" score—a measure of how easily a model reveals memorized data—dropped from 15.74 to 9.78. Similarly, the Mean Reciprocal Rank (MRR) for names decreased from 1.21 to 1.15, indicating that the model was less likely to predict sensitive identifiers correctly.

Impact of neuron erasure on privacy exposure.

Utility Preservation and Efficiency

A key advantage of DEPN is its ability to preserve model utility. While the BERT-DP baseline saw its perplexity (Valid-PPL) degrade to 5.43, DEPN (BERT-FE) maintained a PPL of 3.11, nearly identical to the original model's 3.07. Furthermore, the process is highly efficient, requiring less than 5% of the time needed for standard fine-tuning, making it a viable solution for production-level models.

Localization and the "Pyramid" Distribution

Analysis revealed that privacy neurons are not uniformly distributed. They tend to aggregate in the final layers of the model (specifically layers 10-12 in BERT-base), forming a "pyramid" distribution. Interestingly, the framework becomes more effective as a model's memorization deepens, typically after a "surge" in memorization observed around 10 epochs of training.

Conclusion

DEPN provides a surgical and efficient method for mitigating privacy risks in pretrained language models. By identifying localized "privacy neurons," the framework can reduce data leakage with minimal impact on general performance. Future research will explore "soft editing" techniques to further refine parameter adjustments and test the framework across more diverse datasets and larger model architectures.

Summary updated

BibTeX
@inproceedings{wu2023depn,
  author = {Xinwei Wu and Junzhuo Li and Minghui Xu and Weilong Dong and Shuangzhi Wu and Chao Bian and Deyi Xiong},
  title = {{DEPN: Detecting and Editing Privacy Neurons in Pretrained Language Models}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2023},
  doi = {10.18653/v1/2023.emnlp-main.174},
}
Figure