V11 is the 15th iteration of this model, trained on 41,427 samples (up from 24,012 in V7c). Key improvements:
This model classifies whether a message contains an intent to share personal contact information (phone numbers, emails, social media handles, IBANs, etc.) or not. Unlike simple regex-based PII detection, this model understands context and intent:
1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2import torch
3import torch.nn.functional as F
4
5model_name = "gorkem371/pii-intent-classifier-xlmr-large"
6tokenizer = AutoTokenizer.from_pretrained(model_name)
7model = AutoModelForSequenceClassification.from_pretrained(model_name)
8model.eval()
9
10def classify_pii(context: str, entity: str, entity_type: str) -> dict:
11 """
12 Classify whether a message contains PII sharing intent.
13
14 Args:
15 context: The full message text
16 entity: The specific entity to classify (e.g., phone number, "NONE" if implicit)
17 entity_type: Type of entity (PHONE, EMAIL, SOCIAL_MEDIA, IBAN, ADDRESS, URL, etc.)
18
19 Returns:
20 dict with 'is_pii' (bool) and 'confidence' (float)
21 """
22 text = f"{context} </s> {entity} | {entity_type}"
23 inputs = tokenizer(text, max_length=256, padding="max_length", truncation=True, return_tensors="pt")
24
25 with torch.no_grad():
26 outputs = model(**inputs)
27 probs = F.softmax(outputs.logits, dim=-1)
28 pred = torch.argmax(probs, dim=-1).item()
29 confidence = probs[0][pred].item()
30
31 return {
32 "is_pii": pred == 1,
33 "label": "PII" if pred == 1 else "NOT_PII",
34 "confidence": round(confidence, 4)
35 }
36
37# Examples
38print(classify_pii("my number is 05321234567 call me", "05321234567", "PHONE"))
39# {'is_pii': True, 'label': 'PII', 'confidence': 0.9987}
40
41print(classify_pii("order number is ORD-784321", "ORD-784321", "PHONE"))
42# {'is_pii': False, 'label': 'NOT_PII', 'confidence': 0.9954}
43
44print(classify_pii("i will send you my whatsapp tomorrow", "NONE", "PHONE"))
45# {'is_pii': True, 'label': 'PII', 'confidence': 0.9821}
46
47print(classify_pii("oda numaram 532 otelde buluşalım", "NONE", "PHONE"))
48# {'is_pii': False, 'label': 'NOT_PII', 'confidence': 0.9876}
1@misc{pii-intent-classifier-2026,
2 title={PII Intent Classifier: Multilingual Context-Aware PII Detection},
3 author={Gorkem Yildiz},
4 year={2026},
5 url={https://huggingface.co/gorkem371/pii-intent-classifier-xlmr-large},
6 howpublished={\url{https://gorkemyildiz.com}}
7}