Skip to contentRedact PII for your data. Get a quote

AI training data

Clean your corpus before you train on it

A model can repeat what it was trained on, personal data included. Replace that data with placeholders before training or fine-tuning, and keep the links between records so the corpus stays useful.

What changes in the text

Each value becomes a placeholder such as <EMAIL_1>, numbered per call. The call also returns the mapping from each placeholder back to its value. The library never stores it: what you keep, and for how long, is up to you.

One line, before and after
in:  Write to ana.example@example.org
out: Write to <EMAIL_1>

The text keeps its shape. The model still learns that an email address goes there, without learning anyone’s address. Everything else in the line stays as written.

Keep the relationships between records

The same value gets the same placeholder, so records about one person still connect after cleaning.

Within one call, or one shared mapping, <EMAIL_1> stands for the same address everywhere it appears. That keeps a support thread, a chat or a set of related records readable as one story.

Across a corpus processed in many calls, on many machines, use a key. With a private key of your own, each placeholder becomes <TYPE_hex>: by default 12 lowercase hex digits (8 to 16 if you set the length) of an HMAC-SHA256 of the type and value. The same value with the same key gets the same tag in every call, file and machine.

  • Deduplicate records that mention the same person.
  • Keep all of one person’s records on the same side of a train and test split.
  • Count how often a value appears without seeing the value.

Keyed output is still personal data. Whoever holds the key can re-identify a value by hashing guesses, which is fast for small spaces such as national ID numbers or dates of birth. Keep the key apart from the output, and use one key per purpose. More on the GDPR.

What to check before training

  • In Fast, the default, names are found by rules where the text labels them: form fields, letter greetings and signatures, and the speakers of a chat or transcript. A name in running prose stays as written. Full’s model also finds people’s names and organisations in running text. How a match is decided.
  • On all 80,575 test items of PIIMark v1, in 34 languages, Fast mode finds 90.6% of structured personal data (IDs, phone numbers, emails, cards, IBANs, addresses and more) and masks something in 8.6% of harmless items. See every tool on the same items.
  • The rest of a record can still point to someone, a rare job title in a small town for example. Placeholders make text pseudonymised, not anonymous. What the GDPR says.
  • The library redacts text. Audio, scans and video need the service below.

Run it on your own machines

The corpus never leaves your systems: the library runs in your own process, on a CPU, with no GPU and no API calls.

Packages for Python (3.11 or later), Node.js, WebAssembly, Rust (1.88 or later), Go (1.26 or later) and C all ship every detector and return the same JSON. All but WebAssembly also run Full, with the model; WebAssembly runs Fast only.

There are two modes. Fast, the default, uses rules and checksums and loads no model. Full adds a small local model: it confirms or rejects the numbers, codes and street names the rules left open, and finds people’s names and organisations in running text. On PIIMark, Fast takes a median of 0.10 ms per text on a CPU with no GPU. Full, which adds a local model, takes 5.8 ms.

Or have us clean it

We also clean datasets for you: text and chat logs, documents and PDFs, voice and call recordings, images and scans, and video. You get the data back with a report of what was removed. About dataset cleaning.