xlm_roberta_yalen โ€” PII Detector (IBAN ยท CARD ยท PHONE ยท EMAIL ยท DATE)

Fine-tuned version of xlm-roberta-base for PII (Personally Identifiable Information) detection with focus on financial and contact data.

Developed by Yalen AI as part of the Yalen Sentinel Pulse privacy protection platform.


Model Description

This model performs Named Entity Recognition (NER) to detect sensitive personal and financial information in text. It uses BIO tagging (Begin / Inside / Outside) and supports multilingual input, with strong performance on French, English, and Tunisian Arabic-Latin mixed text.

Detected Entities

Label Description Examples
IBAN International Bank Account Number TN59 1000 6035 1835 9848 3270, FR76 3000 6000 0112...
CARD Credit / Debit card number 4532 1234 5678 9012, 5412 7534 2589 6315
PHONE Phone number (international formats) +216 23 456 789, 0023 4567890
EMAIL Email address support@yalen.tn, ahmed.ben@gmail.com
DATE Date (any format) 15/03/2025, 14 janvier 1990, 12/2028

Quick Start

from transformers import pipeline

ner = pipeline(
    "ner",
    model="yalen-ai/xlm_roberta_yalen",
    aggregation_strategy="simple"
)

text = "Contact: support@yalen.tn | Tel: +216 23 456 789 | IBAN: TN59 1000 6035 1835 9848 3270"
results = ner(text)

for entity in results:
    print(f"[{entity['entity_group']}] '{entity['word']}' (score: {entity['score']:.3f})")

Output:

[EMAIL] 'support@yalen.tn' (score: 1.000)
[PHONE] '+216 23 456 789' (score: 1.000)
[IBAN] 'TN59 1000 6035 1835 9848 3270' (score: 1.000)

Installation

pip install transformers torch

Usage Examples

Detect all PII in a document

from transformers import pipeline

ner = pipeline("ner", model="yalen-ai/xlm_roberta_yalen", aggregation_strategy="simple")

examples = [
    "Rendez-vous le 15/03/2025, contactez ahmed.ben@gmail.com",
    "Carte bancaire: 4532 1234 5678 9012, expire 12/2028",
    "Virement IBAN FR76 3000 6000 0112 3456 7890 189",
    "Appelez le +216 98 765 432 ou +33 1 23 45 67 89",
]

for text in examples:
    print(f"\nTexte: {text}")
    for e in ner(text):
        print(f"  [{e['entity_group']}] {e['word'].strip('.,;')} ({e['score']:.3f})")

Post-processing tip

The tokenizer may include trailing punctuation in detected spans. Clean it up:

def clean_entity(word: str) -> str:
    return word.strip(".,;:!? ")

results = ner("Email: contact@yalen.tn, Tel: +216 23 000 000")
cleaned = [{**e, "word": clean_entity(e["word"])} for e in results]

With explicit label mapping

from transformers import AutoTokenizer, AutoModelForTokenClassification
import torch

tokenizer = AutoTokenizer.from_pretrained("yalen-ai/xlm_roberta_yalen")
    model = AutoModelForTokenClassification.from_pretrained("yalen-ai/xlm_roberta_yalen")

text = "IBAN: TN59 1000 6035 1835 9848 3270"
inputs = tokenizer(text, return_tensors="pt")
with torch.no_grad():
    outputs = model(**inputs)

predictions = torch.argmax(outputs.logits, dim=2)
tokens = tokenizer.convert_ids_to_tokens(inputs["input_ids"][0])
labels = [model.config.id2label[p.item()] for p in predictions[0]]

for token, label in zip(tokens, labels):
    if label != "O":
        print(f"{token:20} โ†’ {label}")

Model Architecture

Parameter Value
Base model xlm-roberta-base
Architecture XLMRobertaForTokenClassification
Hidden size 768
Attention heads 12
Hidden layers 12
Max tokens 512
Vocab size 250,002
Labels 11 (O + 5ร—BIO)
Model size ~1.06 GB

Label Map

{
  "0": "O",
  "1": "B-IBAN",  "2": "I-IBAN",
  "3": "B-CARD",  "4": "I-CARD",
  "5": "B-PHONE", "6": "I-PHONE",
  "7": "B-EMAIL", "8": "I-EMAIL",
  "9": "B-DATE",  "10": "I-DATE"
}

Intended Use

  • Privacy compliance (GDPR, Tunisian Data Protection Law)
  • Document redaction โ€” anonymize sensitive documents before sharing
  • Data loss prevention (DLP) โ€” detect accidental PII leaks in logs or messages
  • Financial document processing โ€” extract IBAN/card numbers for validation
  • Healthcare & insurance โ€” detect dates and contact information

Limitations

  • Maximum input length: 512 tokens (long documents should be split by sentence or paragraph)
  • Trained primarily on French and English data โ€” performance may vary on other languages
  • Card number detection works best with standard spacing formats (XXXX XXXX XXXX XXXX)
  • Trailing punctuation may be included in token spans โ€” apply post-processing (.strip(".,;"))

About Yalen AI

Yalen Sentinel Pulse is an AI-powered platform for PII detection and data privacy protection, developed by the Yalen AI team. It combines regex patterns, ML models, and NER to provide comprehensive sensitive data identification.

  • ๐ŸŒ Platform: Yalen Sentinel Pulse
  • ๐Ÿ“ง Contact: hello@yalen.ai

License

MIT โ€” free for commercial and research use.

Downloads last month
6
Safetensors
Model size
0.3B params
Tensor type
F32
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Evaluation results