PII redaction with a model of your own
Redacting personal data is a job a small model does well: the same kind of call, many times a day, with an answer you can check. Sous trains one on your own data, in any language and with your own types of personal data, and switches your app over only when it matches your current model on calls it never saw.
The short answer
- What it is. A model that finds personal data in text and removes or masks it before the text is stored, shared, or sent on.
- Why a small model. It costs a fraction of a frontier model per call and answers faster, so you can redact every message, not a sample.
- What Sous measured. The example PII redactor learned from 128 calls from an app, gave the frontier model’s answer on 84% of held-out calls, and costs 8.5× less per call.
What counts as personal data
Definitions vary by law and by policy. NIST describes PII as information that can distinguish or trace a person’s identity, or that is linked or linkable to a person. The GDPR covers any information relating to an identified or identifiable person. In practice, a redaction model usually looks for these:
| Type | Examples |
|---|---|
| Names | People, and the relatives or colleagues a message mentions |
| Contact details | Email addresses, phone numbers, street addresses |
| Government IDs | Social Security, passport, and driver’s license numbers |
| Financial details | Card and bank account numbers |
| Online identifiers | IP addresses, device IDs, account handles |
| Your own types | Member IDs, case numbers, internal account codes, anything your policy covers |
Rules, libraries, or a model of your own
| Approach | Good at | Misses or costs |
|---|---|---|
| Regular expressions | Fixed formats like emails and card numbers | Names, addresses, and anything that depends on context |
| Off-the-shelf PII libraries | Common entity types in widely used languages | Your own types, your domain’s language, and mixed or rarer languages |
| A frontier model with a prompt | Context and many languages | Cost and latency on every call, and personal data sent to another provider |
| A small model trained on your data | Your types, your languages, at a low cost per call | It needs examples to learn from: Sous starts at 30 |
Many teams combine them: a pattern for card numbers, a model for names and context. A model trained on your own calls covers the cases rules and generic libraries miss, without sending every message to a frontier model.
How to train one with Sous
- Connect the calls. Wrap the client your app already uses for redaction, or upload past examples as files.
- Say what counts. List the types your policy covers, including your own, and check a few of the current model’s answers.
- Train and compare. Sous holds back about 20% of calls, trains up to 4 candidate small models on the rest, and scores each on the calls it never saw.
- Switch safely. Your app moves to the small model only when one matches. Until then, it keeps calling the model it uses today.
- Keep it current. Sous retrains as new calls arrive, so the model keeps up with new formats and types.
Training starts at 30 calls, and 50 or more train better. See the guide to fine-tuning without an ML team for the full process.
How to measure a redaction model
- Misses first. Personal data the model leaves in is the costly error. Count misses by type.
- Then over-redaction. Masking words that aren’t personal data makes text less useful. Watch it, but weigh it below misses.
- Test on held-out calls. Score the model on real calls it never trained on, in every language and format you see.
- Recheck as inputs change. New products, markets, and forms bring new formats. Keep scoring after you switch.
Questions people ask
What is PII redaction?
Finding personal data in text, such as names, contact details, and ID numbers, and removing or masking it before the text is stored, shared, logged, or sent to another system.
Is a small model accurate enough to redact PII?
For one well-defined job, often yes. Sous’s PII redactor gave the same answer as the frontier model it learned from on 84% of calls it never saw, at 8.5× lower cost. Measure on your own data before you switch, and pay most attention to personal data the model misses.
Which languages does it work in?
Any language your data is in. The model learns from your own examples, so it handles the languages and formats your app actually sees.
Can I add my own types of personal data?
Yes. Tell Sous what your policy covers, such as member IDs or internal account numbers, and the model learns to catch those too.
Is there a PII redaction API?
Yes. Your trained model answers through Sous’s OpenAI-compatible API, so your app calls it the way it calls a frontier model today.
How much does it cost?
Sous charges per token at the small model’s rate, from $0.05 per million input tokens and $0.40 per million output tokens. The example PII redactor cost $5.02 to train.
Is Sous secure enough for personal data?
Sous is SOC 2 Type I and Type II compliant. Data travels encrypted, connection credentials are encrypted before they are stored, and you can delete datasets and connections at any time.