Generalised Differential Privacy for Text Document Processing

Natasha Fernandes, Mark Dras, Annabelle McIver

Abstract

Protecting author identity in text documents is a critical challenge in data privacy. This paper introduces a formal framework for "author obfuscation" that strips a document of its unique stylistic fingerprint while preserving its core topic. By combining Generalized Differential Privacy ($d_\chi$-privacy) with the Earth Mover’s Distance (EMD) metric, the researchers developed a mechanism that provides mathematical privacy guarantees for text documents represented as bags-of-words. Experimental evaluations on large-scale fan fiction datasets show that authorship attribution can be reduced to baseline levels while maintaining high topic classification accuracy.

Introduction

In an era of massive data leaks and declassified archives, protecting the identity of authors—such as whistleblowers or patients in medical records—is a major challenge. Traditional "sanitization" usually involves manual redaction, which is expensive and offers no formal guarantees. The core difficulty lies in "writing style." Even if explicit identifiers are removed, an author’s choice of words, sentence structure, and even common typos act as a unique identifier. Modern machine learning models can identify authors with startling accuracy. This research addresses the question: Can we automatically transform a document so that an adversary can no longer identify the author, but a legitimate user can still correctly identify the topic?

Methodology

The proposed framework bridges the gap between Natural Language Processing (NLP) and Differential Privacy (DP) using four key components:

  1. Bag-of-Words (BoW) Representation: Documents are treated as collections of words and their frequencies, ignoring word order. While this removes some structural style, BoW still contains enough stylistic clues for high-accuracy authorship attribution.
  2. Word Embeddings: Words are mapped into high-dimensional vector spaces (e.g., word2vec), where words with similar meanings are physically close.
  3. Earth Mover’s Distance (EMD): Also known as Word Mover's Distance, this metric measures the "distance" between two documents by calculating the minimum "cost" to transform one bag-of-words into another based on the distances between individual word vectors.
Illustration of Earth Mover's Distance (EMD) between two bags of words $b_1$ and $b_2$ in a vector space.
  1. $d_\chi$-Privacy (Generalized DP): Unlike standard DP, which often deals with binary membership questions, $d_\chi$-privacy is metric-based. It ensures that if two inputs are close according to a specific metric (like EMD), their outputs are statistically indistinguishable.

The Algorithm: The mechanism takes a bag-of-words, converts words to vectors, adds $n$-dimensional Laplacian noise to those vectors, and then maps the "noisy" vectors back to the nearest real words in the vocabulary.

Experimental Evaluation

The researchers evaluated their approach using a custom-scraped Fan Fiction dataset. Fan fiction provides a robust testbed because many different authors write about the same "fandoms" (topics), allowing for a clear separation between stylistic identity and thematic content. The study utilized the two largest fandoms—Harry Potter (~797,000 stories) and Twilight (~220,000 stories)—to train topic classifiers and evaluated the privacy mechanism on subsets of 20 and 50 authors.

Key Insights

  • Theoretical Foundations: A significant contribution (Theorem 1) proves that applying a privacy mechanism independently to each word in a bag satisfies a stronger privacy guarantee for the entire bag relative to the EMD.
  • Topic as Identity: The authors note a philosophical limit: if a topic is unique to one individual, stylistic obfuscation cannot hide their identity without destroying the document's utility.
  • Semantic Preservation: By using EMD, the mechanism replaces words with semantic neighbors (e.g., "President" might become "Leader"), preserving meaning while shifting the stylistic signature.

Results and Discussion

Experiments demonstrated a clear privacy-utility trade-off controlled by the privacy parameter $\epsilon$:

  • Authorship Attribution: For a 20-author set, adversary accuracy dropped from 75% on unmodified text to 0% (random guess levels) as noise increased.
  • Topic Classification: Accuracy remained high, often staying around 90-95%, even when the author was completely hidden.
  • Classifier Resilience: Topic classifiers using different representations (like fastText) were remarkably resilient to the added noise, confirming that the semantic core remained intact.

Conclusion and Future Work

While effective, the current approach produces "noisy bags-of-words" rather than coherent, grammatical documents. Future research may involve using natural language generation to reconstruct readable sentences from protected bags. Additionally, addressing the computational cost of mapping noisy vectors back to large vocabularies and handling out-of-vocabulary words remain open challenges.

Summary updated

BibTeX
@inproceedings{fernandes2019generalised,
  author = {Natasha Fernandes and Mark Dras and Annabelle McIver},
  title = {{Generalised Differential Privacy for Text Document Processing}},
  booktitle = {Post},
  year = {2019},
  doi = {10.1007/978-3-030-17138-4\_6},
}
Figure