CWI's Open-Source Framework Beats Google DLP and Presidio at Detecting Sensitive Data
Researchers propose a two-stage framework that uses language models to judge whether flagged values are actually sensitive in context, hitting 94% recall versus 63% for commercial tools.
ProTakeaways
- New framework treats data sensitivity as contextual, using LLMs to reason about columns instead of matching patterns.
- Detect-then-reflect mechanism hits 94% recall versus 63% for Google DLP and Presidio on PII detection.
- Retrieve-then-detect pulls policy rules from UN OCHA Information Sharing Protocols to judge domain-specific sensitivity.
- Explanations cite the exact policy passage used, validated as useful by humanitarian data experts.
- Qwen3 8B runs locally at 0.46s per column with 8 GB VRAM; GPT-4o-mini costs about $0.05 per table.
- Code, 27-type PII taxonomy, and hand-labeled datasets available at trl-lab/sensitive-data-detection.
If you have ever run a dataset through Google Cloud DLP or Microsoft Presidio, you already know the pain: everything that vaguely looks like an address, a name, or a phone number gets flagged, regardless of whether it belongs to a person or a public organization. A new paper from CWI and the University of Amsterdam, Towards Contextual Sensitive Data Detection, argues that this pattern-matching approach is fundamentally the wrong abstraction, and proposes a language-model-driven framework that reasons about sensitivity in context.
The core claim is simple. Sensitivity is contextual: seemingly harmless data can become sensitive when combined, repurposed, or shared across contexts. A hospital's geocoordinates might be public infrastructure in one country and a targeting risk in a conflict zone. A street address might belong to a company or to a person. Existing tools cannot tell the difference.
Where the current tooling breaks
The authors frame two concrete failure modes for the current generation of sensitive data detectors. Detection methods treat all values of types of interest as equally sensitive, while the subject of the value implies its sensitivity, leading to low precision. And they typically focus on personal-level data, particularly PII, and do not generalize to domain-specific sensitive data, leaving sensitive data unprotected.
This matters more than it used to. Large language models trained on web data may memorize and reproduce sensitive information, so anything that leaks into an open data portal can end up baked into a future foundation model. Being sloppy at the ingestion stage now has a much longer tail.
Two mechanisms, one framework
The paper introduces two complementary mechanisms, both designed to be dropped in front of a language model:
- Detect-then-reflect handles type contextualization. First, classify each column against a taxonomy of 27 PII types derived from GDPR and UN OCHA guidelines. Then, hand the flagged column plus the full table context back to an LLM and ask whether it is actually sensitive given surrounding columns and the table's purpose.
- Retrieve-then-detect handles domain contextualization. Instead of relying on a fixed type taxonomy, the system retrieves relevant policy fragments (for example, humanitarian Information Sharing Protocols filtered by the dataset's country of origin) and asks the LLM to judge sensitivity against those rules.
The reflection step is the interesting piece. The LLM is given a markdown representation of the full table, headers plus five sample rows per column, along with the specific type detected for the target column and the types of other columns detected as PII. It then assigns one of three levels: non-sensitive, moderate, or high. An address column sitting next to organization names gets downgraded; the same address column next to birth dates and medical conditions does not.
The numbers
The evaluation uses two datasets the team built by hand: 66 tables with 2,061 columns extracted from GitTables for the PII task, and 23 humanitarian tables (9 synthetic, 14 curated real tables from the UN's Humanitarian Data Exchange) for the domain task.
On type contextualization, the gap between commercial tools and the LLM pipeline is stark:
| System | Precision | Recall | F1 |
|---|---|---|---|
| Google Cloud DLP | 0.53 | 0.63 | 0.58 |
| Microsoft Presidio | 0.52 | 0.62 | 0.57 |
| Qwen3 14B (with reflection) | 0.73 | 0.94 | 0.82 |
| Qwen3 8B FT then GPT-4o-mini | 0.90 | 0.86 | 0.88 |
Without reflection, LLMs mark any detected PII-type column as sensitive, leading to high recall but lower precision. With reflection using full-table context, precision improves substantially across models, trading a small decrease in recall for a significant gain. A hybrid pipeline that fine-tunes Qwen3 8B for type detection and then hands off to GPT-4o-mini for the reflection step gets the best precision-recall balance.
On domain contextualization with humanitarian data, the story is about coverage and explainability. Without external domain knowledge, all models exhibit a highly conservative bias, achieving perfect recall but precision lower than 0.56. Integrating retrieved sensitivity guidelines from information sharing protocols consistently improves precision, with GPT-4o-mini jumping from 0.47 to 0.69 precision at full recall.
What the reflection step actually produces
Because the retrieved policy rules are passed in as context, the model's decisions come with citations. In one example from the paper, a column indicating the country origin of humanitarian aid suppliers is classified as non-sensitive with an explicit reference to an ISP guideline about facility data at national or regional level. Two humanitarian data quality experts considered the context-grounded explanations accurate, and highly informative for guiding and standardizing human-assessment.
Cost and latency
The obvious question is whether calling an LLM on every column is practical. The reported numbers:
- Google DLP: 0.16 seconds per column (baseline)
- Qwen3 8B (local, 8 GB VRAM): 0.46 seconds per column
- GPT-4o-mini: 1.20 seconds per column, roughly $0.05 per table
- Qwen3 14B (local, 11.4 GB VRAM): 1.62 seconds per column
Qwen3 8B is only about 3x slower than DLP while delivering substantially better accuracy, which puts this comfortably in production-viable territory for offline batch auditing.
Where it falls short
The authors are honest about the limits. On PII data, generic ID columns are often correctly typed but then wrongly reflected as non-sensitive, hurting recall. On humanitarian data, models err heavily toward false positives, with GPT-4o-mini in particular labeling 75% of borderline cases as highly sensitive. The framework also depends on someone actually writing down the sensitivity rules for a given domain, so it inherits whatever gaps exist in the source policies. And the whole evaluation is tabular; extending to free-form text is sketched but not benchmarked.
Getting it running
The implementation and hand-labeled datasets are open source under MIT on GitHub. The repo ships with a detect-then-reflect pipeline, ISP examples, fine-tuning scripts using Unsloth, and support for GPT-4o-mini, Gemma 2/3, Qwen3, and Aya Expanse. A minimal run looks like:
python scripts/01_inference_pii.py \
--input_path data/your_dataset.csv \
--output_path results/pii_results.json
python scripts/02_inference_non_pii.py \
--input_path data/your_dataset.csv \
--output_path results/sensitivity_results.json
For teams that currently rely on regex-and-dictionary tools to audit datasets before publishing them to a portal, HuggingFace, or an internal data lake, this is a concrete recipe for cutting false positives without giving up recall, and for finally getting explanations that a human reviewer can actually work with.