|
Download README.md from dekka-cloud/veil-ner-deep: direct link, hf CLI and curl.
- Browser
- Download file 12.2 kB
-
https://huggingface.co/dekka-cloud/veil-ner-deep/resolve/main/README.md
- Command line
-
hf download hf://dekka-cloud/veil-ner-deep/README.md
-
curl -L -o README.md https://huggingface.co/dekka-cloud/veil-ner-deep/resolve/main/README.md
12.2 kB
| license: cc-by-4.0 | |
| language: | |
| - en | |
| - tw | |
| - fat | |
| - gaa | |
| - ee | |
| - gpe | |
| pipeline_tag: token-classification | |
| base_model: microsoft/mdeberta-v3-base | |
| library_name: onnx | |
| tags: | |
| - pii | |
| - privacy | |
| - ghana | |
| - data-protection | |
| - onnx | |
| # Veil NER deep | |
| Veil NER deep finds personal information in Ghanaian text, so it can be masked before the text leaves your systems. It reads English, Twi, Fante, Ga, Ewe and Ghanaian Pidgin, and the way people mix them, and it knows Ghanaian identifiers such as Ghana Card PINs, mobile money numbers and GhanaPost GPS addresses. | |
| It is the precise model of [Dekka Veil](https://dekka.cloud/veil), built by [Dekka](https://dekka.cloud) in Accra. It is 536 MB and runs on an ordinary CPU, taking 1.2 to 1.5 s for a kilobyte of text on a single thread of a 2020 Apple M1 with 8 GB of memory, so it suits documents and transcripts processed in batches. For anything a person waits on, its fast sibling [veil-ner-nano](https://huggingface.co/dekka-cloud/veil-ner-nano) takes about 40 ms. | |
| ## Run it | |
| ```bash | |
| pip install onnxruntime tokenizers numpy pyyaml huggingface_hub | |
| ``` | |
| ```python | |
| from huggingface_hub import snapshot_download | |
| import importlib.util | |
| path = snapshot_download("dekka-cloud/veil-ner-deep") | |
| spec = importlib.util.spec_from_file_location("veil_ner", f"{path}/veil_ner.py") | |
| veil_ner = importlib.util.module_from_spec(spec); spec.loader.exec_module(veil_ner) | |
| model = veil_ner.VeilNER(path) | |
| for span in model("Me din de Akosua Mensah, patient PT-204118. Frɛ me wɔ 024 412 3456."): | |
| print(span) | |
| # {'label': 'PERSON_NAME', 'start': 10, 'end': 23, 'text': 'Akosua Mensah', 'score': 0.9998} | |
| # {'label': 'PATIENT_ID', 'start': 33, 'end': 42, 'text': 'PT-204118', 'score': 0.9078} | |
| # {'label': 'GH_MOBILE_NUMBER', 'start': 54, 'end': 66, 'text': '024 412 3456', 'score': 0.9997} | |
| ``` | |
| Or from the command line, after downloading the repository: `python veil_ner.py --model dekka-cloud/veil-ner-deep "Me din de Akosua Mensah, patient PT-204118"`. | |
| `veil_ner.py` needs nothing but ONNX Runtime, the `tokenizers` library and NumPy. It reads `manifest.yaml` for the labels, the tokenizer window and the confidence threshold (0.80), and decodes the model's output exactly as Dekka Veil does, span for span. Long text is read in overlapping windows of 256 tokens, and each returned span has a label, character offsets, the text and a confidence score. | |
| ### Running both models | |
| Each model is its own directory with the same files, so the same code loads either one. Load [veil-ner-nano](https://huggingface.co/dekka-cloud/veil-ner-nano) where someone waits on the answer, such as a gateway in front of an AI model, and deep for documents and transcripts processed in batches, where its extra precision on names is worth the time. | |
| ```python | |
| nano = veil_ner.VeilNER(snapshot_download("dekka-cloud/veil-ner-nano")) | |
| deep = veil_ner.VeilNER(snapshot_download("dekka-cloud/veil-ner-deep")) | |
| ``` | |
| ## What it finds | |
| | Kind | Labels | | |
| | --- | --- | | |
| | People | `PERSON_NAME`, `PERSON_ALIAS`, `ACCOUNT_HOLDER_NAME` | | |
| | Where they live | `ADDRESS` (free-text addresses and directions), `GH_DIGITAL_ADDRESS` (GhanaPost GPS) | | |
| | How to reach them | `GH_MOBILE_NUMBER`, `GH_LANDLINE_NUMBER`, `EMAIL_ADDRESS`, `IP_ADDRESS` | | |
| | National and financial identifiers | `GH_GHANA_CARD_PIN`, `GH_TAX_IDENTIFIER`, `BANK_ACCOUNT_NUMBER`, `PAYMENT_CARD_PAN`, `GH_VEHICLE_REGISTRATION` | | |
| | Institutional IDs | `PATIENT_ID`, `STUDENT_ID`, `EMPLOYEE_ID` | | |
| Phone numbers read aloud as words in English, Akan or Ewe count as phone numbers. A place named on its own, such as "Kumasi", isn't labelled, because on its own it identifies nobody. Organisations' switchboard numbers and the plates of public buses aren't personal either, and the model leaves them alone: on its own it flagged 1 of the synthetic test's 471 decoys. | |
| ## How it compares | |
| We measured Veil against the two general-purpose open tools people reach for, [Presidio](https://github.com/microsoft/presidio), which is rule-based, and [GLiNER PII small](https://huggingface.co/knowledgator/gliner-pii-small-v1.0), an open-weights model, run zero-shot at its threshold of 0.5. All three read the same sets on the same machine. | |
| | Set | Measure | Veil NER deep | GLiNER PII small | Presidio | | |
| | --- | --- | --- | --- | --- | | |
| | Synthetic Ghanaian test, 3,000 records | Details covered in full | **90.7%** | 68.6% | 70.7% | | |
| | | Characters left readable | **5.6%** | 37.9% | 35.8% | | |
| | Real Ghanaian call sentences with synthetic details, 600 records | Details covered in full | **100%** | 48.8% | 74.0% | | |
| | | Characters left readable | **0%** | 69.0% | 48.1% | | |
| | | Decoys wrongly flagged, of 88 | **0** | 0 | 67 | | |
| | Real call transcripts, 497 sentences | Names found, of 15 | **12** | 0 | 15 | | |
| | | Things wrongly flagged as personal | **0** | 3 | 255 | | |
| On every Ghanaian set we measured, Veil covers more personal information and leaves far less of it readable than the general-purpose tools, and it does it on a CPU. On the real transcripts, GLiNER found none of the names, and Presidio found them all only by flagging 255 ordinary words along with them. | |
| **Real Twi and Ewe news.** On the test split of [MasakhaNER 2.0](https://github.com/masakhane-io/masakhane-ner), real news text with names labelled by people, the model finds 63.7% of Twi names at 67.0% precision and 79.4% of Ewe names at 91.9% precision. That precision is what it is for: where veil-ner-nano finds a few more names by flagging more words, deep is right far more often about what it flags. | |
| ### With Dekka Veil's rules | |
| Inside [Dekka Veil](https://dekka.cloud/veil) the model runs beside rules that validate the structured identifiers it also finds. Together they do better than either alone. | |
| | Set | Measure | Model alone | Model with Veil's rules | | |
| | --- | --- | --- | --- | | |
| | Synthetic Ghanaian test | Details covered in full | 90.7% | 95.8% | | |
| | | Characters left readable | 5.6% | 2.2% | | |
| | | Decoys wrongly flagged, of 471 | 1 | 0 | | |
| | Real call sentences with synthetic details | Details covered in full | 100% | 100% | | |
| The rules are part of Dekka Veil, which runs in Dekka's AI Gateway. This repository holds the model. | |
| ## How we measured | |
| Every figure on this card comes from one evaluation run on 5 November 2026, and we report it per set so no single blended number hides a weakness. | |
| - **Details covered in full** is the share of personal details whose every character the model covered. A name half-masked still gives the person away, so partial cover doesn't count. | |
| - **Characters left readable** is the share of the characters of personal details that stayed visible. It is what a reader would still see. | |
| - **Decoys** are things that look personal and aren't, such as a hospital's switchboard number, a bus plate in a news report or a product code. Flagging them is a false alarm. | |
| The four sets are different kinds of evidence, and we read each for what it is. | |
| 1. **Synthetic Ghanaian test ([veil-synth-gh v0.3](https://huggingface.co/datasets/dekka-cloud/veil-synth-gh), 3,000 records).** Banking, mobile money, health, education, government, support chats and prompts to AI assistants, with every name and identifier generated, in sentence shapes training never saw. It is the widest test, and it flatters every tool, because its templates were written by the same people as the training templates. | |
| 2. **Real call sentences with synthetic details (600 records).** Real sentences from banking and airtime call transcripts that training never saw, with synthetic names and numbers written in. The 100% is partly by construction, because the details were written in the way training wrote them, so it shows the model reads this kind of speech rather than proving it can't miss. | |
| 3. **Real call transcripts (497 sentences).** Real transcripts in Ghanaian languages whose 15 names we labelled ourselves. No native speaker has reviewed those labels yet, so we call them silver. | |
| 4. **MasakhaNER 2.0 test (real Twi and Ewe news).** The only real text with labels made by native speakers. It labels names and places, so it measures names alone. | |
| The confidence threshold was chosen on held-out validation text, real call sentences and MasakhaNER's development split, never on any test set, so the test figures weren't tuned on. | |
| ## How it was trained | |
| The model is [mDeBERTa-v3-base](https://huggingface.co/microsoft/mdeberta-v3-base), a multilingual encoder, fine-tuned on [veil-synth-gh v0.3](https://huggingface.co/datasets/dekka-cloud/veil-synth-gh) for two epochs at learning rate 3e-5, with batch 32, AdamW and 6% warmup, bf16 and seed 20261104, using PyTorch 2.8 and Transformers 5.22.1. The checkpoint was chosen by the mean of overlap F1 on synthetic validation text and on held-out real call sentences, where it scored 91.2, the best of every model we trained for this release, AfroXLMR teachers included. | |
| We quantised it with care. Quantising every matrix multiplication to int8, which suits veil-ner-nano, cut this model's overlap F1 on the synthetic test from 90.5 to 55.0, because mDeBERTa's activations carry outliers that one scale per tensor can't hold. So only its embedding table, most of its size, is int8, and the rest stays in float32, which keeps it at 90.4. | |
| **Compute and cost.** The model itself trained in about four minutes on a single NVIDIA A40. Everything behind this release, eleven candidate models trained and compared across three sessions, took 4 hours 15 minutes on that one A40 and cost US$2.56. Each session shut its GPU down the moment its results were saved, and the shipped model runs on a CPU, so serving it needs no GPU at all. | |
| ## Data and credits | |
| None of the training text contains a real person's details. Every name and identifier the model learned from was generated, and real sentences were used only as the words around them. Our thanks to the people who made the open data this rests on. | |
| - **Ashesi University and Nokwary Technologies**, for the [Financial Inclusion Speech Dataset](https://github.com/Ashesi-Org/Financial-Inclusion-Speech-Dataset), funded by Lacuna Fund. Its transcripts of real banking and airtime calls in Twi, Fante, Ga and Ewe give the synthetic records real Ghanaian speech to sit in. Licensed CC BY 4.0. | |
| - **Masakhane**, for [InjongoIntent](https://huggingface.co/datasets/masakhane/InjongoIntent)'s Twi and Ewe sentences (Apache 2.0), and for MasakhaNER 2.0, used only to set the threshold and to measure the model (CC BY-NC 4.0, so it trained nothing). | |
| - **Onomaverse** for name data and **GeoNames** for place names, both CC BY 4.0. | |
| - **Unicode CLDR** for Akan and Ewe number words (Unicode License v3). | |
| - **Wikidata** for names and **Mozilla Common Voice** for Twi sentences, both CC0. | |
| - **Microsoft** for mDeBERTa-v3-base, the base model (MIT). | |
| This model was trained on veil-synth-gh alone, with no web text. | |
| ## Limits | |
| - **Measure it on your own text first** if yours differs from messages, forms, call transcripts and prompts, such as long legal documents or OCR output. | |
| - **It isn't a guarantee.** It lowers what leaves, and it can't promise a text holds nothing personal. | |
| - **It takes over a second per kilobyte** on one CPU thread, so use veil-ner-nano where a person waits on the answer. | |
| - **Some IDs aren't covered.** Passport, voter ID, NHIS, WAEC index and driver's licence numbers aren't trained, because their formats aren't published, and Ga numbers said aloud are found only when said in English. | |
| - **Not for watching people.** It is for keeping personal information out of places it shouldn't go, and it isn't for identifying, profiling or tracking anyone, or for making decisions about people. | |
| ## Licence | |
| The weights are released under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), so you can use and adapt them, commercially too, as long as you credit Dekka. They build on mDeBERTa-v3-base, whose MIT notice is in `NOTICE`, and the data credits above travel with them. | |
| ## Cite | |
| ```bibtex | |
| @misc{dekka2026veildeep, | |
| title = {Veil NER deep: personal information detection for Ghanaian text}, | |
| author = {Buaba, Jerry and Dekka}, | |
| year = {2026}, | |
| url = {https://huggingface.co/dekka-cloud/veil-ner-deep} | |
| } | |
| ``` | |