Instructions to use sixmonth-ai/sixmonth-redact with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use sixmonth-ai/sixmonth-redact with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="sixmonth-ai/sixmonth-redact", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("sixmonth-ai/sixmonth-redact", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
A 5.8M-parameter model that removes patient identifiers from medical and dental notes. CPU only, about 0.2 s per note, works offline.
We built it for our own internal research and liked it enough to share it. We hope it is useful, and that it inspires more work on small models that run locally.
Beta. This is an early release. Expect misses, and please report them to joe@sixmonth.ai.
in: Seen on 03/14 by Dr. Miller. Pt Sarah Thompson, 92 y.o., MRN 448-2190, lives at 18 Oak Street, Springfield.
Call back 555-123-4567 or sarah.t@example.com. Rx Amoxicillin 500mg tid, #14 RCT.
out: Seen on [REDACTED] by Dr. [REDACTED]. Pt [REDACTED], [REDACTED] y.o., MRN [REDACTED], lives at [REDACTED], [REDACTED].
Call back [REDACTED] or [REDACTED]. Rx Amoxicillin 500mg tid, #14 RCT.
in: Consultation du 14/03 avec le Dr Martin. Patiente Claire Dubois, dossier 448-2190, domiciliรฉe 12 rue des Lilas, Lyon.
Rappeler au 06 12 34 56 78 ou claire.d@example.fr. Amoxicilline 500 mg 3x/j, dent 36, dรฉvitalisation.
out: Consultation du [REDACTED] avec le Dr [REDACTED]. Patiente [REDACTED], dossier [REDACTED], domiciliรฉe [REDACTED], [REDACTED].
Rappeler au [REDACTED] ou [REDACTED]. Amoxicilline 500 mg 3x/j, dent 36, dรฉvitalisation.
Identifiers go, the clinical content stays. (Invented examples, real model output.)
Quick start
pip install torch transformers safetensors
from transformers import AutoModel
model = AutoModel.from_pretrained("sixmonth-ai/sixmonth-redact", trust_remote_code=True)
model.redact("Called Mrs Johnson re: appt on March 3rd. Policy no. BC-44817203.")
# 'Called Mrs [REDACTED] re: appt on [REDACTED]. Policy no. [REDACTED].'
model.redact(text, typed=True) # [NAME], [DATE], ... instead of [REDACTED] (type is approximate)
model.redact(text, keep_dates=True) # leave dates in place (not Safe Harbor)
model.spans(text) # [(start, end, label), ...]
Command line: python scrub.py "text" (also --typed, --keep-dates, --spans, or pipe text on stdin).
What it removes
The HIPAA Safe Harbor identifiers found in text, in six labels:
| Label | Removes | Keeps |
|---|---|---|
| NAME | Patients, relatives, clinicians, staff | Titles, drug names, eponyms |
| DATE | Every date except a year alone | Years alone, durations |
| CONTACT | Phone, fax, email, URL, IP | |
| ID | Record, plan, account, licence, plate, serial numbers | Tooth numbers, doses, lab values, codes |
| LOCATION | Every place smaller than a state | States, countries |
| AGE | Ages over 89 | Ages 89 and under |
English, French and Lebanese Arabic in Latin letters (Arabizi), including dental notes.
Results
Every model ran once on the same held-out documents with the same scorer. An identifier counts as caught only if every character of it is hidden. Clean masked is non-identifier text hidden by mistake (lower is better).
| Model | Params | Nemotron-PII: caught | Clean masked | Clinical notes: caught | Clean masked |
|---|---|---|---|---|---|
| Perplexity PII-Tracer | 596M | 99.4% | 0.52% | 95.1% | 15.25% |
| sixmonth-redact | 5.8M | 98.3% | 0.34% | 95.0% | 3.33% |
| OBI deid RoBERTa i2b2 | 354M | 95.3% | 1.16% | 79.0% | 4.66% |
| GLiNER PII small | 82M | 92.7% | 1.01% | 91.8% | 10.14% |
| GLiNER large v2.1 | 445M | 92.1% | 2.87% | 84.7% | 10.18% |
| GLiNER2 PII | 307M | 91.6% | 0.69% | 83.6% | 3.32% |
| Presidio + spaCy lg | 106M | 83.3% | 1.42% | 64.4% | 12.00% |
| Conway PII 30M | 29M | 72.6% | 0.52% | 74.8% | 19.96% |
- Nemotron-PII: NVIDIA's public set, 752 health documents, 4,595 identifiers.
- Clinical notes: 300 synthetic US, French and Lebanese notes, 1,498 identifiers, written for this test.
With typos (keyboard typos, lower-case text, missing accents on the same sets), sixmonth-redact catches 93.8% on Nemotron and 83.0% on clinical notes, against 98.7% and 93.1% for PII-Tracer, while masking 4.17% of clean clinical text against 18.42%.
Limitations
- A niche, specialised model. It was built for clinical and dental notes in English, French and Arabizi. Test it on your own data before you rely on it.
- Not a complete de-identification system. On the clinical notes, about 1 note in 5 still showed an identifier (1 in 2 with typos). Use it as a first pass with human review, never as the only safeguard. It does not by itself make data HIPAA de-identified.
- Weak spots: misspelled or unlisted place names, names with no cue in all-lower-case notes, unusual ID formats, first names that are also ordinary words ("May", "Rose").
- Other languages are untested.
Model
A character-level token classifier: character and hashed word embeddings, 1-D convolutions over characters and words, and one attention layer. It outputs six scores per character; a character is hidden when any is above zero. Word knowledge comes from public word lists and registries (see SOURCES.md). No patient note was used to fit any weight.
Licence
GPL-3.0, because the weights embed GPL-3.0 and CC BY-SA 4.0 word lists. Sources in SOURCES.md.
@misc{sixmonth_redact_2026,
title = {sixmonth-redact: a small neural network for clinical de-identification},
author = {{Sixmonth}},
year = {2026},
url = {https://huggingface.co/sixmonth-ai/sixmonth-redact}
}
Built by Sixmonth. Contact: joe@sixmonth.ai.
- Downloads last month
- 28
Evaluation results
- Identifiers fully hidden on Nemotron-PII test, 752 health documentstest set self-reported98.300
- Clean text masked (%) on Nemotron-PII test, 752 health documentstest set self-reported0.340
