Text Classification
Transformers
ONNX
Safetensors
multilingual
xlm-roberta
privacy
pii-detection
text-embeddings-inference
Files changed (1) hide show
  1. README.md +106 -0
README.md ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language: multilingual
4
+ tags:
5
+ - privacy
6
+ - pii-detection
7
+ - text-classification
8
+ - xlm-roberta
9
+ library_name: transformers
10
+ base_model: FacebookAI/xlm-roberta-large
11
+ datasets:
12
+ - Roblox/roblox-pii-safety-for-chat-benchmark
13
+ - ai4privacy/pii-masking-openpii-1.5m
14
+ - nvidia/Nemotron-PII
15
+ ---
16
+
17
+ # Roblox PII Classifier v2.0 — Model Card
18
+
19
+ ## Overview
20
+ We present `Roblox/roblox-pii-classifier-v2`, an upgraded, context-aware PII (Personally Identifiable Information) detection model. Built on the [XLM-RoBERTa-Large](https://huggingface.co/xlm-roberta-large) architecture, v2 is designed to identify attempts to share or solicit personal information across complex, multi-user conversations.
21
+
22
+ Unlike its predecessor and other NER models, **v2 evaluates text within its surrounding conversational context**, allowing it to detect sophisticated, adversarial bypass attempts (e.g., collaborative PII exchange, phonetic spelling, implicit references) while drastically reducing false positives. It is intended for use in casual conversations, ensuring freedom of speech while also maintaining safety.
23
+
24
+ ## What’s New in v2.0?
25
+
26
+ * **Conversational Context Integration:** Evaluates target messages within the broader multi-user chat context, eliminating ambiguity inherent in isolated messages.
27
+ * **Massive Multilingual Expansion:** Broadened synthetic data generation and fine-tuning capabilities to expand language coverage from **17 to 189 languages**.
28
+ * **Automated Red-Teaming & Clustering:** Applied automated adversarial red-teaming and cluster visualization to systematically surface, isolate, and patch model vulnerabilities.
29
+ * **Significant Performance Leap:** Overall F1 score increased from **63.41% to 90.52%** on our refreshed internal evaluation set, with a f1 score increase from **64.74% to 88.78%** on the recently released roblox-pii-safety-for-chat-benchmark.
30
+
31
+ ## Model Architecture & Classification Scope
32
+
33
+ **Input Format:** A single pre-formatted string containing a fixed instruction
34
+ prefix followed by the target message and its surrounding multi-turn chat
35
+ history. Speakers are anonymized — the speaker under evaluation is always `t`,
36
+ and all other participants are mapped to `s1`, `s2`, … in order of first
37
+ appearance. Turns are joined with ` </s> `:
38
+
39
+ ```
40
+ Instruct: In the following chat messages from target speaker t and possibly other speakers s1, s2, etc., detect abuse by speaker t.
41
+ Query:
42
+
43
+ t: {text} </s> s1: {text} </s> t: {text}
44
+ ```
45
+
46
+ Tokenized with the XLM-RoBERTa SentencePiece tokenizer to a **fixed 512
47
+ tokens**, `padding="max_length"`, `truncation=True`, and — critically —
48
+ **`truncation_side="left"`**, so that when history overflows the window the
49
+ *oldest* turns are dropped and the latest target message is retained.
50
+
51
+ **Outputs:**
52
+ The model performs multi-label classification scores obtained by applying an
53
+ **element-wise sigmoid** to the logits across three PII categories,
54
+ emitted in this fixed index order:
55
+
56
+ | Index | Label | Threshold Recommendation | Definition |
57
+ |---|---|---|---|
58
+ | 0 | **`privacy_asking_for_pii`** | 0.60 | Attempts to obtain personal identifying information via direct or implicit methods. |
59
+ | 1 | **`privacy_giving_pii`** | 0.55 | Sharing PII — including phone numbers, email addresses, government IDs, social media handles, and credentials. |
60
+ | 2 | **`directing_users_off_platform`** | 0.10 | Attempting to move a user off-platform to external apps, services, or websites. |
61
+
62
+ ## Benchmark Comparisons
63
+
64
+ The table below illustrates best f1 performance across internal and open-source evaluation benchmarks (full conversational data used when possible):
65
+
66
+ | Dataset / Benchmark | Roblox PII v2 | *Roblox PII v1 | *OpenAI Privacy Filter | *GLiNER2 | Qwen3Guard Gen 8B | LlamaGuard v3 1B | LlamaGuard v3 8B | LlamaGuard v4 12B | NemoGuard 8B | *Piiranha NER | Shieldstral |
67
+ | :--- | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
68
+ | **roblox-pii-safety-for-chat** | **88.82%** | 64.69% | 58.16% | 54.50% | 66.24% | 27.89% | 56.24% | 54.56% | 56.52% | 58.34% | 57.84% |
69
+ | **Roblox Internal Evaluation** | **90.52%** | 63.41% | 20.98% | 28.21% | 15.62% | 8.59% | 12.90% | 21.92% | 14.77% | 20.98% | 31.87 |
70
+ | **Nemotron-PII** | **99.22%** | 70.07% | 65.22% | 62.92% | 37.46% | 53.32% | 46.07% | 35.05% | 56.16% | 68.52% | 56.69 |
71
+ | **PII Masking OpenPII 1.5M** | **99.76%** | 86.79% | 84.23% | 83.07% | 61.94% | 65.10% | 64.23% | 56.16% | 54.01% | 86.35% | 85.33 |
72
+
73
+ \* These models all were supplied with only the target-user text as other speaker texts are meant to be supplemental contextual information. roblox-pii-classifier-v2 performs best when supplied with conversational context, however it still outperforms roblox-pii-classifier when supplied only with target-user text.
74
+
75
+
76
+ ## Usage
77
+ Install the inference dependencies:
78
+ ```bash
79
+ pip install -r requirements.txt
80
+ ```
81
+
82
+ For a single message, pass the raw text. `inference.py` treats it as one turn
83
+ from the target speaker `t` and adds the required instruction prefix
84
+ automatically:
85
+
86
+ ```bash
87
+ python inference.py --model-path . \
88
+ --text "add me on Discord, my username is skyfox_4821"
89
+ ```
90
+
91
+ For conversational inference, create a UTF-8 JSON file containing a list of
92
+ turns. The speaker whose behavior should be classified **must** be named `t`.
93
+ Other speaker names may be arbitrary; the formatter anonymizes them to `s1`,
94
+ `s2`, and so on in order of first appearance.
95
+
96
+ ```bash
97
+ cat > conversation.json <<'JSON'
98
+ [
99
+ {"speaker": "alice", "text": "how can I contact you?"},
100
+ {"speaker": "t", "text": "add me on Discord, my username is skyfox_4821"},
101
+ {"speaker": "alice", "text": "okay, got it"}
102
+ ]
103
+ JSON
104
+
105
+ python inference.py --model-path . --input-file conversation.json
106
+ ```