
GolemPII v2 tiny
Version 2.0, 2026-11-13.
The smallest variant of GolemPII-v2-base: the same 15 labels and the same training data on dicta-il/dictabert-tiny (45M parameters). It is about five times faster than the main model and less accurate on enterprise text. Use it when speed or size matters more than accuracy; otherwise use the main model.
The labels, the training data, the way the scores are measured and the limits are described in the main model's card. The numbers below are from the REDACT final half, which was scored once after training.
Which model should I use
| Model | Parameters | Use it for |
|---|---|---|
| GolemPII-v2-base | 277M | Hebrew mixed with English in enterprise text (emails, tickets, logs, JSON), and the best recall of the three on identity, card and bank numbers |
| GolemPII-v2-small | 125M | Hebrew prose: the best of the three at telling person names from organisations, at less than half the size of base and the same speed |
| GolemPII-v2-tiny (this model) | 45M | When speed or size matters most (about five times faster), with lower accuracy on enterprise text |
Usage
from transformers import pipeline
detector = pipeline(
"token-classification",
model="CordwainerSmith/GolemPII-v2-tiny",
aggregation_strategy="simple",
stride=128, # lets the pipeline handle texts longer than 512 tokens
)
TEXT = """נושא: RE: ticket #48213 - עדכון פרטי לקוח
היי רונית,
הלקוח יואב בן דוד (ת.ז. 034567891) התקשר הבוקר וביקש לעדכן את הכתובת למשלוח: רחוב הרצל 42, רמת גן, מיקוד 5244302.
אפשר להשיג אותו ב-054-7731920 או במייל yoav.bendavid@example.com.
החיוב החודשי ירד מכרטיס ויזה 4580 1234 5678 9015, והזיכוי יועבר לחשבון IL620108000000099999999.
order_id=ORD-2024-88127, סכום: 349.90 ש"ח, תאריך לידה לאימות: 14/03/1987.
תודה,
Dana Levi | Customer Success"""
EDGE_PUNCTUATION = " .,;:!?()[]{}\"'-"
def clean_spans(text, entities):
"""Trim punctuation from span edges and join spans of one label that touch or overlap."""
spans = []
for entity in entities:
start, end, label = entity["start"], entity["end"], entity["entity_group"]
while start < end and text[start] in EDGE_PUNCTUATION:
start += 1
while end > start and text[end - 1] in EDGE_PUNCTUATION:
end -= 1
if start == end:
continue
if spans and spans[-1][2] == label and start <= spans[-1][1]:
spans[-1] = (spans[-1][0], max(end, spans[-1][1]), label)
else:
spans.append((start, end, label))
return spans
def redact(text, spans):
pieces, position = [], 0
for start, end, label in spans:
pieces += [text[position:start], f"[{label}]"]
position = end
return "".join(pieces) + text[position:]
spans = clean_spans(TEXT, detector(TEXT))
for start, end, label in spans:
print(f"{label:<12} {TEXT[start:end]}")
print(redact(TEXT, spans))
The detected spans:
FIRST_NAME רונית
FIRST_NAME יואב
LAST_NAME בן דוד
ID_NUM 034567891
STREET רחוב הרצל 42
CITY רמת גן
POSTAL_CODE 5244302
PHONE_NUM 054-7731920
EMAIL yoav.bendavid@example.com
CC_PROVIDER ויזה
CC_NUM 4580 1234 5678 9015
IBAN IL620108000000099999999
DATE 14/03/1987
FIRST_NAME Dana
LAST_NAME Levi
The redacted text. The ticket number, the order id and the amount are left alone:
נושא: RE: ticket #48213 - עדכון פרטי לקוח
היי [FIRST_NAME],
הלקוח [FIRST_NAME] [LAST_NAME] (ת.ז. [ID_NUM]) התקשר הבוקר וביקש לעדכן את הכתובת למשלוח: [STREET], [CITY], מיקוד [POSTAL_CODE].
אפשר להשיג אותו ב-[PHONE_NUM] או במייל [EMAIL].
החיוב החודשי ירד מכרטיס [CC_PROVIDER] [CC_NUM], והזיכוי יועבר לחשבון [IBAN].
order_id=ORD-2024-88127, סכום: 349.90 ש"ח, תאריך לידה לאימות: [DATE].
תודה,
[FIRST_NAME] [LAST_NAME] | Customer Success
clean_spans is optional. The pipeline groups sub-word tokens, so a raw span can carry a bracket, a hyphen or a full stop at its edge, or arrive in two pieces; the function trims and joins them. The scores on this page were measured on the raw pipeline output, without it.
The encoder is uncased.
With Microsoft Presidio
A ready recognizer for Presidio is in the GitHub repo. It registers this model for language he, maps the labels to Presidio entity names, and works with the standard analyze and anonymize calls.
Results
The evaluation code published with GolemPII-v2-base produced every number below, and scores any token-classification model on the same sets.
REDACT final, five categories
| Model | Parameters | Character P / R / F1 | Entity P / R / F1 |
|---|---|---|---|
| GolemPII-v1 | 277M | 0.592 / 0.884 / 0.709 | 0.601 / 0.913 / 0.725 |
| GolemPII-v2-base | 277M | 0.886 / 0.951 / 0.917 | 0.872 / 0.983 / 0.924 |
| GolemPII-v2-tiny | 45M | 0.844 / 0.927 / 0.884 | 0.797 / 0.968 / 0.874 |
By category (entity level, P / R / F1)
| Category | GolemPII-v2-base | GolemPII-v2-tiny |
|---|---|---|
| Person | 0.888 / 0.986 / 0.934 | 0.846 / 0.971 / 0.904 |
| Address | 0.777 / 1.000 / 0.874 | 0.735 / 0.985 / 0.842 |
| Phone | 0.940 / 0.993 / 0.966 | 0.883 / 0.965 / 0.922 |
| 0.940 / 0.998 / 0.968 | 0.734 / 1.000 / 0.846 | |
| Account (identity, card and bank numbers) | 0.762 / 0.905 / 0.827 | 0.571 / 0.890 / 0.696 |
By label (character F1)
EMAIL 0.936, PHONE_NUM 0.934, LAST_NAME 0.903, FIRST_NAME 0.898, PASSPORT_NUM 0.835, ID_NUM 0.832, CITY 0.705, CC_NUM 0.539, DATE 0.520, DRIVER_LICENSE_NUM 0.475.
Person names on real text (NEMO, never trained on)
| Model | Person P / R / F1 |
|---|---|
| GolemPII-v1 | 0.541 / 0.824 / 0.653 |
| GolemPII-v2-base | 0.853 / 0.925 / 0.887 |
| GolemPII-v2-tiny | 0.856 / 0.945 / 0.899 |
Names the model has never seen
FIRST_NAME F1 0.972, LAST_NAME F1 0.959.
Speed and size
Measured on an Apple M4 Pro (48 GB, macOS 27.0.1, torch 2.15.0, transformers 5.22.1) over 1,000 synthetic enterprise-style texts with a mean length of 1,512 characters, with the pipeline settings shown under Usage and batch size 8. Median of three runs; other programs were running, so treat differences of a few percent as noise.
| Model | Parameters | File size | Seconds per 1,000 texts, Apple GPU (MPS) | Seconds per 1,000 texts, CPU |
|---|---|---|---|---|
| GolemPII-v2-base | 277M | 1,110 MB | 63.8 | 115.6 |
| GolemPII-v2-small | 125M | 502 MB | 65.8 | 120.9 |
| GolemPII-v2-tiny | 45M | 179 MB | 13.0 | 15.6 |
The small model is less than half the size of the base model on disk and in memory, and runs at the same speed: both have a 12-layer encoder, and the base model's extra parameters are its larger vocabulary table. The tiny model is about five times faster on the GPU and seven times faster on the CPU.
Intended use and out of scope
Intended use: finding personal information in Hebrew text, and in Hebrew mixed with English, to assist redaction, masking and data-loss-prevention review.
Out of scope or not evaluated:
- Other languages. Arabic, and English text on its own, were not evaluated.
- Other sources. Speech transcripts, OCR output and handwriting were not evaluated.
- Anonymisation. The model is a detector that assists redaction, not a guarantee of anonymisation or of compliance with any privacy law. Text that must be anonymised needs human review.
- Other entity types. Organisations, job titles, countries and reference numbers (order, ticket and employee numbers) are not labelled.
Limits
All limits of the main model apply. In addition:
- Precision on account numbers and emails is clearly lower than the main model's: it tags more reference numbers as identity or card numbers, and more non-email strings as emails.
- One training run; the spread between runs was not measured for this variant.
Training
Same data and settings as the main model, except 10 epochs in place of 3.
Citation
If you use this model in a product, a paper or a derived model, please credit it as: GolemPII-v2-tiny by Liran Baba, with a link to https://huggingface.co/CordwainerSmith/GolemPII-v2-tiny.
@misc{baba2026golempii_v2_tiny,
author = {Baba, Liran},
title = {GolemPII v2 tiny: personal information detection for Hebrew text},
year = {2026},
version = {2.0},
publisher = {Hugging Face},
howpublished = {\url{https://huggingface.co/CordwainerSmith/GolemPII-v2-tiny}}
}
Licence and credits
CC-BY-4.0, following the encoder.
- Encoder:
dicta-il/dictabert-tinyby Dicta (CC-BY-4.0). - Real training sentences: IAHLT Hebrew named-entity dataset,
github.com/IAHLT/hebrew_named_entities_open_dataset(Apache-2.0), with person names replaced.