Skip to content

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.

Anıl Talha Bulduklu 2 min read

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

  1. 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.
  2. 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.
  3. Process. The LLM sees masked text only; summaries, analyses and drafts are produced over pseudonyms.
  4. 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.

Let’s talk about your project

A free 30-minute discovery call — scope, timeline and approach, clarified together.