Post

[Study Note] Privacy-Preserving Record Linkage (PPRL) & ML Attacks

[Study Note] Privacy-Preserving Record Linkage (PPRL) & ML Attacks

What is Privacy-Preserving Record Linkage? (PPRL)

PPRL is a technique for matching records about the same individuals across different databases — without exposing their private data.

PPRL Overview

How it works

1. Two separate databases exist

  • A Hospital DB with patient info (name, age, pressure, etc.)
  • A Bank DB with financial info (name, DOB, loan type, etc.)

2. Encode

Instead of sharing raw personal data, each database converts its records into binary vectors (0s and 1s) using a technique like Bloom filters. The actual names/details are never directly shared.

3. Link

The encoded vectors from both databases are compared against each other to find similar patterns.

4. Matches

Records that are sufficiently similar are identified as referring to the same person (e.g., P1209 (hospital) = 623 (bank)).

5. Analytics

Once matched, the combined data can be used for analysis — without either party ever seeing the other’s raw records.

Why it matters

The key privacy guarantee is that neither database sees the other’s sensitive information. Only the encoded representations are exchanged, protecting individual privacy while still enabling useful data integration.


Application of PPRL

PPRL Application

A real-world application in the healthcare domain:

① Two data sources

  • Rare disease registries — databases storing records of patients with rare diseases
  • Diagnosis testing providers — organisations that conduct medical tests

② Encoding

Both sources convert their raw records into encoded (binary) data before sharing.

③ Linkage Model

All encoded data flows into a central linkage model that compares records across multiple sources.

④ Matches & Clustering

The model groups matched records into clusters — each cluster represents one unique individual. Cardinality = number of clusters (total count of distinct individuals identified).


Key Challenges

  1. Privacy
  2. Linkage quality
  3. Computational efficiency

PPRL Pipeline

PPRL Pipeline

① Multiple Databases (D₁, D₂, … Dₚ) — Several databases from different organisations, each holding raw sensitive personal data.

② Data Pre-processing — Raw data is cleaned and standardised (e.g., fixing typos, formatting names/dates consistently).

③ Blocking or Filtering — Reduces the number of record pairs that need to be compared. Only records that are likely matches are kept.

④ Distance-aware Data Encoding (the key step)

Records are converted into binary vectors (0s and 1s). The encoding preserves similarity — similar records in real life will have similar binary vectors, making them candidates worth comparing more closely.

e.g., “peter” → bigrams (pe, et, te, er) → mapped into a bit vector

⑤ Encoded Records (D₁ᴹ, D₂ᴹ, … Dₚᴹ) — All databases now hold only encoded versions of their data.

⑥ Matching and Linkage — Encoded records are compared using ML classifiers or clustering algorithms.

⑦ Output — Clusters — Final result: groups of matched records, each cluster representing one unique individual.


Blocking

Why do we need Blocking?

When linking two databases, you’d normally compare every record against every other record — this is quadratic complexity. If each database has 1,000 records, you’d need 1,000,000 comparisons. That’s extremely slow and inefficient!

What is Blocking?

Blocking is a filtering step that groups records into smaller buckets called blocks, so you only compare records within the same block.

Example — Postcode as a Blocking Key

RecordNamePostcode
AJohn Smith2000
BJane Doe3000
CJon Smyth2000
  • Records A and C → same block (postcode 2000) → compared ✅
  • Records A and B → different blocks → skipped ❌

Blocking Diagram

Each colour in the puzzle represents a block — only pieces of the same colour get compared.

After Blocking

1
Blocking → Pairwise Matching → Clustering

Blocking dramatically reduces the number of comparisons needed, making the whole linkage process fast and scalable.


Data Encoding: Exact Matching Using Bloom Filters

What is a Bloom Filter?

A Bloom filter is a bit vector (a row of 0s and 1s) that represents a piece of data. Each value gets mapped to specific positions in the vector.

Bloom Filter Exact Matching

Example: “smith” vs “smith” (identical)

