VeilGate High v1
English · Türkçe
VeilGate High is a Turkish-first named-entity recognition model for person names, organizations, locations and addresses. It runs locally and returns character spans suitable for masking sensitive text before sending it to an LLM.
The model adapts XLM-RoBERTa-large with a BiLSTM sequence head, learned fusion of the original and lowercase text views, and CRF decoding. FP32 is the default. Deployment uses ONNX Runtime CPU; PyTorch remains the training/export reference. ONNX FP32 is not quantization. The earlier weight-only INT8 runtime is retired. An optional ONNX dynamic INT8 variant is available with measured quality differences below.
| Property | Value |
|---|---|
| Capacity tier | High |
| Base | FacebookAI/xlm-roberta-large |
| Reference pipeline parameters | 561,102,427; unused pooler is omitted from ONNX |
| Output | PERSON, ORGANIZATION, LOCATION, ADDRESS |
| Runtime | ONNX Runtime 1.32.0 CPU; local, offline after installation |
| Input limit | 512 subtokens per view, including special tokens |
| Format | ONNX FP32 (default) or dynamic INT8; external tensor data |
High denotes model capacity, not a privacy assurance grade. Low and Medium are planned as smaller models; neither is released yet. This model performs NER, not generative chat or complete privacy-policy enforcement.
Usage
Download a pinned revision of this repository and install requirements.txt from
the downloaded directory. The qualified deployment uses Python3.12, ONNX Runtime1.32.0,
tokenizers0.22.2 and NumPy2.2.6. Torch/Transformers are not deployment dependencies.
python -m pip install -r requirements.txt
from inference import load_model
model = load_model("high/fp32", threads=2)
text = "Teslimat adresi: Örnek Sokak No: 12."
for entity in model.recognize(text):
print(entity.type.value, entity.start, entity.end, entity.text)
For INT8 use load_model("high/int8", threads=2). In the gateway's Compose setup,
MODEL_TIER=high, MODEL_PRECISION=fp32|int8 select the variant's latest verified
publication on each gateway process start. Users do not enter versions or commits.
releases.json maps each
variant independently to an immutable commit and manifest SHA; changing another
variant or the project default does not switch the user's selected model.
Inference stays offline; updates are not hot-swapped into a running process.
This is a synthetic usage example. Offsets are Python Unicode character indices
[start, end) in the original input, not byte or UTF-16 offsets. The adapter
verifies file checksums before loading and makes no remote inference request.
Use the supplied adapter. A generic transformers.pipeline("ner") call does not
include the sequence/fusion heads or the trained decoding contract. Overlength
input raises OnnxInputTooLong; the VeilGate gateway returns HTTP 422. Input is not
silently truncated or automatically split into document windows.
| Path | Contents |
|---|---|
high/fp32/ |
Two ONNX graphs, external weights, CRF potentials, tokenizer and checksum manifest |
high/int8/ |
Dynamic INT8 encoder/classifier matrix operations; remaining components retain FP32 |
releases.json |
Independently versioned variant pointers, published only after download verification |
runtime/, inference.py |
Torch-free adapter preserving trained geometry and decoding |
evaluation.json |
Per-panel/type/language/scenario results and resource measurements |
LICENSE.md, ATTRIBUTION.md |
Distribution terms, source credits and transformations |
Labels and boundaries
The model uses BIO9: O, plus B- and I- for each of four types. Internal labels
AD, ORG, LOCATION and ADRES map to PERSON, ORGANIZATION, LOCATION and ADDRESS.
| Type | Annotation rule |
|---|---|
| PERSON | The supplied person-name mention, including partial names |
| ORGANIZATION | An institution, company, brand or clear institutional actor in context |
| LOCATION | Geographic places and explicitly physical campus/site uses |
| ADDRESS | The whole supplied address expression, including meaningful partial addresses |
- A university acting as an institution can be ORGANIZATION; its physical campus
can be LOCATION. Ambiguous source names are held for review, not automatically
O. - TC/T.C./TCKN identity-field headings are
O. Genuine T.C. institutions or clear institutional actors can be ORGANIZATION. The numeric identity itself belongs to structured detection, outside these four labels. - Named neighborhoods, streets, residential complexes and buildings can be ADDRESS without a house number. Block/floor/unit/postcode fragments need explicit address context. A city or country alone is LOCATION.
- A contiguous address is one span with its internal separators. Cities inside it are not nested LOCATION spans. Missing fields are not reconstructed, and fragments in separate messages are not joined by NER.
- Original boundaries are retained through Turkish suffixes, ASCII, missing apostrophes, case changes and typos. A flat BIO sequence cannot express overlapping entities. Gold boundaries were not widened to accommodate tokenizer limitations.
O means outside this annotation task, not safe to disclose. Unknown source scope
was not converted into negative training labels.
Architecture and training
The upstream base is pinned at
FacebookAI/xlm-roberta-large@c23d21b0620b635a76227c604d44e43a9f0ee389:
24 Transformer blocks, hidden size 1,024 and 16 attention heads.
A fixed Unicode lexer and pretokenized native subtoken-offset groups define output
geometry. The same encoder processes the original text and a deterministic,
length-preserving lowercase view. This canonical view handles İ explicitly;
it is not spelling correction or an assumption of identical token IDs.
A BiLSTM residual head with 128 hidden units per direction augments classifier
emissions. Canonical emissions project back to raw intervals by character overlap.
Nine raw logits, nine projected logits and six text-shape features feed a 32-unit
fusion layer and a contextual BiLSTM residual with 32 units per direction. Legal
CRF/Viterbi decoding returns spans on the original geometry. No address merging,
gap filling or confidence-threshold filtering is applied. The bundle pins the
source contract SHA-256 (preserved as ml/pytorch_contract.py in the application
repository), plus hashes of onnx_ner.py and onnx_geometry.py. Encoder/classifier/
sequence and dual/context fusion form two ONNX graphs; tokenizer, native intervals,
projection and NumPy Viterbi remain outside the graphs. The shared encoder runs
sequentially for two views. Unused pooler computation is omitted; batch size is one.
The model was developed through classifier, last-block, sequence and fusion stages. The final pass adapted 558,856,313 parameters in 401 tensors: embeddings, all 24 encoder blocks and the current contextual head. The older classifier, sequence/dual heads, pooler and CRF stayed fixed. No LoRA, teacher distillation, new backbone pretraining or pseudo-label teacher was used in that pass.
| Final-pass setting | Value |
|---|---|
| Optimizer | Ordinary AdamW, fresh state at pass start |
| Learning rate | Encoder 1e-7; contextual head 1e-5; linear decay to zero |
| Precision | FP32; no AMP, TF32 or 8-bit optimizer |
| Batch | Logical batch 4; microbatch 1 |
| Loss | Original-word-balanced cross-entropy + 0.5 × CRF negative log-likelihood |
| Normalization | CE by logical-batch original-word count; CRF by native-group count |
| Weight decay / gradient clipping | 0 / global norm 1 |
| Completed updates | 27,464 |
| Hardware | Debian 13, RTX 3070 8 GB, Ryzen 5600X, 32 GB RAM |
| Memory strategy | CPU gradient accumulation and CPU-master AdamW |
Word balancing prevents a word from receiving more CE weight solely because it splits into more native groups. Training resumed from a verified recovery checkpoint after a power interruption and completed the same ordered pass. Publication did not add another training pass.
Training data
The dataset is private. Exact text, labels, source provenance, tokenizer geometry and the ordered sampling plan are retained privately; only the methodology and aggregate measurements are published.
| Component | Unique views | Uses per view | Draws |
|---|---|---|---|
| Main four-type corpus | 100,000 | 1 | 100,000 |
| Colloquial supplement | 2,400 | 4 | 9,600 |
| Turkish FineWeb2 excerpts | 64 | 4 | 256 |
| Total | 102,464 | — | 109,856 |
The main corpus combines qualified source entity values, Faker 40.41.0 and Mimesis 18.0.0 outputs, and project-authored contexts/address constructions. Its distribution:
- Languages: 85,000 TR; 8,000 EN; 2,000 DE; 2,000 FR; 1,500 ES; 1,500 IT.
- Polarity: 65,000 positive and 35,000 neutral views; 16,250 primary positives per type.
- Writing: 50,000 careful, 35,000 lowercase/unpunctuated and 15,000 typo-heavy views.
- Register metadata: 60,000 daily and 40,000 formal.
- Diversity: 627 declared template families and 89,258 parent-text families.
Primary-type quotas are not total mention counts. Templates and writing variants are related views, not independent conversations or people.
Public sources used
The following counts are source-mention provenance entries in the final 100k, not unique source documents or full-corpus import counts:
| Source | Entries | Declared license |
|---|---|---|
| NewMind nm-kvkk-pii-6K | 5,390 | Apache-2.0 |
| NeonRedact-TR | 3,074 | CC BY 4.0 |
| Turkish Privacy Filter | 1,190 | MIT |
| NVIDIA Nemotron-PII | 719 | CC BY 4.0 |
| Gretel PII masking EN v1 | 403 | Apache-2.0 |
| OpenPII — Ai4Privacy / Ai Suisse SA | 188 | CC BY 4.0 |
| Belgin PII | 17 | CC BY 4.0 |
Source pins, creator credits and transformations are recorded in ATTRIBUTION. NewMind use concerns its dataset, not a model checkpoint.
Preparation
Original source values and labels were preserved. Four-type projection and context changes were recorded separately. Uncertain values were held or replaced within quota cells. The preparation covered full/partial/component addresses, institution versus campus roles, identity-heading negatives and nonnumeric neutral contexts. Faker's Turkish-to-US address fallback was identified; corrected generation used Mimesis Turkish streets with explicit country-format fixtures. Synthetic addresses are not verified residences or deliverable postal records.
The 2,400-view colloquial supplement has 2,000 Turkish and 400 English views from 120 templates: 600 primary PERSON, 600 ORGANIZATION, 600 LOCATION and 600 neutral. It covers street speech, slang/profanity, technical jargon, ASCII, upper/lower/mixed case, missing apostrophes and typos. It has no ADDRESS gold.
The 64 FineWeb2 excerpts use tur_Latn/train at revision
af9c13333eb981300149d5ca60a8e9d659b276b9. Bounded retrieval retained 384 documents;
160 candidate excerpts were read. The selected excerpts span 62 domains, with
25 positive and 39 reviewed negative records: 11 PERSON, 26 ORGANIZATION,
11 LOCATION and 1 ADDRESS mention. FineWeb provided text, not NER labels; project
annotations were not generated from model predictions.
Known text/alias/parent reservations, native tokenizer alignment, projection and word weights were checked. User messages, screenshots and reserved development examples were not added to TRAIN. Review was same-agent and non-blinded, not independent human gold. General semantic, translation-family and source-pretraining independence are not fully established.
Evaluation
Exact micro-F1 requires both span and type to match. The panels below were excluded from TRAIN but reused during development; they are not an untouched final test.
| Panel | Records | PyTorch FP32 | ONNX FP32 |
|---|---|---|---|
| Combined development | 402 | 90.9502% | 90.9502% |
| Context/role/scenario | 436 | 93.8640% | 93.8640% |
| Representative casebook | 192 | 91.5452% | 91.5452% |
The 402 panel combines 296 earlier, 92 chat and 14 contract records. The release reproduced all 1,030 FP32 development measurements from the completed training run. ONNX matched all1,030 prediction lists and raw/canonical token geometries exactly, including all type/language/address/leak/overmask/scenario metrics. No retraining, threshold adjustment or gold modification was used. Synthetic full-address, prior-vault overlap, restoration and overlength gateway checks passed.
| Type F1 on the 402 panel | FP32 (PyTorch and ONNX) | Retired weight-only INT8 |
|---|---|---|
| PERSON | 95.31% | 95.05% |
| ORGANIZATION | 85.53% | 84.28% |
| LOCATION | 94.34% | 94.34% |
| ADDRESS | 85.05% | 85.98% |
Training fit is separate: a fixed 512-view main-corpus subset scored 98.66%, all 2,400 colloquial views 98.02%, and the 64 FineWeb views 54.37% F1. Full 100k training fit was not measured in the final pass.
ONNX versus quantization
ONNX is a graph format; ONNX Runtime executes that graph. This export stays FP32. Quantization changes numeric representation and needs separate quality/kernel/resource qualification. On macOSARM64/CPU2, separate processes on the same synthetic workload measured PyTorch→ONNX load4.60→2.18s, short/medium/maximum input median93/234/811→43/141/675ms and peakRSS1.94→1.77GB. Package bytes excluding manifest:2,257,763,386. UI/agent/DockerVM are excluded; other processes were not fully isolated. This is not900MB whole-product acceptance or a general speed guarantee.
Current ONNX INT8 results
One per-channel dynamic quantization of the qualified FP32 graph, without training or a parameter sweep: 146 constant-weight MatMul operations become MatMulInteger with dynamic UINT8 activations and signed INT8 weights. Embeddings, normalization, attention's activation-only matrix products, LSTM cells, fusion graph and CRF retain FP32. The trained lexer, token geometry, projection and decoder are unchanged. This is a mixed-precision INT8 variant, not an all-INT8 model or the retired weight-only PyTorch implementation.
| Reused development panel | ONNX FP32 F1 | ONNX INT8 F1 |
|---|---|---|
| 402 | 90.9502% | 90.9707% |
| 436 | 93.8640% | 93.2007% |
| 192 | 91.5452% | 92.9412% |
53/1,030 prediction lists differ; exact equivalence failed. Publication of this
optional variant was authorized after the differences were reported; this does
not relabel the equality test as passed. FP32 remains the default. Character leakage
on 402/436/192 changes from 154/56/63 to 121/65/76, and overmasking from
85/54/15 to 127/84/19. Aggregate F1 gains do not erase the privacy regressions.
Per-type/language/address/scenario results are in evaluation.json under
variants.high/int8.qualification. These are reused development panels, not final tests.
Package files excluding manifest: 1,353,219,380 bytes, about40.1% smaller than
FP32. Both variants passed synthetic full-address/prior-vault/masking/restoration/422
gateway checks. Size reduction does not establish the900MB whole-product target.
MacARM64/CPU2, fresh process and the same synthetic short/medium/maximum workload:
load1.24s, medians21/115/662ms, peakRSS890,388,480bytes. This excludes UI/agent/DockerVM;
other host processes were not isolated. It is not whole-product900MB acceptance.
Historical PyTorch FP32 and weight-only INT8
INT8 stores Linear weights with symmetric per-output-row quantization and converts them to FP32 for computation. Activations, embeddings, normalization and sequence/fusion/CRF components remain FP32. This is a storage optimization, not INT8 GEMM acceleration or ONNX. The earlier dynamic-activation INT8 candidate was rejected for substantial quality loss.
| Resource | FP32 | INT8 |
|---|---|---|
| Package bytes, excluding manifest | 2,261,548,863 | 1,353,312,683 |
| Median latency, CPU 2 threads | 342 ms | 670 ms |
| p95 latency, CPU 2 threads | 474 ms | 821 ms |
| Peak process RSS, including load | 2.44 GB | 3.47 GB |
Measured on Linux/Ryzen 5600X over the same 1,030 texts, with one cold-load process per format. INT8 is 40.2% smaller but slower in this measurement. It loses one exact casebook address (84 → 83 of 88). Equal F1 on the 436 panel still includes changed type predictions and overmasking (54 → 66 characters). Full precision, recall, support, language/style/scenario and privacy counts are in historical evaluation.json. Retired INT8 panel F1:90.8267%/93.8640%/90.9621%; these are not ONNXINT8 scores.
Limitations
- Privacy errors remain. FP32 found 16/16 chat addresses exactly, but only 74/90 addresses in the older subset. Typed character coverage there was 5,318/5,430; any-type leakage still included 5 digits, 72 letters, 3 punctuation characters and 12 spaces. Typed non-whitespace address leakage in the 436/casebook panels was 38/43 characters.
- F1 is not complete masking. FP32 entity leakage on the 296/chat 92/contract 14 subsets was 153/1/0 characters; overmasking was 47/30/8. A partially covered mention is not fully protected.
- Preservation checks failed. All four training selection checkpoints failed at least one condition; the final checkpoint failed 38/243. Original MLM and additional retention checks also failed: additional TR NLL +0.07721/KL +0.10372, FR KL +0.80631. The 36-text/51-mask proxy is not a forgetting percentage or a broad capability assessment. Project-default status does not imply independent product acceptance.
- Generalization is unqualified. The corpus is Turkish-heavy and substantially templated. Some joined ASCII suffix boundaries are not representable by the native intervals. Confidence scores are not calibrated probabilities.
- Scope is limited. Four flat entity types, a 512-subtoken-per-view budget, and no OCR, long-document windowing or cross-message identity resolution.
ONNX has full macOSARM64 development parity, clean installed-package checks and network-disabled LinuxARM64 Docker gateway checks. Native Windows/Linuxx64 ONNX acceptance remains pending. This pinned ORT version has no IntelMac wheel. Historical PyTorch Linuxx64 results do not establish ONNX compatibility on that platform.
Gateway integration and next work
VeilGate combines NER with separate regex/parser/checksum recognizers for identity numbers, IBAN, phone, email, dates and plates. Session mappings, masking and permitted restoration are application responsibilities. A prior vault LOCATION contained in an already predicted longer ADDRESS yields to the address; this does not create a span the model missed.
The next priorities are independent natural Turkish/English evaluation; address boundaries and contextual hard negatives; broader multilingual retention; native CPU packaging; and smaller Low/Medium models selected by measured quality/resource tradeoffs. Secret detection, identity linking, task utility and policy need joint product evaluation. No release dates or automatic further training are implied.
License and references
Source licenses were checked at their acquisition revisions. The seven entity-value
sources declare MIT, Apache-2.0 or CC BY 4.0. OpenPII's license: other metadata is
qualified by its explicit CC BY 4.0 terms. FineWeb2 is ODC-By 1.0 plus CommonCrawl
terms; rights to every underlying website are not established. The derivative
therefore retains license: other and license_status: not_release_cleared.
See LICENSE, ATTRIBUTION and SOURCES for full credits, pins and conditions. Training/evaluation texts, raw predictions, private review packets and optimizer states are not distributed.
The attribution record also preserves earlier WikiNER, MultiCoNER, BTX24, MoganAI, Few-NERD and other source credits with their actual roles. These are separate from the final main-100k entity-value inventory. WikiANN is a distinct research-only input; its terms, NERdata authorship/license and the MultiCoNER license conflict remain unresolved. Retiring earlier models does not remove those credits.
Model tree for VEILGATETURKISH/veilgate-turkish
Base model
FacebookAI/xlm-roberta-large