加载中…
加载中…
Token classification model of Alias: it finds the personal
data in a French or English text so it can be masked before the text goes to an LLM. Fine-tuned
from jhu-clsp/mmBERT-small; in Alias it runs together with rules (checksums and keywords).
BIO tags over eight types: PERSON, ADDRESS, EMAIL, PHONE, IBAN, NATIONAL_ID (French
NIR, US SSN, UK NINO), BIRTH_DATE, IDENTIFIER (a person's file, contract or customer number).
Company names, company addresses, switchboards and invoice numbers are not labelled. Long texts
are read in windows of 512 tokens overlapping by 128.
Synthetic and public only, no real personal data:
PERSON;synthetic_pii_finance_multilingual (Apache-2.0), French and English.3 epochs, learning rate 3e-5, batch 16, windows of 512 tokens (alias_pii.train). Chosen among
three candidates (mmBERT-small, XLM-RoBERTa base, mDeBERTa-v3 base) by a rule written before
training (docs/TRAINING.md in the repository).
| Set | Precision | Recall | Leak rate |
|---|---|---|---|
| Synthetic test split (4,200 documents, read once) | 0.970 | 0.980 | 1.1 % |
| 200 documents written by an LLM absent from training | 0.94 | 0.93 | 3.5 % |
Strict precision and recall (label and both boundaries); leak rate: share of personal values still readable in full after masking. Not measured on real documents yet. CPU, unquantised: about one second per 3,000-character page on 4 cores. Dynamic int8 quantisation destroys its precision.
# pip install "alias-pii[model] @ git+https://github.com/gabrielkpo/alias"
from huggingface_hub import snapshot_download
from alias_pii.detector import RulesAndModel
from alias_pii.masking import mask
detector = RulesAndModel.from_checkpoint(snapshot_download("Gabrielkph/alias-mmbert-small"))
print(mask("Écrire à Jean Dupont, 14 rue des Lilas, 69003 Lyon.", detector).text)
jhu-clsp/mmBERT-small