1
2
3
4
5
6
bf  = 0 0 1 0 0 0 0 0 1   (smith)
bf' = 0 0 1 0 0 0 0 0 1   (smith)

AND: 0 0 1 0 0 0 0 0 1  →  matching bits = 2

Sim = 2 × 2 / (2 + 2) = 1.0  ✅ Perfect match!

Example: “smith” vs “smit” (different)

1
2
3
4
5
6
bf  = 0 0 1 0 0 0 0 0 1   (smith)
bf' = 0 0 0 1 0 0 1 0 0   (smit)

AND: 0 0 0 0 0 0 0 0 0  →  matching bits = 0

Sim = 2 × 0 / (2 + 2) = 0.0  ❌ No match!

The Similarity Formula (Dice Coefficient)

\[Sim(bf, bf') = \frac{2 \times |bf \wedge bf'|}{|bf| + |bf'|}\]

This is called exact matching — even a tiny difference (e.g. “smith” vs “smit”) results in a similarity score of 0.0.


Data Encoding: Fuzzy Matching Using Bloom Filters

Bloom Filter Fuzzy Matching

String Example: “smith” vs “smit”

Step 1: Break into bigrams

1
2
"smith" → sm, mi, it, th   (4 bigrams)
"smit"  → sm, mi, it       (3 bigrams, missing "th")

Step 2: Map into Bloom filters

1
2
bf  = 1 1 0 1 1 0 0 1 1   (6 bits set)
bf' = 1 1 0 1 0 0 0 1 1   (5 bits set)

Step 3: Calculate similarity

1
2
AND = 1 1 0 1 0 0 0 1 1   (5 matching bits)
Sim = 2 × 5 / (6 + 5) = 0.9  ✅ Very similar!

Numerical Example: 29 vs 30

Instead of bigrams, nearby values are generated to capture closeness:

1
2
3
4
v  = 29 → {27, 28, 29, 30, 31}
v' = 30 → {28, 29, 30, 31, 32}

Sim = 2 × 5 / (6 + 5) = 0.9  ✅ Very similar!

Key Difference from Exact Matching

 Exact MatchingFuzzy Matching
“smith” vs “smit”0.0 ❌0.9 ✅
29 vs 300.0 ❌0.9 ✅

Fuzzy matching is far more practical in real-world scenarios where typos, abbreviations, and minor errors are common.


Bloom Filters with Provable Privacy Guarantees

Differential Privacy

The Problem

Bloom filters alone are not fully secure. Attackers can potentially:

  • Use cryptanalysis to reverse-engineer original data from the bit vector
  • Use pattern mining to identify individuals by analysing repeated patterns

The Solution: Differential Privacy (DP) Noise

Random noise is added using Randomised Response — randomly flip some bits so attackers cannot fully trust what they see.

Original Bloom filter:

1
1  1  0  1  1  0  0  1  1

After adding noise (flipped bits):

1
1  0  0  1  1  1  0  1  0

The Flipping Probability Formula

\[p = \frac{1}{1 + e^{\varepsilon/2}}\]

Where ε (epsilon) is the privacy budget:

ε valueFlip probabilityPrivacyAccuracy
Small εHigh (more flips)Stronger 🔒Lower
Large εLow (fewer flips)WeakerHigher ✅

This is the classic privacy vs accuracy trade-off in differential privacy.

Why Attackers Can’t Simply Reverse It

The attacker knows the formula, but NOT which bits were flipped, how many, or where. The flipping is random each time — even running the same name through twice gives different noisy outputs.


Text Data Encoding: Counting Bloom Filters (CBF)

Counting Bloom Filters

Why a Different Approach for Text?

Regular Bloom filters just store 0s and 1s, which works for names and numbers. But for longer medical text, we need to capture how important each word is — not just whether it appears. That’s where Counting Bloom Filters (CBF) come in.

Step 1: TF-IDF Weighting

Record vScoreRecord v’Score
biopsy3cancer5
cancer6polyp3
mass1biopsy4
polyp1tumour2

Step 2: Map into CBF

1
2
cbf  = 3 1 9 1 1 6 0 0 1   (total = 22)
cbf' = 4 3 9 2 3 5 0 2 0   (total = 28)

Step 3: Calculate Similarity

1
2
min  = 3 1 9 1 1 5 0 0 0   (sum of min = 20)
sim  = 2 × 20 / (22 + 28) = 0.8  ✅ Pretty similar!

A score of 0.8 correctly reflects that the two records share cancer, biopsy, and polyp but differ in “mass” vs “tumour” — very similar but not identical.


Matching and Linkage

MethodProsCons
Threshold-basedSimple, fastHard to set the right threshold
Probabilistic (Fellegi-Sunter)Accounts for errorsNeeds prior error estimates
Rule-based (Deterministic)InterpretableTime consuming to build
ML-basedFlexible, accurateNeeds labelled training data

Evaluation

1. Computational Efficiency

MetricWhat it measures
RuntimeHow long it takes to run
Memory consumptionHow much RAM is used
Communication sizeHow much data is sent between databases
Reduction ratioHow much blocking reduced comparisons
Pairs completenessWhether blocking kept all true matches in same block

2. Linkage Quality

Confusion Matrix

 Actually a MatchActually NOT a Match
Predicted MatchTP (correct!)FP (false alarm)
Predicted Non-matchFN (missed!)TN (correct!)
\[\text{Accuracy} = \frac{TP + TN}{TP + FP + TN + FN}\] \[\text{Precision} = \frac{TP}{TP + FP}\] \[\text{Recall} = \frac{TP}{TP + FN}\] \[\text{F-measure} = \frac{2 \times Precision \times Recall}{Precision + Recall}\]

3. Privacy

MetricWhat it measures
Entropy / information gainHow much info an attacker could extract
False positive rate of Bloom filterHow hard it is to reverse-engineer original data
Privacy budget (ε)How much noise was added via differential privacy

Machine Learning: Attacks on ML Models

AI and ML models can be attacked in two main ways:

1. Inference Attacks

Membership Inference Attack — “Was this specific person’s data used to train this model?”

Attribute Inference Attack — “What are this person’s private attributes?” (uses the model to fill in missing info)

2. Adversarial Attacks

The attacker manipulates the input to trick the model into producing a desired (incorrect) output.

Attack typeGoal
Membership inferenceFind out if a record was in the training data
Attribute inferenceInfer private details about an individual
AdversarialManipulate the model’s output

Membership Inference Attack (MIA)

Given a trained ML model and a record, determine whether that record was part of the model’s training data.

MIA Overview

How it works

1
2
3
4
5
Features (x) + Label (y)  →  ML model  →  Prediction vector M(x)
                                                    ↓
                                          MIA(x, y, M(x))
                                                    ↓
                                   Pr((x,y) ∈ D)  →  Member or Not?

Why does this work?

Data typeModel behaviour
Training data (member)Very high confidence, low loss
New data (non-member)Lower confidence, higher loss

The attacker exploits this difference to distinguish members from non-members.


Black Box MIA

In a black box setting, the attacker can only send inputs and observe outputs — no access to model weights, architecture, or training data.

Three Levels of Information

SettingInfo availableAttack difficulty
Full confidence scoresAll class scoresEasy
Top-k confidence scoresPartial scoresModerate
Prediction label onlyJust the labelHard

Why We Can’t Always Use Label Only

Even with just a label, MIA is still possible (harder, but not impossible). More importantly, in PPRL you need to know how similar two records are — a binary “match / non-match” loses critical information.

Real Defences

  • Differential privacy during training
  • Output perturbation (adding noise to confidence scores)
  • Restricting output detail (label only where possible)
  • Limiting query rates

MIA against Text Linkage Model

 Detail
InputFree-text mentor feedback (sequence of words)
OutputCategorical label (feedback classification)

Standard MIA definitions may not work well here — free-text input requires a looser/relaxed definition of MIA.

Three Black-box MIA Approaches

AttackMethodComplexity
Shadow model (Shokri et al., 2017)Trains multiple shadow models to mimic targetHigh
Prediction loss (Yeom et al., 2018)Low loss → likely memberModerate
Max confidence (Salem et al., 2018)High confidence → likely memberLow

Shadow Model-based MIA

Shadow Model MIA

The attacker creates fake versions (shadow models) of the target model to learn how it behaves.

Step-by-Step

Step 1: Target model trained on private data D_min — the attacker cannot see inside it.

Step 2: Attacker trains k shadow models on similar but different data to mimic the target.

Step 3: For each shadow model, the attacker labels outputs as member (M) or non-member (NM).

Step 4: All labelled outputs train the attack model f_attack.

1
2
3
4
5
6
7
8
9
Shadow models learn to mimic target model
        ↓
Generate M / NM labelled predictions
        ↓
Train f_attack on those labels
        ↓
Apply f_attack to the real target model
        ↓
Determine: Member or Non-Member? 🔍

Analogy: Like practising on past exam papers to learn the examiner’s patterns, then applying that knowledge to the real exam.

Shadow Model Detail


Experiments: MIA with Standard Input Space (CIFAR-10)

DetailValue
DatasetCIFAR-10 image dataset
Data size6,000 images, 10 classes
Image size32×32 pixels (RGB)
ModelLogistic regression
AttacksThreshold-based + Shadow model-based

ROC Curve CIFAR-10

AttackAUC
Threshold-based0.690
Shadow model-based0.700

Both attacks are meaningfully better than random guessing (AUC = 0.5), confirming that even a simple logistic regression on image data leaks membership information.


Experiments: MIA with Free-text Input Space

ROC Curve Free-text

DetailValue
DatasetFree-text mentor feedback
Pre-processingRemove stop words + lemmatise
RepresentationBag of Words (2,233 BoWs)
Labels5 categories (outstanding → poor)
ModelLogistic regression

Result: AUC = 0.56 — barely better than random guessing.

Why is the AUC So Much Lower Than CIFAR-10?

  1. High dimensionality — 2,233 sparse BoW features vs clean RGB pixels
  2. More variability — people write feedback many different ways → less overfitting
  3. 5 output classes — confidence scores more spread out, harder to exploit
SettingAttackAUC
CIFAR-10Threshold0.690
CIFAR-10Shadow model0.700
Free-text (large)Shadow model0.560

Experiments: Free-text MIA (Small Dataset, Overfitting)

Overfitting MIA

DetailValue
DatasetSmall free-text feedback (1,633 BoWs)
ModelANN classifier
SettingAUC
More overfitting0.795
Less overfitting0.776

Why Does Overfitting Make MIA Easier?

1
2
3
4
5
6
Overfitted model:
  Members   →  Very high confidence, very low loss
  Non-members →  Much lower confidence, higher loss

More overfitting  →  Bigger gap  →  AUC 0.795 (easier to attack)
Less overfitting  →  Smaller gap →  AUC 0.776 (slightly harder)

Reducing overfitting (regularisation, dropout, early stopping) is an effective privacy defence as well as good ML practice!


Experiments: Free-text MIA (Multiple Shadow Models)

Multiple Shadow Models

Number of shadow modelsAUC
10 shadow models0.776
5 shadow models0.747

More shadow models → more diverse training data for the attack model → higher AUC.

Full Summary of Free-text Experiments

SettingAUC
Large dataset, logistic regression0.560
Small dataset, less overfitting, 10 shadow models0.776
Small dataset, more overfitting, 10 shadow models0.795
Small dataset, less overfitting, 5 shadow models0.747

Three Key Factors That Increase MIA Vulnerability

  1. Smaller dataset → more overfitting → easier to attack
  2. More overfitting → bigger gap between member/non-member behaviour → easier to attack
  3. More shadow models → better trained attack model → easier to attack
This post is licensed under CC BY 4.0 by the author.