--- license: apache-2.0 language: - en base_model: - distilbert/distilbert-base-uncased tags: - token-classification - ner - privacy - pii-detection - distilbert --- # PrivyShield NER Model A fine-tuned DistilBERT model for detecting personally identifiable information (person names and addresses) in unstructured text; the core "separate model" component of **PrivyShield**, an on-device privacy protection tool built for OSDHack 2026. ## Model Details - **Base model:** `distilbert-base-uncased` - **Task:** Token Classification (Named Entity Recognition, BIO tagging scheme) - **Labels:** `O`, `B-PERSON_NAME`, `I-PERSON_NAME`, `B-ADDRESS`, `I-ADDRESS` - **Training data:** 7,500 synthetically generated, auto-labeled sentences (template + entity-pool based generation; no manual annotation), covering Indian names, addresses, cities, and localities - **Training:** 5 epochs, fine-tuned end-to-end on the labeled dataset - **Formats provided:** - `ner_model.onnx` : exported for fast local inference - `ner_model/` : original PyTorch checkpoint + tokenizer files ## Why this model exists Regex can reliably catch structured PII (card numbers, emails, Aadhaar/PAN formats), but it cannot catch **names and addresses**, which don't follow a fixed pattern. This model fills that specific gap as part of PrivyShield's layered detection pipeline; regex handles structured formats, this model handles unstructured entities, and both run entirely on-device. ## Intended use Designed to run locally (via ONNX Runtime) as part of a real-time screen-content privacy scanner. Not intended as a general-purpose NER model; it's scoped specifically to `PERSON_NAME` and `ADDRESS` detection for this use case, trained primarily on Indian name/address patterns. ## Limitations - Trained on synthetic data; real-world OCR noise (misspellings, broken formatting) may reduce accuracy - English-only - Name/address pools are India-centric; may generalize less well to other regions' naming/address conventions - Not evaluated for adversarial or out-of-distribution inputs ## Usage ```python from huggingface_hub import hf_hub_download import onnxruntime as ort model_path = hf_hub_download( repo_id="aditrynacode/privyshield-ner", filename="ner_model.onnx" ) session = ort.InferenceSession(model_path) ``` ## Project Part of **PrivyShield**, submitted to [OSDHack 2026](https://hack.osdc.dev/) (Open Source Developers Community). Main repository: [PrivyShield on GitHub](https://github.com/aditrynacode/PrivyShield)