Redact: On-device PII Redaction for iOS, Android, and Web
On-device PII redaction that detects and masks personal data in text across all 24 official EU languages, without the text ever leaving the device.
Redact finds and masks personal data in text: names, addresses, emails, phone numbers, credit cards, IBANs, national IDs, VAT numbers, and more. It runs on device, so the raw text never touches a network or a server, yours or a third party's. It covers the same PII lane as Microsoft Presidio, AWS Comprehend, and Google Cloud DLP, but stays on device and is reversible for LLM round-trips.
Its differentiator is reversible redaction for LLM round-trips. Mask the text before sending it to an external model, then restore the originals in the response. Keep the placeholder map and the result is pseudonymized; drop it and the masked copy is anonymized. Under the hood a small 6-layer token classifier handles contextual PII, and a deterministic layer validates structured fields with real checksums.
Demo
Performance
Catches 88.8% of personal data across all 24 EU languages, with checksum validation for cards, IBANs, VAT numbers, and national IDs, all from a single 23M-parameter model.
Internal evaluation on external WikiANN and MultiNERD plus a format-valid structured-PII set. About 23M parameters.
Use cases
Safe LLM round-trips
Mask PII before a prompt leaves for an external model, then restore the real values in the answer. Unique numbered placeholders like [GIVEN_NAME_1] and [EMAIL_1] make the round-trip lossless.
Scrub logs and support records
Strip names, emails, cards, and IBANs from support transcripts and application logs so raw personal data never reaches your servers.
GDPR-aligned de-identification
Pseudonymization and anonymization run locally, so the compliance-sensitive step happens before any data leaves the device.
Multilingual by default
One model covers all 24 EU languages across Latin, Greek, and Cyrillic scripts, instead of standing up a separate pipeline per language.
What it does
- 20 detection categories: names, addresses, emails, phone numbers, credit cards, IBANs, national IDs, VAT numbers, and more
- Deterministic validation layer: Luhn card checks, ISO-13616 IBANs, checksummed national IDs for all 24 EU countries, all 27 EU VAT formats, IMEI, and per-country driving licences
- Reversible redaction with unique numbered placeholders for LLM round-trips
- Filter by category and inspect every detection with its exact character span
Platforms and install
// Swift Package Manager .package(url: "https://github.com/Desert-Ant-Labs/redact-swift", from: "0.2.2")
import Redact let redact = Redact() let r = try await redact.redaction(of: text) // r.redactedText: "Email [GIVEN_NAME_1] at [EMAIL_1]"
// build.gradle.kts (via JitPack)
implementation("com.github.Desert-Ant-Labs:redact-kotlin:0.2.1")
import ai.desertant.redact.Redact val r = Redact.redaction(text) // r.redactedText: "Email [GIVEN_NAME_1] at [EMAIL_1]"
npm i @desert-ant-labs/redact
import { Redact } from "@desert-ant-labs/redact";
const redact = await Redact.load();
const r = await redact.redaction(text);
// r.redactedText: "Email [GIVEN_NAME_1] at [EMAIL_1]"
Specs
- Languages
- All 24 official EU languages (Latin, Greek, Cyrillic)
- On-device size
- 12-14 MB (4-bit Core ML on Apple, int4 ONNX on Android and Web)
- Model
- 6-layer BIOES token classifier, Multilingual-MiniLM lineage, ~23M params
- Privacy
- Runs fully on device; text never leaves the device