Metadata-Version: 2.4
Name: kava-privacy
Version: 1.0.0
Summary: Ultra-fast on-device PII redaction engine trained natively on Apple Silicon MLX GPU
Home-page: https://huggingface.co/KVCHub/Kava-Privacy-636k-mlx
Author: Kava Privacy Team
License: MIT
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: mlx>=0.15.0
Requires-Dist: numpy>=1.20.0
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-python

---
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:

```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].
```

Or pipe text from stdin:

```bash
cat log.txt | python3 kava_privacy.py
```

---

## 🐍 Python API Usage

```python
from kava_privacy import KavaPrivacy

# 1. Load default 2.01M Parameter Model (KVCHub/Kava-Privacy-2M-mlx)
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]."

# 2. Load 636k Parameter Lightweight Model (KVCHub/Kava-Privacy-636k-mlx)
kp_636k = KavaPrivacy(model_name="636k")
print(kp_636k.redact("Call 555-987-6543.")[0])
```

---

## 📊 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.
