1. The Problem: Unchecked Personal Data in Prompts
Staff paste real work into language models: settlement agreements, customer email threads, complaint logs, payroll schedules, disciplinary notes. Training helps, but names, personal email addresses, mobile numbers and bank details are part of the source material. They cannot be trained out of it.
Send that text straight to an inference endpoint, even an internal one, and the identifiers end up in prompt logs, request traces and, if the text is indexed, in the vector embeddings. Logs can be rotated. Embeddings are harder: once a person's name and bank details are embedded, removing them means finding every affected chunk and re-embedding it.
2. GDPR Article 5(1)(c) Data Minimisation in Practice
Article 5(1)(c) of the General Data Protection Regulation requires personal data to be "adequate, relevant and limited to what is necessary in relation to the purposes for which they are processed (data minimisation)."
To pull out a liability clause, summarise a contractor's statement of work or draft an email reply, the model does not need to know the contractor is "David O'Connor" or that his IBAN is IE29 AIBK 9311 5212 3456 78. It does the same job on either version:
"David O'Connor submitted invoice #402 payable to IE29 AIBK 9311 5212 3456 78 for £14,200."
or:
"[PERSON_1] submitted invoice [INV_REF_1] payable to [IBAN_1] for £14,200."
Swap the direct identifiers for placeholder tokens before inference and the model still sees the structure and meaning of the text. Substituting detected identifiers reduces the direct personal data sent to inference. Missed identifiers and surrounding context can still identify a person, so the result remains personal data rather than anonymous text.
3. Proxy Architecture & Data Flow
In this design the proxy is a local HTTP reverse proxy between the client (browser UI or internal app) and the local inference server. It intercepts each request, swaps identifiers for tokens, sends the masked prompt to the model, and puts the real values back into the response stream on the way out. None of that requires a vendor product; it is a small service you run yourself.
4. High-Speed Local NER & Regex Detection
Detection runs in two passes. Pattern matching catches structured identifiers, with a checksum test wherever the format has one to cut false positives:
- IBANs & Bank Account Details: Regex validation with Modulo-97 checksum calculation (SEPA IBANs).
- National Identification Numbers: Irish PPS Numbers (7 digits + 1-2 letters), UK National Insurance Numbers (2 letters, 6 digits, 1 letter).
- Email Addresses & Phone Numbers: E.164 phone formats and standard RFC 5322 email patterns.
# Python sketch: regex + checksum pre-masking for IBANs
import re
# Country code, check digits, then 11-30 alphanumerics with optional single spaces.
IBAN_REGEX = re.compile(r'\b[A-Z]{2}\d{2}(?: ?[A-Z0-9]){11,30}\b')
def iban_valid(raw: str) -> bool:
s = raw.replace(' ', '')
s = s[4:] + s[:4] # move country + check digits to the end
digits = ''.join(str(int(c, 36)) for c in s) # A=10 ... Z=35
return int(digits) % 97 == 1 # ISO 13616 mod-97 check
def mask_ibans(text: str, session_map: dict, counters: dict) -> str:
def replace(match):
val = match.group(0)
if not iban_valid(val):
return val # looks like an IBAN, fails checksum: leave it
counters['IBAN'] = counters.get('IBAN', 0) + 1
token = f"[IBAN_{counters['IBAN']}]"
session_map[token] = val
return token
return IBAN_REGEX.sub(replace, text)
Names, organisations and addresses have no fixed format, so the second pass is a quantised DeBERTa NER model running on the CPU under ONNX Runtime. It runs on the same host as the proxy, so the text is never sent over the network, and the GPU stays free for inference.
5. In-Memory Ephemeral Unmasking Table
A pseudonymisation proxy is only as safe as its mapping table. Write the mappings to MySQL, or to a Redis instance that persists to disk, and you have built a second store of personal data that needs the same protection as the first.
The design keeps the mapping in request-scoped memory rather than intentionally writing it to a persistent store:
- Memory handling: The mapping
[PERSON_1] → "Patrick Kelly"is held in a per-request object in process memory. Swap, crash dumps, diagnostics and any other persistence paths need to be considered in the deployment configuration. - Request lifetime: The design discards the mapping when response processing ends and keeps it separate from other requests.
- Logging: The proposed audit record contains masking counts rather than the original identifiers, for example "Prompt masked 2x PERSON, 1x IBAN for User ID 4082." Logging must be checked across the proxy, inference service and response path.
6. Why This Belongs on Private Hardware
Try this with a cloud model and you hit a wall. The masking has to happen before the data leaves your building. A cloud-hosted proxy would receive the raw PII it exists to protect. So the masker, the NER model and the mapping table have to run on your premises anyway, and by then you have built most of a local stack just to feed someone else's model.
The On-Premises Architecture
On a Soviture server, the proxy, the NER model and the GPU inference engine sit in one chassis. Data moves between them over loopback and system memory, and never crosses a network boundary you do not control.
Masking reduces what the model sees. It does not make the output correct. The model drafts the reply with the real names restored, and a person checks it against the cited source before it goes anywhere.