Update README.md
Browse files
README.md
CHANGED
@@ -1,199 +1,256 @@
|
|
1 |
---
|
2 |
library_name: transformers
|
3 |
-
tags:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
---
|
5 |
|
6 |
-
|
7 |
|
8 |
-
|
9 |
|
|
|
10 |
|
11 |
|
12 |
## Model Details
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
-
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
|
19 |
|
20 |
-
|
21 |
-
- **Funded by [optional]:** [More Information Needed]
|
22 |
-
- **Shared by [optional]:** [More Information Needed]
|
23 |
-
- **Model type:** [More Information Needed]
|
24 |
-
- **Language(s) (NLP):** [More Information Needed]
|
25 |
-
- **License:** [More Information Needed]
|
26 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
27 |
|
28 |
-
|
29 |
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
-
- **Repository:** [More Information Needed]
|
33 |
-
- **Paper [optional]:** [More Information Needed]
|
34 |
-
- **Demo [optional]:** [More Information Needed]
|
35 |
|
36 |
## Uses
|
37 |
|
38 |
-
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
39 |
-
|
40 |
### Direct Use
|
41 |
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
|
48 |
-
|
49 |
-
|
50 |
-
[More Information Needed]
|
51 |
|
52 |
### Out-of-Scope Use
|
53 |
|
54 |
-
|
|
|
|
|
|
|
|
|
55 |
|
56 |
-
|
57 |
|
58 |
## Bias, Risks, and Limitations
|
59 |
|
60 |
-
|
|
|
|
|
|
|
|
|
|
|
61 |
|
62 |
-
[More Information Needed]
|
63 |
|
64 |
### Recommendations
|
65 |
|
66 |
-
|
67 |
|
68 |
-
|
|
|
|
|
|
|
|
|
|
|
69 |
|
70 |
## How to Get Started with the Model
|
71 |
|
72 |
-
Use the code below to
|
|
|
|
|
|
|
73 |
|
74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
|
76 |
## Training Details
|
77 |
|
78 |
### Training Data
|
79 |
|
80 |
-
|
81 |
|
82 |
-
|
|
|
|
|
|
|
|
|
83 |
|
84 |
-
|
85 |
|
86 |
-
|
87 |
|
88 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
|
90 |
-
[More Information Needed]
|
91 |
|
92 |
|
93 |
#### Training Hyperparameters
|
94 |
|
95 |
-
- **Training regime:**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
|
97 |
-
|
98 |
|
99 |
-
|
100 |
|
101 |
-
|
|
|
|
|
|
|
102 |
|
103 |
-
|
104 |
|
105 |
-
|
106 |
|
107 |
### Testing Data, Factors & Metrics
|
108 |
|
109 |
#### Testing Data
|
110 |
|
111 |
-
|
112 |
|
113 |
-
|
114 |
|
115 |
-
|
|
|
|
|
|
|
116 |
|
117 |
-
|
|
|
|
|
118 |
|
119 |
-
|
|
|
120 |
|
121 |
-
#### Metrics
|
122 |
|
123 |
-
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
124 |
|
125 |
-
|
126 |
|
127 |
-
|
|
|
|
|
|
|
128 |
|
129 |
-
|
130 |
|
131 |
-
|
132 |
|
|
|
133 |
|
|
|
|
|
134 |
|
135 |
-
|
136 |
|
137 |
-
|
138 |
|
139 |
-
|
|
|
|
|
140 |
|
141 |
-
|
142 |
|
143 |
-
|
144 |
|
145 |
-
|
146 |
|
147 |
-
-
|
148 |
-
- **Hours used:** [More Information Needed]
|
149 |
-
- **Cloud Provider:** [More Information Needed]
|
150 |
-
- **Compute Region:** [More Information Needed]
|
151 |
-
- **Carbon Emitted:** [More Information Needed]
|
152 |
|
153 |
-
## Technical Specifications [optional]
|
154 |
|
155 |
### Model Architecture and Objective
|
156 |
|
157 |
-
|
158 |
|
159 |
-
|
160 |
|
161 |
-
|
162 |
|
163 |
#### Hardware
|
164 |
|
165 |
-
|
|
|
|
|
166 |
|
167 |
#### Software
|
168 |
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
|
|
174 |
|
175 |
-
|
176 |
-
|
177 |
-
[More Information Needed]
|
178 |
-
|
179 |
-
**APA:**
|
180 |
-
|
181 |
-
[More Information Needed]
|
182 |
-
|
183 |
-
## Glossary [optional]
|
184 |
-
|
185 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
186 |
-
|
187 |
-
[More Information Needed]
|
188 |
-
|
189 |
-
## More Information [optional]
|
190 |
-
|
191 |
-
[More Information Needed]
|
192 |
-
|
193 |
-
## Model Card Authors [optional]
|
194 |
-
|
195 |
-
[More Information Needed]
|
196 |
|
197 |
## Model Card Contact
|
198 |
|
199 |
-
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
library_name: transformers
|
3 |
+
tags:
|
4 |
+
- pii
|
5 |
+
- ner
|
6 |
+
- asr
|
7 |
+
- redaction
|
8 |
+
- privacy
|
9 |
+
- lexguard
|
10 |
+
- xlm-roberta
|
11 |
+
- multilingual
|
12 |
+
- huggingface
|
13 |
+
- token-classification
|
14 |
+
license: apache-2.0
|
15 |
+
language:
|
16 |
+
- en
|
17 |
+
- hi
|
18 |
+
metrics:
|
19 |
+
- seqeval
|
20 |
+
base_model:
|
21 |
+
- FacebookAI/xlm-roberta-base
|
22 |
---
|
23 |
|
24 |
+
[](https://huggingface.co/sanskxr02/zentrypii-278m)
|
25 |
|
26 |
+
# ZentryPII-278M – A LexGuard Model
|
27 |
|
28 |
+
ZentryPII-278M is a multilingual token classification model fine-tuned to identify and redact personally identifiable information (PII) — such as names, locations, and time expressions — from noisy, ASR-style transcripts in English and Hindi. Built on top of XLM-RoBERTa-base, it is designed to serve as the redaction engine for LexGuard’s privacy-preserving speech-to-text workflows.
|
29 |
|
30 |
|
31 |
## Model Details
|
32 |
|
33 |
+
- **Model Name:** ZentryPII-278M
|
34 |
+
- **Architecture:** XLM-RoBERTa-base
|
35 |
+
- **Parameters:** ~278M
|
36 |
+
- **Task:** Token Classification (NER-style)
|
37 |
+
- **Labels:** B-NAME, B-LOC, B-TIME, O
|
38 |
+
- **Languages:** English, Hindi
|
39 |
+
- **Training Dataset:** Synthetic ASR-style BIO-labeled dataset (~1,000 samples)
|
40 |
+
- **Fine-tuning Epochs:** 5
|
41 |
+
- **Framework:** Hugging Face Transformers
|
42 |
+
- **Developer:** LexGuard
|
43 |
|
|
|
44 |
|
45 |
+
### Model Description
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
|
47 |
+
ZentryPII-278M is a multilingual token classification model developed by LexGuard to detect and redact personally identifiable information (PII) from noisy automatic speech recognition (ASR) outputs. It is fine-tuned on synthetic ASR-style transcripts that include disfluencies, Hindi-English code-switching, and real-world conversational patterns.
|
48 |
|
49 |
+
- **Developed by:** [LexGuard]
|
50 |
+
- **Funded by [optional]:** LexGuard
|
51 |
+
- **Shared by [optional]:** Sanskar Pandey
|
52 |
+
- **Model type:** Token Classification (NER)
|
53 |
+
- **Language(s) (NLP):** English, Hindi
|
54 |
+
- **License:** Apache 2.0
|
55 |
|
|
|
|
|
|
|
56 |
|
57 |
## Uses
|
58 |
|
|
|
|
|
59 |
### Direct Use
|
60 |
|
61 |
+
ZentryPII-278M is intended for direct use in redacting PII from ASR transcripts across multilingual, informal, or code-switched contexts. Users can apply it to:
|
62 |
+
- Transcribed audio from customer support calls
|
63 |
+
- Patient interviews and medical notes
|
64 |
+
- Legal and financial voice dictations
|
65 |
+
- Internal company meetings
|
66 |
|
67 |
+
It can be used via Hugging Face pipelines or as part of a preprocessing module in privacy-sensitive workflows.
|
|
|
|
|
68 |
|
69 |
### Out-of-Scope Use
|
70 |
|
71 |
+
This model is not intended for:
|
72 |
+
- Document-level NER on structured or formal text (e.g. PDFs, contracts)
|
73 |
+
- Coreference resolution or full conversational entity linking
|
74 |
+
- Real-time inference in low-resource, on-device settings without optimization
|
75 |
+
- Use in adversarial or surveillance applications that violate user privacy
|
76 |
|
77 |
+
---
|
78 |
|
79 |
## Bias, Risks, and Limitations
|
80 |
|
81 |
+
- **Cultural and spelling bias:** Model was trained on synthetic English-Hindi examples and may underperform on other dialects or spelling variations.
|
82 |
+
- **Disfluency confusion:** In very noisy ASR outputs, model may struggle to distinguish PII from filler or background phrases.
|
83 |
+
- **False positives/negatives:** Names that are also common nouns (e.g. "Rose", "Paris") may be missed or over-flagged.
|
84 |
+
- **No anonymization guarantees:** While helpful, the model does not provide cryptographic or legal guarantees for PII anonymization.
|
85 |
+
|
86 |
+
Always verify redacted output before deployment in sensitive or regulated environments.
|
87 |
|
|
|
88 |
|
89 |
### Recommendations
|
90 |
|
91 |
+
Users should be aware that ZentryPII-278M is optimized for ASR-style conversational input in English and Hindi. It should not be relied on as a sole mechanism for PII redaction in legally regulated environments. We recommend:
|
92 |
|
93 |
+
- Reviewing model output manually in high-risk domains such as healthcare or law
|
94 |
+
- Avoiding use in languages or dialects beyond those it was trained on
|
95 |
+
- Augmenting the model with rule-based fallback mechanisms for edge cases
|
96 |
+
- Retraining or fine-tuning on domain-specific data when applying to new use cases
|
97 |
+
|
98 |
+
---
|
99 |
|
100 |
## How to Get Started with the Model
|
101 |
|
102 |
+
Use the code snippet below to run the model using 🤗 Transformers:
|
103 |
+
|
104 |
+
```python
|
105 |
+
from transformers import AutoTokenizer, AutoModelForTokenClassification, pipeline
|
106 |
|
107 |
+
model = AutoModelForTokenClassification.from_pretrained("sanskxr02/zentrypii-278m")
|
108 |
+
tokenizer = AutoTokenizer.from_pretrained("sanskxr02/zentrypii-278m")
|
109 |
+
|
110 |
+
ner = pipeline("ner", model=model, tokenizer=tokenizer, aggregation_strategy="simple")
|
111 |
+
|
112 |
+
output = ner("i met rohit near connaught place at three thirty")
|
113 |
+
for ent in output:
|
114 |
+
print(f"{ent['word']} → {ent['entity_group']}")
|
115 |
|
116 |
## Training Details
|
117 |
|
118 |
### Training Data
|
119 |
|
120 |
+
The training data for ZentryPII-278M consists of a synthetic dataset of ~1,000 conversational, ASR-style utterances constructed using name, location, and time expression templates. These examples were generated to reflect realistic speech patterns, disfluencies (e.g., "um", "haan", "like"), and English-Hindi code-switching.
|
121 |
|
122 |
+
Each sentence was tokenized and annotated with BIO-style labels:
|
123 |
+
- `B-NAME`: Names (e.g., Ramesh, Neha)
|
124 |
+
- `B-LOC`: Locations (e.g., Mumbai, Connaught Place)
|
125 |
+
- `B-TIME`: Time references (e.g., three thirty, Sunday morning)
|
126 |
+
- `O`: Non-PII tokens
|
127 |
|
128 |
+
The dataset is not publicly released as a standalone resource, but was generated specifically to fine-tune ZentryPII on redaction-style PII tagging in noisy, multilingual text.
|
129 |
|
130 |
+
### Training Procedure
|
131 |
|
132 |
+
- **Model used:** `xlm-roberta-base`
|
133 |
+
- **Objective:** Token classification using cross-entropy loss
|
134 |
+
- **Training Framework:** Hugging Face Transformers (Trainer API)
|
135 |
+
- **Epochs:** 5
|
136 |
+
- **Train/Test Split:** 90/10 stratified at sentence level
|
137 |
+
- **Batch size:** 8
|
138 |
+
- **Optimizer:** AdamW
|
139 |
+
- **Hardware:** Google Colab T4 (free tier)
|
140 |
+
- **Eval Metric:** Token-level accuracy and `seqeval` loss
|
141 |
+
- **Final Eval Loss:** ~3.26e-05
|
142 |
|
|
|
143 |
|
144 |
|
145 |
#### Training Hyperparameters
|
146 |
|
147 |
+
- **Training regime:** fp32
|
148 |
+
- **Learning rate scheduler:** linear with warmup
|
149 |
+
- **Weight decay:** 0.01
|
150 |
+
- **Warmup steps:** 0
|
151 |
+
- **Gradient clipping:** None
|
152 |
+
- **Evaluation strategy:** after each epoch
|
153 |
+
- **Save strategy:** every 500 steps
|
154 |
+
- **Logging:** every 10 steps
|
155 |
+
- **Seed:** 42
|
156 |
|
157 |
+
---
|
158 |
|
159 |
+
#### Speeds, Sizes, Times
|
160 |
|
161 |
+
- **Total training time:** ~20 minutes on Google Colab (T4 GPU)
|
162 |
+
- **Final checkpoint size:** ~1.06 GB
|
163 |
+
- **Throughput:** ~39 samples/sec on evaluation
|
164 |
+
- **Evaluation runtime:** ~2.55 seconds
|
165 |
|
166 |
+
---
|
167 |
|
168 |
+
## Evaluation
|
169 |
|
170 |
### Testing Data, Factors & Metrics
|
171 |
|
172 |
#### Testing Data
|
173 |
|
174 |
+
The held-out test set (~10% of training data) was sampled from the synthetic BIO-tagged dataset used for training. It includes ASR-style sentences with varied disfluencies and code-switching examples in Hindi-English.
|
175 |
|
176 |
+
Evaluation was performed using Hugging Face’s `Trainer.evaluate()` API on token-level classification.
|
177 |
|
178 |
+
**Entity types evaluated:**
|
179 |
+
- `B-NAME`
|
180 |
+
- `B-LOC`
|
181 |
+
- `B-TIME`
|
182 |
|
183 |
+
**Metrics used:**
|
184 |
+
- `eval_loss` (cross-entropy)
|
185 |
+
- [planned: `seqeval` F1-score in future update]
|
186 |
|
187 |
+
**Final evaluation result:**
|
188 |
+
- `eval_loss`: `3.26e-05`
|
189 |
|
|
|
190 |
|
|
|
191 |
|
192 |
+
#### Factors
|
193 |
|
194 |
+
The evaluation did not explicitly disaggregate results by subpopulations or domains. However, the synthetic test set includes:
|
195 |
+
- Code-switched utterances (Hindi-English)
|
196 |
+
- Disfluent speech (fillers, hesitations)
|
197 |
+
- Mixed-case and punctuation-stripped phrases to simulate Whisper-style ASR output
|
198 |
|
199 |
+
Future iterations may include evaluations across real-world datasets and dialectal variation.
|
200 |
|
201 |
+
---
|
202 |
|
203 |
+
#### Metrics
|
204 |
|
205 |
+
- **Eval Loss** (cross-entropy): Measures token-level classification confidence.
|
206 |
+
- Intended metrics such as **precision**, **recall**, and **F1-score** (via `seqeval`) were not computed in this release but will be included in a future version for fine-grained NER-style performance analysis.
|
207 |
|
208 |
+
---
|
209 |
|
210 |
+
### Results
|
211 |
|
212 |
+
- **Eval Loss (final checkpoint):** `3.26e-05`
|
213 |
+
- **Evaluation runtime:** `2.55 seconds`
|
214 |
+
- **Samples/sec during evaluation:** ~39
|
215 |
|
216 |
+
The extremely low evaluation loss indicates strong learning stability and high token-level accuracy within the test domain.
|
217 |
|
218 |
+
---
|
219 |
|
220 |
+
#### Summary
|
221 |
|
222 |
+
ZentryPII-278M demonstrates excellent performance on synthetic ASR-style transcripts, achieving near-zero loss over a multilingual, code-switched BIO-tagged benchmark. Its architecture (XLM-RoBERTa) allows for robust generalization across English and Hindi tokens with informal structure. While tested only on synthetic data, it sets the foundation for more rigorous real-world deployment within LexGuard’s privacy-preserving stack.
|
|
|
|
|
|
|
|
|
223 |
|
|
|
224 |
|
225 |
### Model Architecture and Objective
|
226 |
|
227 |
+
ZentryPII-278M is based on the `xlm-roberta-base` transformer architecture — a multilingual masked language model pretrained on 100+ languages. It has been adapted for the **token classification** objective using a linear classifier head on top of the contextual embeddings. The model is fine-tuned using a BIO tagging scheme to detect and label PII entities such as names, locations, and temporal references.
|
228 |
|
229 |
+
---
|
230 |
|
231 |
+
### Compute Infrastructure
|
232 |
|
233 |
#### Hardware
|
234 |
|
235 |
+
- Training was performed on a **Google Colab T4 GPU instance**
|
236 |
+
- 16 GB system RAM
|
237 |
+
- GPU Memory: ~15 GB
|
238 |
|
239 |
#### Software
|
240 |
|
241 |
+
- Python 3.10
|
242 |
+
- Hugging Face Transformers 4.38+
|
243 |
+
- Datasets 2.x
|
244 |
+
- PyTorch 2.x
|
245 |
+
- Accelerate and Tokenizers libraries
|
246 |
+
- Environment: Google Colab (Free Tier)
|
247 |
|
248 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
249 |
|
250 |
## Model Card Contact
|
251 |
|
252 |
+
For questions, usage inquiries, or integration support:
|
253 |
+
|
254 |
+
**📧 Email:** [email protected]
|
255 |
+
**👤 Maintainer:** Sanskar Pandey
|
256 |
+
**🏢 Organization:** LexGuard
|