How to use from the
Use from the
Transformers library
# Use a pipeline as a high-level helper
from transformers import pipeline

pipe = pipeline("token-classification", model="KvcHub/Kava-Privacy-30M")
# pip install -U transformers accelerate
# Load model directly
from transformers import AutoTokenizer, AutoModelForTokenClassification

tokenizer = AutoTokenizer.from_pretrained("KvcHub/Kava-Privacy-30M")
model = AutoModelForTokenClassification.from_pretrained("KvcHub/Kava-Privacy-30M", device_map="auto")
Quick Links

Kava-Privacy-30M

Kava-Privacy-30M is a 30.46M-parameter multilingual PII & Secrets redaction encoder trained 100% from scratch (custom 36-language tokenizer + randomly initialized ModernBERT encoder weights) for deterministic, zero-hallucination PII detection and redaction across 36 languages and 30 entity classes.

Training Dataset: Kava-Privacy-30M was trained exclusively on KvcHub/Kava-Privacy-30M-Dataset (284,526 examples across 36 languages, hosted separately as a dataset repository).

Model Summary

Property Value
Architecture ModernBertForTokenClassification (10 layers, hidden 384, 6 heads, GeGLU 1024, RoPE)
Parameters 30,457,021 (30.46M)
Initialization 100% from scratch (no pretrained weights)
Tokenizer Custom 32,768-vocab 36-language Byte-Level BPE with individual digit splitting
Training Dataset KvcHub/Kava-Privacy-30M-Dataset
Training Curriculum 2-hour wall-clock run (121.4 min, 34.6M tokens total): Stage 1 Multilingual MLM Pretraining (30 min) -> Stage 2 BIO Token Classification (90 min)
Hardware Single Apple M5 Pro (24 GB unified memory, zero disk swap)
Languages 36 languages across 12 writing systems
Entity Classes 30 PII & Secrets categories (61 BIO labels)

Held-Out Test Benchmarks

Evaluated on 8,503 held-out test documents (54,326 PII spans across 36 languages) using strict exact character-span match (start offset, end offset, and entity type must all match โ€” even 1 character off counts as wrong; scores are reported on the standard 0.0โ€“1.0 scale where 1.00 = 100%):

  • Exact Span F1: 91.46% (0.9146)
  • Exact Span Precision: 89.52% (0.8952)
  • Exact Span Recall: 93.48% (0.9348)
  • Hard-Negative False Positive Rate (605 zero-PII docs): 0.00% (0.0000 โ€” zero false redactions on version numbers, SKUs, dates, and technical prose)
  • Unseen Real-World Forms (nvidia/Nemotron-PII, 10,045 spans): 93.26% Exact Span F1 (95.29% Recall)
  • High-Risk Secrets & IDs: DB_CONNECTION 100.0% ยท CRYPTO_WALLET 100.0% ยท TAX_ID 99.8% ยท PASSPORT 99.4% ยท MEDICAL_ID 99.2% ยท AUTH_TOKEN 98.6% ยท API_KEY 98.2% ยท NATIONAL_ID 97.9% ยท CREDIT_CARD 97.8% ยท EMAIL 97.3%
  • Inference Throughput (Apple M5 Pro MPS): 33.3 docs/sec (~30 ms/doc) ยท Model Size: 116 MB (30.46M params)

Tiny Footprint, Massive Punch โ€” Industry Comparison

Kava-Privacy-30M delivers production-grade multilingual PII & secrets redaction in just 30.46M parameters (116 MB) โ€” ~9ร— smaller than popular open-source encoder redactors (~280M) and thousands of times smaller than cloud frontier LLMs like OpenAI GPT-4o, while keeping 100% of sensitive data on-device with zero API cost and zero generative hallucination:

