KVC899's picture
Update README.md
8b11d0e verified
|
Raw
History Blame Contribute Delete
2.88 kB
---
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)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Framework: Apple MLX](https://img.shields.io/badge/Framework-Apple_MLX-orange.svg)](https://github.com/ml-explore/mlx)
[![Latency: 2.2ms](https://img.shields.io/badge/Latency-2.2ms-green.svg)](#-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.