Models

Four small, open models for Turkish text: three for personal data, one for prompt injection, and the evaluation sets I use to measure them. All of them run on a CPU.

Turkish Privacy Stack

Masking, classification and the benchmarks behind them.

Hugging Face profile
halilneed/turkish-pii-detection Rewrites Turkish text with names, national ID numbers, IBANs, phone numbers and email addresses replaced by labels. You tell it what to mask in a short Turkish instruction. Text generation270M parametersUpdated 5 Oct 20262.4k downloads1 likes 0.944exact match, 1,000 rows halilneed/turkish-kvkk-classifier Tells you which of 24 kinds of personal data a Turkish text contains: the 14 VERBİS categories and the 10 special categories of KVKK, the Turkish data protection law. Text classification110M parametersabout 22 ms per textUpdated 2 Oct 202625 downloads1 likes 0.874micro-F1, 987 held-out texts halilneed/turkish-bseby-classifier Built for bank data inventories and data loss prevention (DLP) pipelines. Flags personal data, special-category data, authentication data, customer secrets and bank secrets. Text classification110M parametersabout 32 ms per textUpdated 2 Oct 202620 downloads 0.960micro-F1, 747 held-out texts halilneed/turkish-prompt-injection-classifier Flags prompt injection in Turkish text going into an LLM, including encoded and hidden instructions, without blocking ordinary Turkish instructions. Text classification307M parametersabout 35 ms per textUpdated 14 Oct 202634 downloads 13/13encoded attacks caught, under 2% false alarms

Speeds were measured on an Intel i5-12400F with eight threads and batch size one.

How they fit together

The two classifiers answer what is in a text. The masking model changes the text. A typical pipeline classifies first, picks a masking policy from the result, then masks. The prompt injection classifier sits in front of the LLM: it checks what goes in, whether a user typed it or an assistant retrieved it.

Evaluation sets

turkish-kvkk-classification-benchmark

1,125 fictional texts were written from the label definitions alone and labelled twice. The gold set is the 987 where both label sets agree exactly. The texts and both label passes were produced with a language model and were not checked line by line by a person.

turkish-bseby-classification-benchmark

Same method: 750 fictional texts, 747 with exact agreement. Both passes used the same language model and guideline, so the 99.6% agreement shows the guideline can be applied consistently. It is not agreement between two independent people.

turkish-prompt-injection-benchmark

Tests a prompt injection guard from both sides in one run: 317 attacks from five public Turkish sets, and 3,055 benign rows. The benign rows are the hard negatives that ship with those sets plus the 2,875 texts of the false-alarm set below. No new text was written; every row keeps its source and licence.

turkish-prompt-injection-false-alarm-benchmark

How often a prompt injection guard blocks ordinary Turkish business text and task instructions. No new text: collected from the two sets above and cagrigungor’s PII benchmark. Public guards flag 17.8% to 27.8% of it.

The PII model is evaluated on a third-party set, cagrigungor/turkish-pii-masking-benchmark, 1,000 synthetic rows. The prompt injection classifier is measured on four public Turkish sets with each training source held out in turn; see its page.

Elsewhere