Norwegian Computing Center's Rewriter Kills 99.8% of Document Re-Identification Risks
A new paper shows why redacting names is not enough, and proposes an inverted-index plus LLM rewrite loop that removes 99.8% of phrase-based linkage risks.
ProTakeaways
- New paper defends de-identified documents against phrase-search linkage attacks that regex-match rare N-grams back to source.
- Method builds an inverted index of N-grams, flags any appearing in fewer than k documents, and rewrites them.
- An instruction-tuned Qwen3-4B rewrites flagged spans iteratively until no linkable phrases remain.
- Eliminates roughly 99.8% of linkable N-grams on ECHR court cases and Wikipedia biographies, beating LLM paraphrasing and DP-MLM.
- Runs at 15 to 53 seconds per document on a single GPU, preserving semantic similarity above 0.95.
- Does not defend against embedding-based semantic linkage, which would require redacting more than half the text.
Stripping names, dates, and addresses out of a document feels like it should be enough to anonymize it. It is not. A new paper from Pierre Lison and Mark Anderson at the Norwegian Computing Center argues that even after standard de-identification tools do their job, an attacker holding a few phrases from the original text can often still trace the redacted version back to its source. The authors propose a defense built around an inverted index of rare N-grams and an iterative LLM rewriter, and they report eliminating around 99.8% of phrase-based linkage risks on court cases and Wikipedia biographies.
The gap in standard de-identification
De-identification techniques primarily focus on reducing the re-identification risk, that is, the risk that an adversary might infer the identity of the human individuals referred to in the document based on the PIIs occurring in the text. But privacy regulators care about a second failure mode: record linkage, where a scrubbed document can still be matched back to its original in a source database. Under the European GDPR and the Article 29 Working Party opinion on anonymisation, unlinkability from the original source is one of three criteria that anonymisation techniques must meet, alongside prevention of singling out and inference.
The simplest way an attacker exploits this is phrase search. Pull a distinctive N-gram out of the redacted document, grep for it across the original corpus, and the match narrows down to one record. Because many longer N-grams occur only once in a given corpus, phrase search can efficiently connect edited texts back to their source. A rare diagnosis, an unusual turn of phrase, or a specific procedural detail is often enough.
The threat model they defend against
The authors adopt a worst-case setup called a maximum-knowledge intruder model in which the intruder has access to the original collection of documents. Given a de-identified text, the adversary is assumed to:
- Extract contiguous token substrings from the redacted document.
- Search for them across the original collection.
- Declare success if fewer than
kdocuments contain all those strings.
That last check borrows the k-anonymity idea: if a phrase, or a combination of phrases, narrows the corpus down to fewer than k candidates, the redacted document is considered linkable. The paper tests both k=2 (singling out) and k=5.
How the method works
The pipeline has two stages. First, an inverted index is built over every N-gram (up to 8 words) in the source collection. In information retrieval terms, this maps each N-gram to a posting list of documents containing it, so intersecting posting lists gives you the exact set of documents containing any combination of phrases in linear time.
For each de-identified document, the system then:
- Enumerates candidate N-grams from the redacted text, capped at 8 words and never crossing punctuation or existing
[REDACTED]markers. - Filters to the shortest non-overlapping set, to minimize edits.
- Looks up each N-gram in the inverted index and flags any whose posting list has fewer than
kentries. - Optionally does the same for combinations of up to 3 N-grams, intersecting their posting lists.
The flagged spans are then handed to an instruction-tuned LLM with the surrounding context and a set of few-shot examples. The model is asked to produce a short chain-of-thought reasoning, then a JSON object containing the rewritten text with every flagged span replaced. Rewrites can be small (a synonym, a tense change, an added adverb) or, for named entities that resist paraphrasing, a fallback to [REDACTED]. Because the extractor only considers non-overlapping N-grams per pass, and because LLMs do not always follow instructions perfectly, the loop repeats until no flagged N-grams remain.
The rewriter used in the experiments is Qwen3-4B, prompted without fine-tuning at temperature 1.2. It is a choice of convenience, not the contribution.
What the numbers say
Evaluation runs on two corpora: 13,759 English-language European Court of Human Rights cases (with 252 de-identified via Microsoft Presidio), and 100,000 Wikipedia biographies (250 de-identified). For the ECHR dataset, the inverted index contains 58.3M distinct N-grams, with an average posting list length of 1.27 documents. That density is exactly what makes phrase search so dangerous, and why aggressive rewriting is necessary.
Three baselines are compared: an unconstrained LLM paraphrase using the same Qwen3-4B model, a handcrafted rule-based paraphraser using WordNet synonyms, and DP-MLM, a differential-privacy text rewriter based on masked language models.
| Method (ECHR) | Linkable N-grams (arity=1) | Linkable combos (arity≤3) | Semantic sim (distilroberta) | Perplexity |
|---|---|---|---|---|
| Baseline LLM rewrite | 0.597 | 0.695 | 0.974 | 12.6 |
| Handcrafted paraphrasing | 0.348 | 0.615 | 0.992 | 20.4 |
| DP-MLM (ε=100) | 0.065 | 0.130 | 0.769 | 171 |
| Proposed (arity=1 spans) | 0.001 | 0.432 | 0.987 | 14.2 |
| Proposed (arity≤3 spans) | 0.002 | 0.002 | 0.959 | 15.0 |
Two takeaways jump out. Unconstrained LLM paraphrasing, even over multiple passes, only hides about half of the linkable phrases because it edits indiscriminately and often leaves the rare ones intact. DP-based rewriting kills linkages but shreds the text: DP-based rewriting performed poorly, producing disfluent texts with weak semantic ties to the source. The targeted approach hits both goals at once, though extending it to N-gram combinations does cost some semantic fidelity, especially on biographies where many flagged spans are named entities that can only be redacted.
Compute cost is modest. On a single GPU, the method averaged about 15.5 seconds per document for single N-grams and 52.6 seconds for combinations up to arity 3, on court cases averaging roughly 750 words.
The honest limitation
This is the part worth reading carefully. The method defends against phrase search, not against semantic search. The authors explicitly show that even after aggressive rewriting, cosine similarity between a rewritten document and its original still ranks the original at the top of the collection in most cases. Preventing semantics-based linkages requires drastic alterations to the document, with at least half the words needing to be redacted. Such a level of obfuscation is hardly compatible with most de-identification use cases, as the resulting texts are barely readable.
Their argument is that the threat models are asymmetric: phrase search can be run by an attacker who knows a handful of N-grams from the original, while embedding-based linkage requires the attacker to already possess the full original documents to encode them, which is a much stronger assumption.
Where this fits
Useful when:
- You are releasing de-identified legal, medical, or administrative documents drawn from a known corpus.
- Faithfulness to the original content matters, so full paraphrasing or DP rewriting is too destructive.
- Your compliance model treats GDPR unlinkability as a real requirement rather than a checkbox after PII removal.
Less useful when:
- You do not have access to the original corpus that de-identified documents were drawn from, in which case phrase-search linkage is moot.
- Your documents are dense in named entities that resist paraphrasing, which pushes the method toward heavier redaction and hurts downstream utility.
- Your adversary is assumed to hold the full original text and can run embedding-based attacks, where the technique does not help.
The paper does not currently ship an open code release, but the components are reproducible from the description: an inverted index over N-grams up to length 8, posting-list intersection for combinations up to arity 3, and a few-shot prompt (given in full in the appendix) driving any instruction-tuned LLM. The real contribution is the framing, that phrase-search linkage is a distinct privacy failure from PII leakage, and that a well-targeted rewrite loop can neutralize it without turning the document into unreadable noise.