PII_India / README.md
aneethsolomon's picture somukandula's picture
Duplicate from somukandula/maskara-indian-pii-200k
60afe5b
|
Raw History Blame Contribute Delete
4.94 kB
---
language:
- en
- hi
license: mit
task_categories:
- token-classification
task_ids:
- named-entity-recognition
size_categories:
- 100K<n<1M
tags:
- pii
- indian-pii
- synthetic-data
- maskara
- ml-intern
---
# Maskara Indian PII Dataset (Phase 2)
Synthetic Indian PII dataset for training the Maskara NER model. This version has been expanded and diversified for Phase 2 training.
## Dataset Description
- **Repository:** `somukandula/maskara-indian-pii-200k`
- **Version:** 2.0
- **Language:** English, Hinglish (Hindi-English code-mixed)
- **License:** MIT
- **Task:** Token classification / Named Entity Recognition (NER)
## Splits
| Split | Rows | Purpose |
|:---|---:|:---|
| `train` | ~250,000 | Model training |
| `template_disjoint_eval` | 15,000 | Generalization evaluation: entire template families held out |
| `real_world_eval` | ~2,600 | Manually curated real-world Indian text evaluation |
## Schema
| Column | Type | Description |
|:---|:---|:---|
| `id` | string | Unique example identifier |
| `text` | string | Raw text containing PII |
| `entities` | list[dict] | Character-level spans: `{start, end, label}` |
| `domain` | string | Source domain (e.g. `whatsapp`, `email`, `json`, `ocr`) |
| `locale` | string | Text locale (`en-IN`, `en-US`, `hi-IN`) |
| `difficulty` | string | `easy`, `medium`, `hard`, `hard_negative` |
| `generator` | string | Generator version (`maskara-v2`) |
| `seed` | int | Per-example random seed |
| `template_family` | string | Template family for traceability |
## Supported Entities (17)
`ADDRESS`, `API_KEY`, `CREDIT_CARD`, `DATE_OF_BIRTH`, `DRIVER_LICENSE`, `EMAIL`, `IP_ADDRESS`, `PASSWORD`, `PERSON_NAME`, `PHONE`, `SSN`, `USERNAME`, `AADHAAR`, `PAN_CARD`, `PASSPORT`, `UPI_ID`, `VEHICLE_REG`.
Note: `LOCATION` was removed in Phase 2.
## Diversity Improvements
- **Templates:** 150+ multi-entity templates, 80+ single-entity templates.
- **Formatting variations:** 6–10 per entity (plain, spaced, dashed, labelled, etc.).
- **Hinglish / code-mixed:** ~40% of examples.
- **Hard negatives:** ~15% of examples.
- **Structured / noisy documents:** ~20% of examples.
- **Domains:** WhatsApp, SMS, email, support tickets, HTML, Markdown, JSON, CSV, SQL, logs, OCR, bank statements, government forms, Aadhaar letters, PAN documents, resumes, configuration files.
## Template-Disjoint Evaluation
The following template families are excluded from training and reserved for the `template_disjoint_eval` split:
- `passport_application`
- `transport_challan`
- `json_payload`
- `config_yaml`
- `html_user`
- `api_request_json`
- `sms_link`
- `finance_pipe`
- `identity_kyc`
- `medical_record`
## Real-World Evaluation
A manually curated split containing realistic Indian text such as:
- Customer support conversations
- Hinglish chats
- OCR-noisy documents
- Government forms
- JSON payloads
- API request bodies
- Log lines
- Bank statements
- Emails
- Transport challans
This split is never used during training.
## Usage
```python
from datasets import load_dataset
dataset = load_dataset("somukandula/maskara-indian-pii-200k")
print(dataset["train"][0])
```
## Generation
Generated using `maskara_dataset_generator.py` (Maskara Phase 2 generator). Each example is produced by filling placeholder-based templates with synthetic values and recording character-level entity spans.
## Phase 2 Error-Analysis Augmentation
After the first Phase 2 training run, targeted synthetic examples were added for entities that underperformed on real-world and template-disjoint evaluation:
- `CREDIT_CARD`
- `PASSWORD`
- `DRIVER_LICENSE`
- `USERNAME`
- `ADDRESS`
- `IP_ADDRESS`
- `PHONE`
- `AADHAAR`
- `PAN_CARD`
These examples live in `phase2/targeted_augmentation.py` and are merged into the train split before retraining.
## Files in this repository
| File | Description |
|---|---|
| `maskara_dataset_generator.py` | Full synthetic dataset generator |
| `generate_maskara_phase2_dataset.py` | Script that generates and pushes all splits |
| `phase2/targeted_augmentation.py` | Targeted augmentation for weak entities |
| `phase2/train_maskara.py` | Training pipeline |
| `phase2/evaluate_maskara.py` | Evaluation pipeline |
| `phase2/error_analysis_loop.py` | Error analysis and actionable report generator |
| `phase2/retrain_with_augmentation.py` | End-to-end retraining with augmentation |
## Citation
```bibtex
@misc{maskara_dataset2026,
title={Maskara Indian PII Dataset},
author={Somu Kandula},
year={2026},
howpublished={\url{https://huggingface.co/datasets/somukandula/maskara-indian-pii-200k}}
}
```
<!-- ml-intern-provenance -->
## Generated by ML Intern
This dataset repository was generated by [ML Intern](https://github.com/huggingface/ml-intern), an agent for machine learning research and development on the Hugging Face Hub.
- Try ML Intern: https://smolagents-ml-intern.hf.space
- Source code: https://github.com/huggingface/ml-intern