Solution Size / Footprint Languages PII & Secret Scope Runs 100% Offline? Hallucination / Prompt-Injection Risk Typical Speed Reported Benchmark / Notes
KvcHub/Kava-Privacy-30M 30.46M (116 MB) 36 (12 scripts) 30 classes (personal, financial, medical, gov IDs + API keys, JWTs, DB URLs) Yes (CPU / MPS / CUDA) None (deterministic BIO span tagging) ~30 ms/doc (33.3 docs/s MPS) 91.46% Exact Span F1 (93.48% Recall, 0.00% hard-neg FPR, 93.26% F1 on held-out Nemotron-PII) โ€” trained 100% from scratch in 2h
OpenAI GPT-4o (cloud LLM redaction) Cloud-only (hundreds of billions of params) Broad multilingual Prompt-defined No (requires sending raw PII to external cloud servers) Yes (generative rewrites can alter non-PII text or follow injected instructions) ~500 ms โ€“ 3+ s/doc + API cost High semantic ceiling on complex prose (e.g. ~60%โ€“65% strict F1 on hard medical/legal suites), but creates a privacy paradox & high latency/cost
iiiorg/piiranha-v1 (mDeBERTa-v3-base) 280M (9ร— larger) 6 (EN, ES, FR, DE, IT, NL) 17 PII classes Yes None (token classifier) Tens of ms/doc 93.12% reported token-level multi-class F1 on its 6-language test set
nvidia/gliner-PII (GLiNER encoder) 160Mโ€“300M (5โ€“10ร— larger) Primarily English Zero-shot / configurable Yes None (span extractor) Tens of ms/doc (GPU) 87.0% reported strict F1 on NVIDIA's internal eval suite (ฯ„=0.3)
urchade/gliner_multi_pii-v1 (mDeBERTa-v3) 280M (9ร— larger) 6 (EN, FR, DE, ES, IT, PT) 40+ zero-shot labels Yes None (span extractor) Tens of ms/doc (GPU) Strong zero-shot flexibility; weaker on non-Latin scripts
Microsoft Presidio (Regex + spaCy NER) Lightweight (~15 MB+ spaCy) Primarily English (per-lang pipelines) Pattern/rule-driven + NER Yes None <10โ€“50 ms/doc Very strong on rigid regex formats; drops sharply (~30%โ€“50% F1) on unstructured/contextual prose

Fairness note: Each external tool's reported score comes from its own published benchmark suite rather than a single shared test set. Size, disk footprint, language coverage, offline privacy guarantees, and non-generative safety are direct architectural comparisons.

Live Redaction Examples

[en]

  • Input: Hi, I'm Elena Vance (DOB 1989-04-12). Email: elena.vance@proton.me, SSN 412-88-9021, API key sk-proj-9kLm2PqR8vTx4YzA7bCdEfGhIjKlMnOpQrSt.
  • Redacted: Hi, I'm [PERSON] (DOB [DATE_OF_BIRTH]). Email: [EMAIL], SSN [NATIONAL_ID], API key [API_KEY].

[es]

  • Input: Hola, soy Mateo Garcรญa, correo mateo.garcia@gmail.com, telรฉfono +34 612 345 678, DNI 48291034K.
  • Redacted: Hola, soy [PERSON], correo [EMAIL], telรฉfono [PHONE], DNI [NATIONAL_ID].

[zh]

  • Input: ๆ‚จๅฅฝ๏ผŒๆ‚ฃ่€…ๅผ ไผŸ๏ผŒๆ‰‹ๆœบๅท +86 138 0013 8000๏ผŒ่บซไปฝ่ฏๅท 110101199001011234๏ผŒ่ฏŠๆ–ญ๏ผš2ๅž‹็ณ–ๅฐฟ็—…ใ€‚
  • Redacted: ๆ‚จๅฅฝ๏ผŒๆ‚ฃ่€…[PERSON]๏ผŒๆ‰‹ๆœบๅท [PHONE]๏ผŒ่บซไปฝ่ฏๅท [NATIONAL_ID]1234๏ผŒ่ฏŠๆ–ญ๏ผš2ๅž‹็ณ–ๅฐฟ็—…ใ€‚

