Instructions to use KVCHub/Kava-Privacy-2.01M-mlx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use KVCHub/Kava-Privacy-2.01M-mlx with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] huggingface-cli download --local-dir Kava-Privacy-2.01M-mlx KVCHub/Kava-Privacy-2.01M-mlx
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
| language: | |
| - en | |
| license: mit | |
| tags: | |
| - pii | |
| - privacy | |
| - redaction | |
| - ner | |
| - token-classification | |
| - mlx | |
| - apple-silicon | |
| metrics: | |
| - f1 | |
| - accuracy | |
| library_name: mlx | |
| pipeline_tag: token-classification | |
| # π Kava Privacy (Apple Silicon MLX Transformer) | |
| [](https://opensource.org/licenses/MIT) | |
| [](https://github.com/ml-explore/mlx) | |
| [](#-model-performance) | |
| **Kava Privacy** is a lightweight, ultra-fast 2.01 Million parameter bidirectional Transformer model trained natively on Apple Silicon GPU via Apple MLX. It detects and redacts 16 categories of Personally Identifiable Information (PII) with **2.2ms latency**, **zero cloud data leakage**, and **100% false-positive immunity** on technical, financial, legal, and scientific text. | |
| --- | |
| ## π» CLI Usage | |
| Pass text directly via command line arguments or stdin: | |
| *1. Get the files from the Files tab of this repo** | |
| [https://huggingface.co/KVCHub/Kava-Privacy-2.01M-mlx/tree/main/]. Download the zip file | |
| *2. Install the dependencies (Apple Silicon Mac required):* | |
| Make sure you have pip installed before running the next command | |
| ```bash | |
| pip install mlx numpy | |
| ``` | |
| *2. Run it* | |
| ```bash | |
| python3 kava_privacy.py "Email me at jane.doe@gmail.com or call 555-123-4567. SSN is 501-22-9384." | |
| # Output: Email me at [EMAIL] or call [PHONE]. SSN is [SSN]. | |
| ``` | |
| --- | |
| ## π Python API Usage | |
| First install the libary | |
| ```python | |
| pip install kava-privacy | |
| ``` | |
| Sample Code: | |
| ```python | |
| from kava_privacy import KavaPrivacy | |
| kp = KavaPrivacy(model_name="2.01M") | |
| redacted, entities = kp.redact("Email me at jane.doe@gmail.com or call 555-123-4567.") | |
| print(redacted) | |
| # Output: "Email me at [EMAIL] or call [PHONE]." | |
| ``` | |
| You can restrict redaction to specific entity types: | |
| ```python | |
| redacted, entities = kp.redact(text, entity_types={"EMAIL", "PHONE"}) | |
| ``` | |
| --- | |
| ## π Model Performance | |
| - **Hard Adversarial Benchmark**: 100.0% Pass (12/12 Passed) | |
| - **Zero-Shot Out-Of-Distribution Benchmark**: 87.5% Pass Rate | |
| - **Inference Speed**: 2.2ms / document on Apple Silicon GPU | |
| - **Zero False Positives**: Ignores physics constants (`299,792,458 m/s`), subnets (`255.255.255.0`), legal rules (`12(b)(6)`), and stock tickers (`$182.50`). | |
| --- | |
| ## βοΈ Model Architecture & Specs | |
| - **Parameters**: 2,011,233 (2.01M Parameters) | |
| - **Model File Size**: 8.0 MB (`kava_privacy.safetensors`) | |
| - **Supported Entities (16)**: `NAME`, `EMAIL`, `PHONE`, `DOB`, `ADDRESS`, `SSN`, `CREDIT_CARD`, `IP`, `HANDLE`, `PASSPORT`, `VISA`, `DRIVER_LICENSE`, `BANK_ACCOUNT`, `ACCOUNT_NUMBER`, `URL`, `SECRET`. | |
| --- | |
| ## π License | |
| Licensed under the permissive [MIT License](LICENSE). Free for commercial and open-source applications. | |