Distilled MLP for post-merge CRDT re-identification risk prediction. Takes merged graph state from two edge devices and predicts whether the combined PHI exposure crosses the retokenization threshold, including cases where neither device would have escalated independently.
No dependencies beyond Python standard library. Runs anywhere. Weights are 22KB.
The problem this solves
In a federated clinical deployment, device A might process a patient's text notes while device B handles audio transcripts and imaging metadata. Each device runs de-identification independently and applies masking based on its local risk score. Neither device can see the other's data.
After a CRDT merge, the combined graph may reveal cross-modal linkage that neither device detected alone. A patient whose text risk was 0.31 and whose audio risk was 0.28 might have a merged risk of 0.74. Neither device would have escalated. The merged state demands it.
This model is the inference component for that scenario. It takes the merged node state and predicts merged risk and retokenization probability without any raw PHI leaving either device.
Performance
Trained on 8,000 synthetic CRDT merge scenarios, evaluated on 2,000.
Metric
Value
Risk MAE
0.033
Retok accuracy
97.4%
Invisible-pre-merge recall
90.5%
n_invisible (test set)
315
Invisible-pre-merge recall is the metric that matters most here. It measures how often the model correctly triggers retokenization on cases where cross-modal linkage is only visible after the merge: both pre-merge device risks were at or below the 0.55 threshold, but the merged risk crossed it. 90.5% recall on 315 such cases in the test set.
Architecture
Student MLP distilled from CRDTGraph.risk_for() and threshold logic in dcpg_crdt.py.
CRDT merged state (53 features)
|
Linear 53->64 + ReLU
|
Linear 64->32 + ReLU
|
Linear 32->2 + Sigmoid
|
[risk_score, retok_prob]
The full training script is in train_fedcrdt.py. It generates synthetic CRDT merge scenarios from the same teacher logic as dcpg_crdt.py, trains the MLP, and saves model_weights.bin and train_metrics.json.
bash
1pip install numpy
2python train_fedcrdt.py
Related
phi-exposure-guard: full system with CRDT federation, PPO agent, and adaptive masking pipeline