[ar]

  • Input: ู…ุฑุญุจุงู‹ุŒ ุงู„ุงุณู… ุงู„ูƒุงู…ู„: ุนู…ุฑ ุงู„ู…ู†ุตูˆุฑุŒ ุงู„ุจุฑูŠุฏ ุงู„ุฅู„ูƒุชุฑูˆู†ูŠ: omar.mansour@outlook.comุŒ ุฑู‚ู… ุงู„ู‡ุงุชู: +971 501 234 5678.
  • Redacted: ู…ุฑุญุจุงู‹[CITY] ุงู„ุงุณู… ุงู„ูƒุงู…ู„: [PERSON] ุงู„ุจุฑูŠุฏ ุงู„ุฅู„ูƒุชุฑูˆู†ูŠ: [EMAIL] ุฑู‚ู… ุงู„ู‡ุงุชู: [PHONE].

[ja]

  • Input: ๆฐๅ: ไฝ่—ค ่“ฎใ€ไฝๆ‰€: ๆธ‹่ฐทๅŒบ้“็Ž„ๅ‚ 24ใ€ใƒกใƒผใƒซใ‚ขใƒ‰ใƒฌใ‚น: ren.sato@icloud.comใ€‚
  • Redacted: ๆฐๅ: [PERSON]ใ€ไฝๆ‰€: [ADDRESS]ใ€ใƒกใƒผใƒซใ‚ขใƒ‰ใƒฌใ‚น: [EMAIL]

[hard_neg]

  • Input: Release v2.14.8 fixes a memory leak in the cache layer and passes 184 unit tests for SKU-90412-XL.
  • Redacted: Release v2.14.8 fixes a memory leak in the cache layer and passes 184 unit tests for SKU-90412-XL.

Quickstart

Option 1: Using transformers pipeline directly

from transformers import pipeline

ner = pipeline(
    "token-classification",
    model="KvcHub/Kava-Privacy-30M",
    aggregation_strategy="simple",
)
print(ner("Contact Alice Smith at alice@example.com or SSN 123-45-6789."))

Option 2: Full Deterministic Redaction with redactor.py

from huggingface_hub import hf_hub_download
import importlib.util

path = hf_hub_download("KvcHub/Kava-Privacy-30M", "redactor.py")
spec = importlib.util.spec_from_file_location("redactor", path)
mod = importlib.util.module_from_spec(spec)
spec.loader.exec_module(mod)

redactor = mod.KavaRedactor.from_pretrained("KvcHub/Kava-Privacy-30M")
out = redactor.redact("Patient John Doe, MRN-4829103, email john@clinic.org, API key sk-proj-abc123...")
print(out["redacted_text"])
print(out["spans"])

Per-Entity Test Performance (30 Classes)

Entity Type Precision Recall F1 Support
PERSON 0.8065 0.8442 0.8249 7,747
USERNAME 0.8178 0.8245 0.8211 1,698
EMAIL 0.9664 0.9787 0.9725 3,759
PHONE 0.8949 0.9185 0.9066 2,995
ADDRESS 0.8121 0.9134 0.8597 3,406
CITY 0.7468 0.9000 0.8163 2,150
POSTAL_CODE 0.9116 0.9755 0.9425 1,840
DATE_OF_BIRTH 0.9798 0.9810 0.9804 1,583
AGE 0.9762 0.9914 0.9837 1,157
NATIONAL_ID 0.9699 0.9876 0.9787 1,208
PASSPORT 0.9972 0.9908 0.9940 1,092
DRIVER_LICENSE 0.9848 0.9778 0.9813 1,128
TAX_ID 0.9972 0.9991 0.9981 1,062
CREDIT_CARD 0.9789 0.9768 0.9778 948
CVV_PIN 0.9359 0.9458 0.9408 941
BANK_ACCOUNT 0.9376 0.9807 0.9587 1,608
CRYPTO_WALLET 1.0000 1.0000 1.0000 580
MEDICAL_ID 0.9893 0.9952 0.9923 840
MEDICAL_INFO 0.8515 0.9774 0.9101 839
IP_ADDRESS 0.9610 0.9867 0.9737 1,349
MAC_ADDRESS 0.9895 0.9958 0.9926 949
DEVICE_ID 0.9836 0.9948 0.9892 967
URL_SENSITIVE 0.9664 0.9759 0.9711 1,620
PASSWORD 0.9278 0.9579 0.9426 926
API_KEY 0.9740 0.9905 0.9822 1,058
AUTH_TOKEN 0.9804 0.9923 0.9863 909
DB_CONNECTION 1.0000 1.0000 1.0000 670
VEHICLE_ID 0.9804 0.9971 0.9887 1,052
ORGANIZATION 0.7945 0.8621 0.8269 5,583
ACCOUNT_ID 0.9668 0.9835 0.9750 2,662

