Generalised Differential Privacy for Text Document Processing

Natasha Fernandes, Mark Dras, Annabelle McIver

Abstract

This paper introduces a formal mathematical framework for author obfuscation—altering a text so its author cannot be identified while ensuring the core topic remains clear. By combining word embeddings with a metric-based version of Differential Privacy, the authors provide a mechanism that swaps words in a "bag-of-words" representation to hide stylistic fingerprints with provable privacy guarantees.

Introduction

When sensitive documents, such as government reports or health records, are released, they are often "sanitized" to protect the identities of those involved. However, even if explicit identifiers like names and dates are removed, an author’s "writing style"—their unique choice of words and frequencies—can act as a fingerprint. Modern machine learning can identify authors with startling accuracy, even from simple "bags-of-words" where the original sentence structure is lost.

The challenge is a classic trade-off between privacy and utility. The goal is to scramble stylistic clues enough to fool an adversary (the "author identifier") without compromising the meaning so much that a legitimate user (the "topic classifier") can no longer understand the document's content. While existing methods are often ad-hoc, this research seeks a solution with rigorous, a priori privacy guarantees.

Methodology

The authors leverage Generalized Differential Privacy (specifically $d_\chi$-privacy), which extends traditional Differential Privacy (DP) to non-database domains like text by utilizing distance metrics.

Representation and Metric

Documents are treated as "bags-of-words" and mapped into a high-dimensional vector space using word2vec embeddings. In this space, semantically similar words (e.g., "chief" and "president") are physically close to each other. To measure the similarity between two documents (bags of words), the authors employ the Earth Mover’s Distance (EMD). EMD represents the minimum "work" required to transform one distribution of word vectors into another.

Figure 1: Illustration of Earth Mover's Distance (EMD) between two bags of words ($b_1$ and $b_2$) in a vector space. The distances $d_i$ represent the cost of mapping words from one bag to the other.

The Privacy Mechanism

The core innovation is a mechanism that adds $n$-dimensional Laplace noise to each word vector in a document. To implement this, the system samples a "noise radius" from a Gamma distribution and a "direction" uniformly from an $n$-dimensional hypersphere. After adding noise, the resulting "noisy vector" is mapped back to the nearest real word in the vocabulary.

Crucially, the authors prove (Theorem 1) that applying this private mechanism to individual words independently is sufficient to guarantee privacy for the entire document relative to the Earth Mover's metric. This finding simplifies the process, as it avoids the need for complex joint probability distributions to protect the document as a whole.

Experimental Evaluation

The researchers evaluated their approach using a custom-scraped "Fan Fiction" dataset from fanfiction.net, focusing on the Harry Potter and Twilight fandoms. This dataset provides a robust test bed: many different authors writing about identical narrow topics, allowing the researchers to determine if they could hide an author's identity without losing the specific "topic-ness" of the text.

Key Results

The mechanism was tested against adversaries using both Euclidean distance and state-of-the-art character n-gram stylometry techniques.

  • Author Hiding: In a 20-author set, increasing the noise (decreasing $\epsilon$ to 10) caused the number of correctly identified authors to drop from 15/20 to 0/20. The author's stylistic fingerprint was effectively erased.
  • Topic Preservation: Despite the author being hidden, topic classification remained stable, maintaining approximately 18/20 or 19/20 accuracy.
  • Qualitative Observations: At low noise levels ($\epsilon=30$), the system makes subtle swaps like felt $\rightarrow$ feels. At higher noise ($\epsilon=10$), the swaps become more eccentric (e.g., disowned $\rightarrow$ ENERGY_STAR), yet the semantic "gravity" of the document remains intact.

Limitations and Future Work

While the framework provides strong privacy guarantees, several challenges remain. The current output is a "noisy bag-of-words" rather than a fluent, readable paragraph. Future work may involve using natural language generation to reconstruct readable sentences from these private bags. Additionally, the system's effectiveness is constrained by its vocabulary; rare words or proper nouns not present in the pre-trained word2vec model can create "leaks" that an adversary might exploit. Finally, the computational cost of finding nearest-neighbor words in massive vocabularies remains a hurdle for scaling the approach to larger datasets.

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