gretelai/synthetic_pii_finance_multilingual
Viewer • Updated • 55.9k • 3.26k • 83
Linear-chain Conditional Random Field (CRF) baseline trained with L-BFGS ($c_1=0.25, c_2=0.1$) to detect Personally Identifiable Information (PII) in financial texts (contracts, SWIFT messages, invoices) using window-based hand-crafted features ($\pm 2$ window, prefixes/suffixes, shapes) and learned state transitions.
gretelai/synthetic_pii_finance_multilingual (30,545 training chunks, 17 BIO tags across 8 PII categories).| chunks | entity micro-F1 | token macro-F1 | entity precision | entity recall | missed PII rate |
|---|---|---|---|---|---|
| 3,903 | 0.8221 | 0.7551 | 0.8586 | 0.7887 | 21.1% |
| PHONE | ADDRESS | DATE | NAME | ID | COMPANY | ACCOUNT | |
|---|---|---|---|---|---|---|---|
| 0.9412 | 0.8814 | 0.8638 | 0.8464 | 0.8314 | 0.7844 | 0.7395 | 0.7138 |
Trained with sklearn-crfsuite, scikit-learn==1.9.1, and joblib. Because .joblib model artifacts depend on specific internal module structures and C-extensions, match the environment versions to prevent load errors:
pip install sklearn-crfsuite scikit-learn==1.9.1 joblib seqeval
## Use
```python
import joblib
from huggingface_hub import hf_hub_download
from features import sentence_features
# Download and load model artifact
model_path = hf_hub_download(repo_id="elifsudayi/crf-ner", filename="crf.joblib")
model = joblib.load(model_path)
# Example inference on financial text
tokens = ["Please", "transfer", "$500", "to", "John", "Doe", "IBAN", "DE89370400440532013000"]
features = sentence_features(tokens)
predictions = model.predict_single(features)
print(list(zip(tokens, predictions)))
# [('Please', 'O'), ('transfer', 'O'), ('$500', 'O'), ('to', 'O'), ('John', 'B-NAME'), ('Doe', 'I-NAME'), ('IBAN', 'O'), ('DE89370400440532013000', 'B-ACCOUNT')]