Per-Language Test Performance (36 Languages)

Code Language Precision Recall F1 Support
en English 0.8560 0.9140 0.8841 14,545
es Spanish 0.7898 0.8420 0.8151 1,633
fr French 0.8567 0.9086 0.8819 1,553
de German 0.8488 0.8820 0.8651 1,687
it Italian 0.8190 0.8706 0.8440 1,538
pt Portuguese 0.9489 0.9657 0.9572 1,020
nl Dutch 0.7919 0.8263 0.8087 1,727
pl Polish 0.9775 0.9877 0.9826 1,056
ru Russian 0.9800 0.9847 0.9823 1,044
uk Ukrainian 0.9511 0.9755 0.9631 978
tr Turkish 0.9761 0.9884 0.9822 1,033
ar Arabic 0.8863 0.9473 0.9158 1,119
he Hebrew 0.9435 0.9723 0.9577 1,048
fa Persian 0.9694 0.9794 0.9744 1,068
hi Hindi 0.8952 0.9572 0.9252 982
bn Bengali 0.9023 0.9630 0.9317 1,055
ur Urdu 0.9630 0.9867 0.9747 1,054
ta Tamil 0.9523 0.9686 0.9604 1,051
zh Chinese (Simplified) 0.9647 0.9787 0.9717 1,034
zh-TW Chinese (Traditional) 0.9499 0.9676 0.9587 1,019
ja Japanese 0.8909 0.9437 0.9165 1,030
ko Korean 0.9581 0.9738 0.9659 1,032
vi Vietnamese 0.9586 0.9836 0.9709 1,035
th Thai 0.8344 0.9165 0.8735 1,006
id Indonesian 0.9709 0.9853 0.9780 1,017
ms Malay 0.9410 0.9682 0.9544 1,037
tl Filipino 0.9702 0.9823 0.9762 962
sv Swedish 0.8006 0.8195 0.8099 1,612
no Norwegian 0.9621 0.9751 0.9685 884
da Danish 0.9633 0.9749 0.9691 1,077
fi Finnish 0.9666 0.9865 0.9765 1,114
cs Czech 0.9698 0.9888 0.9792 1,073
ro Romanian 0.9542 0.9737 0.9638 1,026
hu Hungarian 0.8763 0.9379 0.9060 1,095
el Greek 0.8823 0.9451 0.9126 1,039
sw Swahili 0.9441 0.9722 0.9580 1,043

Separation of Artifacts

  • Model Repository: KvcHub/Kava-Privacy-30M (model weights, custom tokenizer, redactor.py, evaluation metrics โ€” no dataset files)
  • Dataset Repository: KvcHub/Kava-Privacy-30M-Dataset (36-language training, validation, and test Parquet shards)

Security & KvcHub Model Comparison

See SECURITY.md for the full threat model, deployment checklist, and vulnerability reporting policy.

KvcHub Model Security Comparison

