Text classifiers leak training data but small fixes reduce risk

Empirical Evaluation of Membership Inference Attacks on NLP Text Classifiers: A Baseline Study on SST-2

Cryptography and SecurityComputation and LanguageMachine Learning

Summary

Machine learning models that classify text can sometimes reveal whether a particular sentence was in their training data, which can be a privacy problem. The authors tested this on two types of models using a widely-studied sentiment dataset and found both had some risk of leaking this information. However, they discovered that simple changes to the training process, like adjusting the number of training rounds or regularization, can reduce this risk without hurting accuracy much. This shows that privacy in text systems can be improved with straightforward methods.

What this means in practice

Tested on one dataset.

Authors

William Novak, Muhammad Abusaqer

Abstract

Membership inference attacks (MIAs) try to determine whether a specific record was used to train a model, a privacy risk that matters in natural language processing (NLP), where training data can contain sensitive user text. This paper presents a controlled benchmark of membership inference vulnerability for text classification on the GLUE SST-2 sentiment dataset. A TF-IDF + Logistic Regression pipeline and a fine-tuned DistilBERT classifier are compared under a loss-threshold MIA, with utility measured by development accuracy and macro F1. DistilBERT reached 0.9466 accuracy and 0.9460 macro F1 against 0.8756 and 0.8727 for Logistic Regression, yet both models leaked membership signal (Attack AUC 0.5615 and 0.5800, respectively). Two mitigations were tested. Stronger regularization reduced leakage for Logistic Regression at a visible utility cost, whereas fine-tuning DistilBERT for 2 epochs instead of 3 reduced leakage with negligible accuracy loss. Lightweight training adjustments can improve the privacy-utility trade-off without complex defenses.