Mask personal data by rules you can read and change, on your own machine.
A ready-made PII setup for ReDefiNER, a 0.8B model that marks the spans a plain-English rulebook defines. This page holds a rulebook and its settings, not a second model: the weights load from jungroo-ai/redefiner-0.8b. To mask something else, or to stop masking something, edit the rulebook. No retraining. Created by Jungroo AI Labs.
Not trained on any personal-data dataset. With this page's default rulebook it scores a mean F2 of 87.2 on the four English tasks of the PII Masking Benchmark, which would place it 8th among 37 models, and it is ahead of OpenAI's Privacy Filter (71.4) on each task. How it compares, including where it loses
Quickstart · Your own policy · Benchmarks · PII redaction guide · Code
30 seconds, with a voiceover: a clinic note masked with this page's rulebook, then with the clinic's own policy, and the scores. Every mask in it is real output from this model.
The default rulebook masks 20 kinds of personal data. Your own policy, written the same way, can mask fewer, keep some (staff names but not patient names, say), or add kinds of your own. It runs on an ordinary CPU, with no GPU, no API key and no per-use fees, and once downloaded it works offline, so the text never leaves your machine. Free for commercial use under Apache 2.0.
Need it on your own data? We write and test policies with you and run ReDefiNER on your own servers: jungroo.com/redefiner or hello@jungroo.com.
| Property | Details |
|---|---|
| Does | Masks personal data in English text: the 20 types of pii.txt, or only what your own policy defines |
| Controlled by | A plain-English rulebook; edit it to mask more or less, with no retraining |
| Returns | Masked text and an audit file of every masked span (redefiner redact), or exact character spans with a type and a confidence (Tagger.extract) |
| Model | This page holds rulebooks and settings; the weights load from jungroo-ai/redefiner-0.8b (0.8B parameters, one 0.77 GB int8 file) |
| Hardware | CPU, with about 3 GB of memory at peak, or an NVIDIA GPU; works offline once downloaded |
| Speed | On an Apple M2 CPU: 11 s for the first text (the rulebook is read once, then cached), under a second for later short texts |
| Limits | English only; one masked span is at most 64 tokens; long texts are read in parts; logs, code and API records score far below prose |
| Interfaces | redefiner redact on the command line, Python (Tagger.extract), a local HTTP server (redefiner serve), and plugins for Presidio, spaCy, LangChain and LlamaIndex |
| Benchmarks | PIIMB, RedactionBench and PolicyMask: results |
| Licence | Apache-2.0: free to use, change and share, including in commercial products |
| Release | November 2026, package 1.0.9 or later |
| Made by | Jungroo AI Labs; authors Cibe Hariharan K and Sethuraman T A |
pip install "redefiner>=1.0.9"
from redefiner import Tagger
tagger = Tagger.from_pretrained("jungroo-ai/redefiner-pii") # weights from jungroo-ai/redefiner-0.8b
tagger.extract("Call Meera Nair on 020 7946 0155.") # no rulebook needed: this page's is the default
Mask whole text files from the command line:
redefiner redact notes.txt
It writes notes.redacted.txt and notes.audit.json, which lists every masked span with its type, confidence and
character offsets in the original.
Input, note.txt:
Hi, this is Meera Nair from Brightwater Dental. Please send the invoice to meera.nair@brightwater.example and call me on 020 7946 0155 before Thursday. My patient ID is PT-664201, date of birth 14 March 1989. I live at 9 Alder Close, Bristol BS3 4QT.
redefiner redact note.txt, the default rulebook:
Hi, this is [PERSON] from [ORGANIZATION]. Please send the invoice to [EMAIL] and call me on [PHONE] before [DATE_TIME]. My patient ID is [ID_NUMBER], date of birth [DATE_TIME]. I live at [ADDRESS], [ADDRESS].
Keep company names: delete the [TYPE] ORGANIZATION section from a copy of pii.txt and pass it with --rules:
Hi, this is [PERSON] from Brightwater Dental. Please send the invoice to [EMAIL] and call me on [PHONE] before [DATE_TIME]. My patient ID is [ID_NUMBER], date of birth [DATE_TIME]. I live at [ADDRESS], [ADDRESS].
These are the model's actual outputs, on CPU.
Write what to mask in plain English and pass it with --rules. This clinic's policy.txt masks patients but not
staff, birth dates but not visit dates, and card numbers but not invoice numbers:
[TYPE] PATIENT_NAME
[DESCRIPTION] The name of a patient. Doctors, nurses and other staff are not patients.
[TYPE] DATE_OF_BIRTH
[DESCRIPTION] A person's date of birth. Other dates, such as appointment dates, are not dates of birth.
[TYPE] CARD_NUMBER
[DESCRIPTION] The digits of a payment card number, 13 to 19 digits with their spaces, and nothing else.
[TYPE] PHONE
[DESCRIPTION] The digits of a phone number.
[TYPE] NOT_AN_ENTITY
NE1 Invoice numbers and order numbers, such as "INV-55120" or "Order 4471-B".
note.txt:
Nurse Priya Shah booked Marcus Bell (DOB 09/01/1962) for 21 July with Dr. Omar Aziz. Invoice INV-88213, card 4000 0566 5566 5556, phone 0161 496 0333.
redefiner redact note.txt, the default rulebook, masks all eight details:
Nurse [PERSON] booked [PERSON] (DOB [DATE_TIME]) for [DATE_TIME] with [TITLE]. Invoice [ID_NUMBER], card [FINANCIAL], phone [PHONE].
redefiner redact note.txt --rules policy.txt --min-confidence 0.35 masks only the four the policy names:
Nurse Priya Shah booked [PATIENT_NAME] (DOB [DATE_OF_BIRTH]) for 21 July with Dr. Omar Aziz. Invoice INV-88213, card [CARD_NUMBER], phone [PHONE].
Without the cutoff, the word "phone" is masked too, at a confidence under 0.2. For your own policies, start with a cutoff of 0.35 and check the output on a few dozen of your own texts.
| File | Masks | Use it when | Settings |
|---|---|---|---|
pii.txt (default) |
20 types: names, titles, usernames, emails, phones, addresses, places, coordinates, organisations, job titles, dates and times, ages, gender, nationality and other demographics, government and other ID numbers, IP addresses, URLs, card and bank numbers, passwords and keys | you want broad masking, close to what PII datasets count as personal data | none_bias 2 (this page's default) |
identifiers.txt |
10 types: names, emails, phones, addresses, dates of birth, ID numbers, card numbers, account numbers, IP addresses, credentials | you want to keep dates, places, organisations and job titles readable | none_bias 4 |
redefiner redact notes.txt --rules identifiers.txt --none-bias 4 --min-confidence 0.35
from huggingface_hub import hf_hub_download
identifiers = open(hf_hub_download("jungroo-ai/redefiner-pii", "identifiers.txt")).read()
tagger.extract(text, identifiers, none_bias=4)
The identifiers rulebook sometimes masks a field label next to its value: in the note above it also masked "patient ID" (confidence 0.12) and "date of birth" (0.33). A confidence cutoff of 0.35, the one RedactionBench chose for it, drops both.
Both rulebooks are plain text. Write your own the same way: one [TYPE] section per kind of data, a one-line
description, and example lines. See the rulebook guide.
Character-level masking F2, full test splits.
| Setup | Privy | Gretel | AI4Privacy EN | Nemotron-PII | Mean | Place among 37 |
|---|---|---|---|---|---|---|
This page, pii.txt |
73.4 | 94.1 | 96.4 | 84.8 | 87.2 | 8th |
This page, identifiers.txt |
51.9 | 88.3 | 90.5 | 58.8 | 72.4 | 23rd |
| A rulebook written for each dataset | 80.5 | 94.5 | 97.1 | 86.0 | 89.5 | 6th |
| OpenMed privacy-filter-multilingual-v2 (best mean) | 81.8 | 97.3 | 97.5 | 90.7 | 91.8 | 1st |
| NVIDIA gliner-PII | 71.4 | 92.0 | 94.5 | 77.2 | 83.8 | |
| Fastino gliner2-privacy-filter-PII-multi | 64.6 | 93.6 | 91.4 | 85.4 | 83.7 | |
| OpenAI Privacy Filter | 53.6 | 86.9 | 84.3 | 60.7 | 71.4 | |
| Presidio (en_core_web_lg) | 51.8 | 75.8 | 73.4 | 72.9 | 68.5 |
pii.txt, five declare training on at least one PIIMB source
dataset; the other two declare nothing. ReDefiNER used none of them.200 documents labelled under contextual integrity. Its R-Score rewards masking what must be masked and charges for masking what should stay. Its leaderboard tunes one confidence cutoff per model on all 200 documents.
| Setup | R-Score | Place among 45 |
|---|---|---|
This page, identifiers.txt |
0.520 | 11th |
This page, pii.txt |
0.393 | 15th |
| Perplexity PII-Tracer | 0.601 | 6th |
| OpenAI Privacy Filter | 0.533 | 9th |
| Fastino GLiNER2 PII | 0.445 | 12th |
The two rulebooks swap places here: RedactionBench mostly counts dates, places, organisations and job titles as
over-masking, so the narrower rulebook scores higher. With identifiers.txt the score is 0.54 to 0.72 on prose
documents and 0.29 to 0.39 on logs, files, code and terminal output.
Both benchmarks above use fixed categories. PolicyMask is our open benchmark for the other case: a privacy policy written in plain English, such as "keep our support agents' names, mask customers'" or "mask children's names only". It has 10 policies on 400 synthetic texts, a scorer, and the predictions and settings of every system tested. Of the six systems tested (ReDefiNER, OpenAI Privacy Filter, Fastino GLiNER2-PII, GLiNER multi PII, Presidio and Liquid Policy-Linter), ReDefiNER scored highest on every policy that depends on whose data it is. It is a small synthetic test; its results page states the limits.
Methods, every rulebook, the scores in JSON and a script that reruns PIIMB: benchmarks/pii.
config.json on this page:
{"format": "pointer", "base_model": "jungroo-ai/redefiner-0.8b", "rulebook": "pii.txt",
"max_span_tokens": 64, "none_bias": 2.0, "threshold": 0.5}
max_span_tokens 64: spans can be up to 64 model tokens long (the model was trained on 16). Digits are one token
each, so spaced card numbers and IBANs need more than 16.none_bias: higher masks more. Arguments to extract() and redefiner redact override it.threshold: the span score a candidate needs before it gets a type.| Package | What it adds |
|---|---|
presidio-redefiner |
A recognizer for Microsoft Presidio, with this page's rulebook or your own |
spacy-redefiner |
A spaCy pipeline component that adds what a rulebook defines to the document's spans |
langchain-redefiner |
LangChain agent middleware that redacts messages before the model sees them, and document transformers |
llama-index-redefiner |
A LlamaIndex node postprocessor and an ingestion step that mask personal data |
These are our own packages, not part of the projects they plug into.
This page adds no weights: the model is jungroo-ai/redefiner-0.8b, trained on synthetic rule-following
data across many domains (see its Training data
section). No personal-data dataset was used in training, and none of the PIIMB or RedactionBench source datasets.
Neither rulebook on this page was written or chosen with test documents; pii.txt was written from dev documents of
the four PIIMB source datasets.
redefiner-pii is meant for masking personal data in English text before it is shared, stored or sent to another
system, such as an AI service, and for masking by an organisation's own written policy.
config.json: the pointer to the weights and this page's settings.pii.txt: the default rulebook (20 types).identifiers.txt: the narrower rulebook (10 types).docs/assets/video/: the 30-second video and its poster.Apache 2.0. The rulebooks on this page are Apache 2.0. The benchmarks keep their own licences (PIIMB data is CC BY-NC 4.0, RedactionBench CC BY 4.0).
@misc{redefiner2026,
title = {ReDefiNER: Rule-Defined Named Entity Recognition},
author = {{Cibe Hariharan K} and {Sethuraman T A} and {Jungroo AI Labs}},
year = {2026},
url = {https://huggingface.co/jungroo-ai/redefiner-0.8b},
note = {Release 1.0}
}
Created by Jungroo AI Labs. For help putting it to work on your own data, see jungroo.com/redefiner or write to hello@jungroo.com.
jungroo-ai/redefiner-0.8b