Skip to content
Worfilo

Blog

Mask personal data before it reaches the model

By Oshadha Vimukthi ·

The text agents work on is full of people: names in tickets, card numbers in complaints, NHS numbers in referral notes. The model rarely needs any of it to do its job. The new Mask PII node takes it out first.

What it does

Put the node in front of an agent. It replaces personal data with tokens, and the agent reads the rest as normal:

Before and after
in:  Hi, I'm Nimal Perera, card 4111 1111 1111 1111, call +94 77 123 4567.
out: Hi, I'm <PERSON_1>, card <CREDIT_CARD_1>, call <PHONE_1>.

The agent can still tell that a customer was charged and wants a call back. It just never learns who. Within a run the same value always gets the same token, so two masking steps agree on who <PERSON_1> is.

Three detectors, not one

No single technique finds everything, so masking combines three:

  • Recognizers for structured identifiers such as cards, IBANs, and national IDs from the US, UK, India, Sri Lanka, Canada, Australia, Germany and France. Wherever a format has a checksum it is checked, so a random number of the right length is left alone.
  • GLiNER, a multilingual model, for what no pattern can describe: names, addresses, organisations, dates and conditions, in any language.
  • Your own lists: terms that must always be masked, such as a project code name, and terms that never should be, such as your clinic's name.

Profiles bundle the right set for the job: general, healthcare, finance or minimal. Healthcare runs at the strictest setting, because a missed patient identifier costs more than an extra mask.

Measured, not asserted

"Detects PII" means little without numbers, so the masking service ships with a corpus of synthetic documents with hand-labelled spans, and a scorer that reports precision, recall, how many characters of personal data leaked, and how often clean documents were masked by mistake. CI fails if recall drops below 99%, precision below 95%, leaked characters above 1%, or if a single clean document gets a mask.

What we keep

The original values are held encrypted for the run, with an expiry, and never written to disk. The run itself records only how many values of each kind were masked. If masking is ever unavailable, the node lets text through by default so a workflow keeps working; set it to fail instead when unmasked data must never reach the model.

Try it

Add Mask PII from the Tool group in the palette and point the agent's prompt at its output. PII masking covers profiles, countries and the lists in full.

Build it on the canvas

Create a free account, describe the workflow or wire it yourself, and run it in the browser.