Model Task Params Weight Format (Pickle-Free) Runtime Isolation Training Provenance Data / Secret Hygiene Supply-Chain & Checksums License
Kava-Privacy-30M PII Redaction (36 langs, 30 entities) 30.46M safetensors (Yes) 100% local / offline (Transformers, CPU/MPS/CUDA) 100% from scratch Synthetic 36-lang + CC-BY-4.0/Apache-2.0 synthetic PII; no real user PII; zero-hallucination span tagging HF LFS SHA-256 + eval_results.json Apache-2.0
Kava-Privacy-2.01M-mlx PII Redaction (EN, 16 entities) 2.01M safetensors (Yes) 100% local / offline (Apple MLX) 100% from scratch Fully synthetic training data; zero cloud calls HF LFS SHA-256 (kava_privacy.py custom loader) MIT
Kava-Privacy-636k-mlx PII Redaction (EN, 9 entities) 636K safetensors (Yes) 100% local / offline (Apple MLX) 100% from scratch Fully synthetic training data; zero cloud calls HF LFS SHA-256 (kava_privacy.py custom loader) MIT
KaiLu-3-Pro Conversational LM 1.03B safetensors + GGUF (Yes) 100% local / offline (llama.cpp, Ollama, Transformers) 100% from scratch Public open corpora + DPO (UltraFeedback, HelpSteer2, HH-RLHF); no formal red-team audit Explicit SHA256SUMS + HF LFS SHA-256 Apache-2.0
KaiLu-3-Mini Conversational LM 329M safetensors + GGUF (Yes) 100% local / offline (Transformers, llama.cpp) 100% from scratch Public open corpora + DPO (UltraFeedback, HelpSteer2, HH-RLHF); no formal red-team audit HF LFS SHA-256 KaiLu-3 License (Non-commercial)
KaiLu-Web In-Browser Chat LM 329M / 1.03B Split GGUF (Yes) Browser WebAssembly sandbox (wllama); zero server calls Packaged from KaiLu-3 / 3-Pro Same as KaiLu-3 / 3-Pro; browser COOP/COEP isolation HF LFS SHA-256 Per-file (Apache-2.0 / KaiLu-3)
KaiLu-2-2B-GGUF Reasoning & Chat LM 1.90B GGUF F16โ€“Q2_K (Yes) 100% local / offline (llama.cpp) 100% from scratch (distilled text mix) Public open datasets + synthetic reasoning; no formal safety red-teaming HF LFS SHA-256 + stats.json Apache-2.0
KaiLu-1-933M Mobile / Desktop Chat LM 933M safetensors + GGUF (Yes) 100% local / offline (Apple MLX / mobile GGUF) 100% from scratch Offline on-device execution; legacy v1 release HF LFS SHA-256 Apache-2.0
Ki-Complete-7B Code Autocomplete (FIM) 7B (LoRA r=64) GGUF + PEFT safetensors (Yes) 100% local / offline (llama-server on 127.0.0.1) Fine-tuned on Qwen2.5-Coder-7B Permissive-license code only; pre-training secret/key scan + extension blocks novel key-shaped strings HF LFS SHA-256 Apache-2.0
Ki-Complete-1.5B Code Autocomplete (FIM) 1.5B (LoRA r=64) GGUF + PEFT safetensors (Yes) 100% local / offline (llama-server on 127.0.0.1) Fine-tuned on Qwen2.5-Coder-1.5B Permissive-license code only; pre-training secret/key scan + extension blocks novel key-shaped strings HF LFS SHA-256 Apache-2.0

KvcHub Model Benchmark Comparison

1. PII Redaction Family (Kava-Privacy)

Model Params Languages Entities Architecture Primary Benchmark Result False-Positive / Hard-Neg Check Speed (Apple Silicon)
Kava-Privacy-30M 30.46M 36 30 (61 BIO) ModernBERT (from scratch) Held-out test Exact Span F1 91.46% (0.9146 ยท P 89.52% / R 93.48%) Hard-Neg FPR: 0.00% 33.3 docs/sec (MPS)
Kava-Privacy-2.01M-mlx 2.01M 1 (EN) 16 MLX Encoder (from scratch) Adversarial 100% (12/12) ยท Zero-shot OOD 87.5% 0% on physics/subnet/legal/ticker suite 2.2 ms / doc (MLX)
Kava-Privacy-636k-mlx 636K 1 (EN) 9 4L MLX Encoder (from scratch) Synthetic val token acc 99.6%โ€“100.0% across 9 tags Synthetic val O-tag acc 100.0% Sub-ms (2.4 MB weights)

2. Conversational & Reasoning LM Family (KaiLu)

