Architecture
KVKK-Compliant LLM Architecture: The Mask-Then-Process Chain
You can use AI without sending personal data to a large language model. The mask-first architecture we run in production, step by step.
The question enterprises ask about AI first is never about features — it’s about boundaries: “Where does our data go?” This article describes the answer we run in production in our legal product and use as the template for every enterprise project: personal data is masked, in Türkiye, before any language-model call.
The problem: what you send an LLM is everything you send
Paste a petition, a patient note or a customer thread into a cloud model, and the names, ID numbers and addresses go with it. Even if the provider promises “no training on your data”, the data has left the country — under Turkish law (KVKK) that alone is a transfer that must be managed.
The architecture: mask → process → restore
- Detect. A named-entity-recognition layer tuned for Turkish flags names, national ID numbers, addresses, phone numbers, IBANs. Pattern-based catchers back up what the model misses.
- Mask. Flagged fields are replaced with consistent pseudonyms: “Ahmet Yılmaz” becomes “PERSON-1” everywhere. The mapping table stays in an encrypted vault in Türkiye and is never sent to any model.
- Process. The LLM sees masked text only; summaries, analyses and drafts are produced over pseudonyms.
- Restore. When the response returns, pseudonyms are re-resolved locally. The user reads it as if masking never happened.
The critical property is ordering: masking runs before the call, restoration runs after it, and locally. The provider never sees the names or the mapping.
What production taught us
- Consistency is context. Mixing up PERSON-1 and PERSON-2 breaks reasoning; pseudonyms must stay stable across a document set.
- Morphology matters. Turkish suffixes must be repaired after substitution or the output reads artificial.
- There is no 100%, there are layers. No NER is perfect; pattern backups, confidence thresholds and a “mask when in doubt” policy work together.
- The audit trail is part of the design. Which document, which mask, which model, when — without timestamped records, a compliance claim can’t be verified.
When to choose what
| Scenario | Our recommendation |
|---|---|
| Light personal-data content | Masking + cloud model |
| Personal-data heavy, model quality critical | Masking + cloud model + strict audit trail |
| Professional privilege / classified work | Open-weight model on premises — no external calls |
The full flow is documented in our Trust Center; to see it applied to your organisation, book a conversation.
Related articles
Why an Enterprise AI Project When ChatGPT Exists?
Why invest in enterprise AI when ChatGPT exists? An honest comparison across data privacy, citations, access control, process integration and cost.
Read →What Is RAG? Enterprise Knowledge Assistants, Plainly Explained
What is RAG (Retrieval-Augmented Generation)? The architecture behind enterprise knowledge assistants, explained plainly with real examples and honest limits.
Read →Let’s talk about your project
A free 30-minute discovery call — scope, timeline and approach, clarified together.