PII redaction for AI means cleaning personal data at six points, not one: before text is embedded into a search index, before an agent writes to memory, before prompts and answers are logged, before the call to the model, before anything enters a fine-tuning set, and on the model's output. Cleaning only the prompt is the most common mistake, because the raw text then sits in the vector database, the memory store and the logs. Greek data needs extra work on top. Presidio, AWS Comprehend and Google's Sensitive Data Protection ship no detectors for ΑΦΜ, the Greek tax number, or ΑΜΚΑ, the social security number, so you write validators with their check digits yourself, and the best free model for Greek names is licensed for non-commercial use only. Replace what you find with stable pseudonyms, keep the key outside the index, and remember that pseudonymised data is still personal data.
What is the difference between anonymisation and pseudonymisation?
Anonymised data can no longer be linked to a person by anyone with reasonable means, and it falls outside the GDPR. Pseudonymised data has its identifiers replaced but can be linked back with extra information, such as a key or a lookup table, and under Article 4(5) it stays personal data (GDPR, Article 4). The anonymisation guidelines the EDPB put out for public consultation in July 2026 set three tests that data must pass to count as anonymous: no singling out of one person's record, no linking of records about the same person, and no inferring facts about them (EDPB). Text that is still useful to an AI system rarely passes all three. In practice you pseudonymise, keep treating the result as personal data, and gain a much smaller leak if something goes wrong.
Where does personal data leak in an AI system?
Personal data leaks wherever the system keeps a copy, and an AI system keeps more copies than most people expect. Each of the six points is a separate store with its own lifetime:
- The search index. Vectors persist, and they can be turned back into text, as the next section shows.
- Agent memory. Memory is written automatically, often by a summariser, and outlives the conversation. What an agent should keep and forget is in AI agent memory.
- Logs and traces. Monitoring tools record full prompts and full answers by default, often at a third-party vendor with its own retention. Evaluation sets built from those traces carry the same data for longer, because they get shared.
- The model call. The provider becomes a processor of whatever you send. Which provider keeps what, and where, is in GDPR and AI.
- Fine-tuning data. A model can memorise and repeat its training data, and there is no reliable way to erase one person from the weights afterwards.
- The output. The model can repeat an identifier from retrieved context or rebuild one, so the answer needs a final check before it reaches the user.
Two quieter places complete the list: caches, and the schemas used for structured outputs. Anthropic's documentation warns against putting protected health information in schema property names, enum values or patterns, because compiled schemas are cached separately from the messages and do not get the same protections (Anthropic, structured outputs).
Why is the vector database usually the leak?
The vector database is usually the leak because an embedding is a compressed copy of the text, not an anonymous list of numbers. Research on embedding inversion recovered 92% of 32-token texts exactly from their vectors, including full names from clinical notes (Morris et al., 2023). Deletion is weaker than it looks, too. A 2026 study of vector databases built on HNSW indexes found that soft-deleted vectors stay in the index files, and recovered 25.5% of names exactly from deleted biographical records (Ghost Vectors, 2026). So clean before embedding, never after, and make erasure a real deletion: rebuild or compact the index, or encrypt each record and destroy its key. The most common failure is a team that redacts the prompt carefully and embeds the raw document. For a small collection, a SQLite file whose rows you can truly delete may be the simpler choice, as in a knowledge base without a vector database.
How do you detect a Greek ΑΦΜ, ΑΜΚΑ or IBAN?
You detect Greek identifiers with validators that check the format and the check digit, which gives near-perfect precision and costs nothing to run:
- ΑΦΜ: nine digits. Multiply the first eight by 256, 128, 64, 32, 16, 8, 4 and 2, add the results, and take the remainder after dividing by 11 and then by 10: it must equal the ninth digit. Reject 000000000 explicitly, because it passes the arithmetic. The open-source python-stdnum library, version 2.2, accepted it as a valid ΑΦΜ when I tested it in September 2026 (python-stdnum).
- ΑΜΚΑ: eleven digits. The first six are the date of birth, and the whole number carries a Luhn check digit, the same check used on card numbers. Sources disagree on the date order: python-stdnum reads day, month, year, and Microsoft's definition reads year, month, day. Reject any number whose first six digits are not a real date in either reading. In python-stdnum's implementation the tenth digit also encodes sex, so treat an ΑΜΚΑ as more sensitive than an account number.
- Greek IBAN: 27 characters starting with GR, checked with the standard mod-97 calculation. A Greek IBAN that passes it is almost never a false alarm.
- Phone numbers: ten digits, with mobiles starting with 69 and +30 as the international prefix. A bare ten-digit number collides with order and invoice numbers, so require the prefix, a leading 69 or a nearby word such as «τηλ.».
The same checks double as quality checks when AI reads invoices, as in AI document processing.
Which tools recognise Greek names?
Names and addresses need a named entity recogniser, and Greek narrows the choice:
- Presidio, AWS Comprehend and Google Sensitive Data Protection have no Greek support for personal data. AWS detects it in English and Spanish only.
- Azure AI Language detects personal data in Greek text and documents, but its conversation mode, the one built for chat transcripts, supports only English, French, German and Spanish (Microsoft, language support).
- spaCy's el_core_news_lg is the best free Greek pipeline, with an entity F1 of about 77% (model card), so expect roughly one name in four to be missed or wrong. Its licence, CC BY-NC-SA 3.0, forbids commercial use, and the restriction comes from the training data, so a newer release will not lift it.
- Greek-BERT scores better on entity recognition, about 86 F1, but its repository carries no licence at all, which is worse for a commercial product than a restrictive one.
- Microsoft Purview has an ΑΜΚΑ pattern, but in its data loss prevention product, not in the AI service.
A practical Greek stack is validators for the numbers, Azure for names if a cloud call is acceptable, and a model trained and run locally if it is not. A large language model can take a third pass over the spans the first two layers flagged as uncertain, but that pass should run on your own machine: sending text to a cloud model to find out whether it is safe to send to a cloud model defeats the purpose.
How do you keep AI answers useful after anonymising?
You keep answers useful by replacing each person or number with a stable pseudonym instead of deleting it. Deletion turns "call Giorgos about invoice 118" into "call [] about invoice 118", and the model can no longer tell two people apart or say which orders one customer placed. A stable pseudonym such as PERSON_a7f3 keeps who is who:
- At ingest, detect each value and replace it with a pseudonym. The same person gets the same pseudonym in every document.
- Embed and index only the pseudonymised text.
- Keep the map from pseudonym to real value in a separate store, with its own credentials, encrypted, and every read logged. Not a column in the same table and not a field in the vector metadata.
- Retrieve and generate on the pseudonymised text.
- Put the real values back only at the last step, only for users allowed to see them, and log who saw what.
Greek makes the first step harder. The same name appears as Γιώργος, Γιώργου or Γιώργο depending on its role in the sentence, and as Giorgos in Greeklish, so without reducing names to a base form you mint three or four pseudonyms for one person. Normalise the text first, as described in RAG in Greek: one form for each accented character, the final sigma folded for comparison, and Latin lookalike letters treated as their Greek twins.
How do you know the cleaning works?
You know the cleaning works when you test it like any other feature. Build twenty valid and twenty invalid examples for each identifier and require zero false accepts, with 000000000 among the invalid ones. Add the shapes real documents contain: numbers split across lines, digits with spaces, names in Greeklish, mixed Greek and Latin letters, and text from scanned pages. Then test the stores, not only the detector: plant known test values, run them through the system, and search the index, the memory, the logs and the evaluation sets for them. Pull the last hundred traces from your monitoring tool and search for the test values too; the target is zero hits. Finally, have a person read a sample of the cleaned output, because a catch rate measured on your own labels is optimistic by construction. How to build such a test set is in LLM evals. This cleaning step belongs in any of the AI agents for business that touch customer records.
Frequently asked questions
Is hashing an ΑΦΜ enough to anonymise it?
No. There are at most a billion nine-digit numbers, so anyone can reverse the hash by trying them all in seconds, and the same ΑΦΜ always produces the same hash, which links records by design. A hash is a pseudonym, and the data stays personal data.
If the AI provider does not train on my data, do I still need to clean it?
Yes. Not training is one promise among several. Providers commonly keep prompts for up to 30 days for abuse monitoring unless you have agreed otherwise, and your own index, memory and logs keep them for as long as you let them. Each copy needs a lawful basis and a way to erase it.
Can I ask ChatGPT to remove the personal data from a document?
You can, but by then the data you wanted to protect has already reached a third party. Run that step on a model on your own machine, or accept the transfer and record it. An agent that handles customer records also needs the narrowest access you can give it, as in AI agent permissions.
If you are about to connect an AI system to customer records, send me the list of places your data will go: the index, the logs, the model provider and any memory. Where the cleaning is missing usually shows in that list.