Module 8 · Safety
Lesson 8.4
What data leaves your servers
Every prompt sent to a hosted model leaves your servers, so personal data must be removed or limited first.
The problem
Why it matters
Without it
A support note with an email and a phone number goes to the model vendor unchanged. You may have no record of where it was kept.
With it
The system finds personal words and replaces them with labels before sending. The original text stays on your server.
How it works
Everything in the prompt leaves
Each prompt sent to a hosted model holds the question, the chunks, and the tool results. Any of these can carry personal data, such as an email address or a phone number. Everything in the prompt leaves your servers and may be kept by the vendor for logs.
- Questiontyped by the user
- Retrieved chunksmay name people
- Tool resultsmay hold an email
The parts of one prompt, and what each part can hold. Finding personal words
A word counts as personal when it has an @ sign or at least 7 digits. The check counts the digits in each word and treats seven or more as a phone number. "jane@example.com" and "5550142987" are both found in this example.
Word Reason jane@example.com Has an @ sign 5550142987 10 digits, at least 7 The two words found in the support note, and why each one counts. // A word is personal with an @ sign or 7 or more digits.const isPersonal = (word: string) => { const digits = word.split("").filter((c) => c >= "0" && c <= "9"); return word.includes("@") || digits.length >= 7;};const ticket = "Ask jane@example.com or call 5550142987 today.";console.log(ticket.split(" ").filter(isPersonal));Output
[ 'jane@example.com', '5550142987' ]
Replacing with labels
The email becomes [EMAIL], and the phone number becomes [PHONE]. The model still sees the sentence without the details. The original text stays on your server, and only the redacted version is sent.
On your server
- Ask jane@example.com or call 5550142987 today.
Sent to the model
- Ask [EMAIL] or call [PHONE] today.
The support note before and after redaction. const ticket = "Ask jane@example.com or call 5550142987 today.";const isDigits = (w: string) => { return w.split("").every((c) => c >= "0" && c <= "9");};const redact = (word: string) => { if (word.includes("@")) return "[EMAIL]"; return word.length >= 7 && isDigits(word) ? "[PHONE]" : word;};console.log(ticket.split(" ").map(redact).join(" "));Output
Ask [EMAIL] or call [PHONE] today.
What gets logged
Logs should store the same redacted text, not the original. Otherwise the personal data survives in the log store, even when the prompt was clean. Read the vendor terms and set limits on how long data is kept.
- Prompt sentredacted
- Log entryredacted, not the original
The prompt and the log entry should match. Testing the rule
Try the rule on realistic text, including odd formats such as numbers with spaces or dashes. Splitting on spaces misses a phone number written as 555 014 2987, so that format would leak. Real systems use pattern rules and a named-entity model, which also finds names.
Common mistakes
What goes wrong
- Redacting the prompt but not the logs. The original text then stays in the log store.
- Trusting a single rule. Test with several formats, including spaces and dashes.
- Sending full records when the model needs one field. Send only the fields the answer needs.
Use it when and skip it when
Is it the right tool?
Use it when
- Prompts contain names, email addresses, phone numbers, or account ids.
- The model is hosted by a vendor outside your servers.
Skip it when
- The model runs on your own machines, under the same access rules as your database.
- The text has no personal data, such as a public product manual.
Words to know
Terms in this lesson
- Personal data
- Information that identifies a person, such as an email or a phone number.
- Redaction
- Replacing sensitive text with a label before it is stored or sent.
- Hosted model
- A model run by a vendor and reached over a network.
- Retention
- How long a vendor or a log keeps data before deleting it.