Download README.md from jmclean/tiny-email-name-tagger: direct link, hf CLI and curl.
- Browser
- Download file 5.98 kB
-
https://huggingface.co/jmclean/tiny-email-name-tagger/resolve/main/README.md
- Command line
-
hf download hf://jmclean/tiny-email-name-tagger/README.md
-
curl -L -o README.md https://huggingface.co/jmclean/tiny-email-name-tagger/resolve/main/README.md
license: apache-2.0
language:
- en
library_name: numpy
pipeline_tag: token-classification
tags:
- pii
- redaction
- ner
- person-names
- tiny
tiny-email-name-tagger
A tiny model that finds people's names in email text, so they can be redacted locally before any large language model reads the mail. It runs with NumPy alone in a few milliseconds per message.
This is an experimental model.
What it does
It labels every token of a text as outside a name, the beginning of a name, or inside a name (O/B/I).
Word-level decoding averages the token probabilities of each word, so it returns whole words and multi-word and hyphenated names.
It finds full names, lone first names, sign-offs, names in greetings and reply headers, @handles, and names written in Chinese, Japanese or Korean script.
It cannot generate text, so it can only flag strings that are in its input.
Model
| Architecture | Bidirectional transformer encoder with a token-classification head |
| Layers / width / heads | 5 / 96 / 4 |
| Context | 256 tokens, longer text is read in overlapping windows of about 600 characters |
| Parameters | 559,683 core, 1,370,691 including embeddings |
| Tokeniser | Byte-level BPE, 8,000 tokens (tokenizer.json, Hugging Face tokenizers format) |
| Weights | weights.npz, float32, PyTorch-style tensor names (tok.weight, blocks.N.*, head.*) |
| Size | 5.5 MB weights, 0.5 MB tokeniser |
Using it
Inference needs only NumPy and a byte-level BPE tokeniser (the tokenizers library reads tokenizer.json); the inference code is not published yet.
Text is read in windows of about 600 characters, each window is tokenised and run through the encoder, and the softmax over O/B/I gives each token a name probability.
A word is a name when its mean name probability is above 1 - threshold.
Higher thresholds redact more: 0.9 is the default, 0.8 is more precise, 0.97 finds more names.
The evaluation below also cleans the output: it trims sign-off punctuation and function words at the edges of a name, drops open-source project names and similar never-a-name words, and adds standalone parts of found names and the handles of addresses in the text. The scores include that step.
Training data
- Real mail: 13,639 messages from 22 public Apache mailing lists, mostly from 2026.
- dev@: arrow, beam, camel, cassandra, datafusion, doris, flink, groovy, hbase, iceberg, iotdb, nuttx, ozone, paimon, pekko, pulsar, seata, spark, superset.
- users@: groovy, maven, solr.
- Labels: produced by rules, not by hand. Sources:
- sender names and their parts;
- reply headers ("On ... X wrote:");
- greetings, sign-offs and credits ("Submitted by");
- vote tallies;
@mentionsand "Name (handle)";- apache.org IDs.
- Label filters: code annotations, CamelCase identifiers, dictionary words and project names.
- Negatives: about a third of real windows have no names. Half of those were picked for having many capitalised non-names mid-sentence.
- Synthetic data: 7,250 windows of generated security-report mail with known names.
- Name swapping: each epoch, 85% of training windows have their names replaced with others, including names in Chinese script and made-up handles. The model learns from context rather than memorising a name list.
- Totals: 23,318 training windows and 1,227 validation windows; 12 epochs; name tokens weighted 3x in the loss.
The lists used for testing were left out of training entirely. Any training window that contained a test-set person's name was dropped.
Evaluation
200 held-out messages from four other public Apache mailing lists, 538 name occurrences, labels checked by hand. "Found" is the share of name occurrences fully redacted. "Precision" is the share of redacted strings that are names. "Clean" is the number of messages with no name left over.
| Model | Found | Precision | Clean (of 200) | Runs |
|---|---|---|---|---|
| This model, threshold 0.9 | 93.1% | 76.8% | 180 | locally, ms per message |
| This model, threshold 0.8 | 91.4% | 82.3% | 175 | locally |
| This model, threshold 0.97 | 95.5% | 65.2% | locally | |
| Qwen 3.5 9B via Ollama | 93.5% | 94.9% | 165 | locally, about 4 s per message |
spaCy en_core_web_sm / md (scored per window, without the clean-up step) |
50% / 61% | 70% / 76% | locally | |
| Claude Haiku | 97.4% | 96.4% | 197 | hosted |
| Claude Opus | 97.8% | 96.8% | 198 | hosted |
| Claude Sonnet | 99.6% | 96.4% | 198 | hosted |
The hosted models are a ceiling, not an alternative: the point of this model is that private mail is redacted before a hosted model sees it. The test set is small, so each figure could be a point or two either way.
Limitations
- A recall aid, not a guarantee. About 1 message in 10 keeps at least one name. Use it alongside explicit redaction of known names, email addresses and other identifiers.
- Handles are the main miss: lowercase handles in free text, changelog
@handlelists, and names that are also English words. - Names in Chinese, Japanese or Korean script are found less reliably, and the test set has only a few of them.
- Over-flagging: product names, place names and capitalised words in other languages are sometimes flagged. For redaction that costs readability, not privacy.
- Narrow training: it was trained on English-language open-source mailing-list mail and has not been tested on other kinds of text.
- Name fragments in the tokeniser: the vocabulary was learnt from public mailing-list mail, so it contains fragments of names that appear in those archives.
Files
| File | SHA-256 |
|---|---|
config.json |
1a1c459d3ab0cc9f66eb060fc1d661b751b2eaea4985991cad2d0fa3fb2d41b4 |
tokenizer.json |
d9b66213739cd7da762f6d608566ace7d77dfd7bfff047da0e69274151d14f42 |
weights.npz |
799dd07099680755f6dda2f1562f7424d380bd9cbf0e52cb4cb3d5f6b2121313 |
Licence
Apache License 2.0.