--- license: other license_name: sentry-model-research-use-agreement license_link: LICENSE language: [en] library_name: transformers pipeline_tag: token-classification base_model: microsoft/deberta-v3-large base_model_relation: finetune tags: - de-identification - phi - pii - clinical - healthcare - medical - ner - token-classification - deberta-v3 - presidio - tide2 - shield - distillation metrics: - recall - precision - f1 - accuracy # NOTE: the SHIELD gold dataset lives on GitHub (susom/shield_dataset), not the HF # Hub, so it cannot go in `datasets:` (which needs an HF dataset id) — it is linked # in the body instead. Add a `datasets:` entry only if a HF mirror is published later. extra_gated_heading: "Access the SHIELD tide2-sentry-clinical-ner model" extra_gated_prompt: >- This model is released under Stanford Medicine's **Research Use Agreement** (full text in the LICENSE file): **non-commercial research use only**, no redistribution, no sharing of the download link, and no attempt to re-identify any individual. Access also requires registering **individually** on the Redivis page: https://redivis.com/REPLACE_WITH_SENTRY_MODEL_DUA_SLUG . Requests are reviewed and approved **manually** by a stanford-med-hdr maintainer after your Redivis registration is verified. Hugging Face automatically records your HF username, account email, and request timestamp for gated repositories. extra_gated_fields: Email: text Affiliation: text I have registered on the Redivis page: checkbox I have read and agree to the Research Use Agreement for this model: checkbox I will use this model for non-commercial research only: checkbox extra_gated_button_content: "Request access" --- # tide2-sentry-clinical-ner A DeBERTa-v3-large token-classification model for **clinical PHI/PII de-identification** of English clinical notes. It is the distilled DeBERTa v3 student released with the **SHIELD** paper (Posada et al., 2026, [arXiv:2605.03301](https://arxiv.org/abs/2605.03301)), built for on-premise, enterprise-scale de-identification behind a hospital firewall. > **Gated & Research Use Only.** Access is gated behind Stanford Medicine's > [Research Use Agreement](LICENSE) and individual registration on Redivis (see > [License & access](#license--access)). This model is **not** is > not a substitute for human review. > > Register and accept the Research Use Agreement on the Redivis page to access the model: ## Model description & intended use - **Architecture:** `DebertaV2ForTokenClassification` (`deberta-v2` model type), fine-tuned from **`microsoft/deberta-v3-large`** (1024 hidden / 24 layers / 128,100 vocab, SentencePiece tokenizer). Max sequence length **512 tokens**. - **Task:** token classification (NER) with a BIO tagging scheme. - **Intended use:** first-pass detection of protected health information (PHI/PII) in English clinical free text, as one stage of a de-identification pipeline (e.g. [TIDE 2.0](https://github.com/susom/tide2-core) ). The model outputs entity spans; downstream anonymization (surrogate replacement, FPE, date jitter) is handled separately by [TIDE 2.0](https://github.com/susom/tide2-core) . ## Entity / label set The model covers the **9 canonical SHIELD PHI categories** plus an `OTHER` catch-all (10 entity types → 21 BIO labels including `O`): `AGE`, `DATE`, `DOCTOR`, `HOSPITAL`, `ID`, `LOCATION`, `PATIENT`, `PHONE`, `WEB`, `OTHER`. Full label list: `O`, and `B-`/`I-` for each of `AGE, DATE, DOCTOR, HOSPITAL, ID, LOCATION, OTHER, PATIENT, PHONE, WEB`. ## Usage This is a **gated** repository. Authenticate first with a Hugging Face token that has been granted access: ```bash pip install transformers sentencepiece torch hf auth login # or set the HF_TOKEN environment variable ``` ### With `transformers` ```python from transformers import pipeline ner = pipeline( "token-classification", model="stanford-med-hdr/tide2-sentry-clinical-ner", aggregation_strategy="simple", ) text = "Patient John Doe seen by Dr. Smith on 5/3/2021 at Stanford Hospital." for span in ner(text): print(span["entity_group"], ":", span["word"]) # Expect PATIENT / DOCTOR / DATE / HOSPITAL spans. ``` ### With TIDE 2.0 TIDE 2.0 resolves a transformer model by name and falls back to `snapshot_download(repo_id=...)`, so you can point its transformer recognizer at `stanford-med-hdr/tide2-sentry-clinical-ner`. Because the repo is gated, export a token with access (`HF_TOKEN`) before running the pipeline. See the [tide2-core notebook](https://github.com/susom/tide2-core/blob/main/notebooks/tide2_pipeline.ipynb) to run it on a google colab instance. ## Training data & procedure **This model is a distilled student; it was NOT trained on the SHIELD gold set.** Per the paper (§2.3), SHIELD's 1,381 gold-annotated notes are held out entirely as an **independent evaluation set**. The student was trained via a three-stage teacher→student distillation on a **silver-standard corpus of ~13,000 unlabeled [STARR-OMOP](https://starr.stanford.edu/data-models/omop) clinical notes labeled by the teacher model Gemini 2.5 Flash**, using token-level cross-entropy over BIO tags. *No SHIELD gold-standard annotations were included in the training data.* - **Training-data source:** STARR-OMOP (Stanford Medicine Research Data Repository, >158B tokens of clinical text). Notes were selected via **set-cover diversity sampling** across six axes: age, sex, race, ethnicity, note type, and note length. - **Hyperparameters:** 10 epochs, learning rate 1e-5, cosine schedule, batch size 15, AdamW (fused), bf16 mixed precision, weight decay 1e-6, seed 42. The deployed checkpoint was selected to **maximize recall**, the appropriate objective for de-identification safety. ## Evaluation ### Primary — SHIELD gold benchmark (span-level) On the **SHIELD gold evaluation set** (1,381 real STARR-OMOP notes; 10,229 gold PHI spans across 9 categories), span-level with an 80%-overlap match criterion (paper §3.3): | Metric | Value | |---|---| | Micro-averaged precision | **0.89** | | Micro-averaged recall | **0.88** | This is the best-performing distilled student in the paper, with the most uniform coverage across all 9 PHI categories. It trails the Gemini 2.5 Flash teacher on macro recall (0.81 vs 0.90). The paper also reports cross-dataset evaluation on **i2b2 2014** and **AIMI**: universal structured PHI (dates, phones, IDs, web) transfers well, while institution-specific entities transfer less well. ## Limitations & bias - **English clinical text only.** Performance on other languages or non-clinical text is not evaluated. - **512-token context window.** Longer notes must be chunked; span accuracy near chunk boundaries can degrade. - **Not a complete de-identification solution.** Use as one stage alongside human review and complementary recognizers; residual PHI is possible. - **Research Use Only.** ## License & access This model is distributed under Stanford Medicine's **Data Research Use Agreement** (the model DRUA), included in this repository as [`LICENSE`](LICENSE): non-commercial research use only, no redistribution, no sharing of the download link, and no re-identification attempts. Access is **gated with manual approval**. To obtain access: 1. Register and accept the Research Use Agreement on the Redivis page: 2. Request access on this Hugging Face repository and complete the gated form. 3. A stanford-med-hdr maintainer grants access after verifying your Redivis registration. Each user must register individually. ## References / citation - **Paper:** Jose D. Posada, David Love, Somalee Datta, Priya Desai. *SHIELD: A Diverse Clinical Note Dataset and Distilled Small Language Models for Enterprise-Scale De-identification.* Stanford Medicine, 2026. arXiv:2605.03301. - **SHIELD evaluation dataset:** - **TIDE 2.0 Deid Framework:** ```bibtex @article{posada2026shield, title = {SHIELD: A Diverse Clinical Note Dataset and Distilled Small Language Models for Enterprise-Scale De-identification}, author = {Posada, Jose D. and Love, David and Datta, Somalee and Desai, Priya}, journal = {arXiv preprint arXiv:2605.03301}, year = {2026}, url = {https://arxiv.org/abs/2605.03301} } ```