Model Params Architecture Context (Trained) Footprint (Recommended) Speed (Apple Silicon) Reported Benchmarks
KaiLu-3-Pro 1.03B LFM2 Hybrid (36L) 1,024 (51K cfg) 1.09 GB (Q8_0 GGUF) / 2.07 GB (bf16) Local CPU/Metal/Ollama Benchmarks intentionally omitted (MMLU/ARC/HumanEval/GSM8K included in SFT; evaluate on unseen data)
KaiLu-3-Mini 329M LFM2 Hybrid (24L) 1,024 model.safetensors + kailu-3.gguf Local CPU/Metal Pretrained on 6.6B tokens + 460K SFT + 60K DPO pairs (no formal eval table published)
KaiLu-Web 329M / 1.03B LFM2 Hybrid (wllama WASM) 1,024 351 MB (3-Q8_0) / 623 MB (3-Pro-Q4_K_M) In-browser WASM Browser-packaged builds of KaiLu-3-Mini & KaiLu-3-Pro
KaiLu-2-2B-GGUF 1.90B LFM2 Hybrid (104L) 1,024 (4K GGUF) 1.17 GB (Q4_K_M, 1.51 GB RAM) 107 tok/s GPU / 64 tok/s CPU (Q4_K_M) Held-out PPL 11.003 (F16) / 11.077 (Q4_K_M); 8th-grade math 75.0%; Random math 43.3%; Unseen-vocab IQ 72.5%
KaiLu-1-933M 933M MLX Transformer โ€” 546 MB mobile GGUF (1.15 GB RAM) 260+ tok/s (Apple Silicon) Legacy v1 baseline (no formal benchmark suite published)

3. Code Autocomplete Family (Ki-Complete) โ€” Measured on Apple M5 Pro (llama.cpp, Q8_0)

Model Params Base Model HumanEval-Infill (1-line) HumanEval-Infill (multi-line) HumanEval-Infill (mid-line) Real Code Exact Line (no ctx / w/ ctx) Unwanted Extra Lines Latency (no ctx / w/ ctx)
Ki-Complete-7B 7B Qwen2.5-Coder-7B 95.0% 53.5% 46.3% 49.7% / 37.7% ยท 52.9% / 41.7% 4% (vs 42% base) 1.00 s / 4.5 s
Ki-Complete-1.5B 1.5B Qwen2.5-Coder-1.5B 89.4% 53.4% 40.9% 44.0% / 36.0% ยท 45.1% / 38.6% 3% (vs 65% base) 0.23 s / 1.1 s

Research Papers & Technical Reports

Five accompanying research papers (Markdown + arXiv-ready LaTeX + 300-DPI figures + reproducible benchmarks) are published at KvcHub/KvcHub-Research-Papers:

  1. Kava-Privacy-30M โ€” Training a 36-Language, 30-Entity PII & Secrets Redaction Encoder from Scratch in Two Hours on a Single Laptop
  2. Zero-Swap Training on Unified Memory โ€” Eliminating MPSGraph Cache Explosion and Dynamic-Shape Leaks on Apple Silicon
  3. How Small Is Safe Enough? โ€” Scaling Laws for From-Scratch On-Device PII Redaction from 636K to 30M Parameters
  4. PolyPII-36 โ€” A 36-Language, 12-Script Benchmark for Joint Personal PII and Developer Secret Redaction
  5. The Zero-Cloud AI Workstation โ€” Combining Sub-30ms Deterministic PII Firewalls with Local Code and In-Browser Language Models
Downloads last month
-
Safetensors
Model size
30.5M params
Tensor type
F32
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Dataset used to train KvcHub/Kava-Privacy-30M

Collection including KvcHub/Kava-Privacy-30M

Evaluation results

  • Exact Span F1 on Kava-Privacy-30M-Dataset (test)
    self-reported
    0.915
  • Exact Span Precision on Kava-Privacy-30M-Dataset (test)
    self-reported
    0.895
  • Exact Span Recall on Kava-Privacy-30M-Dataset (test)
    self-reported
    0.935