Arabic PII Detector โ€” ONNX INT8 (CPU Optimized)

This is the ONNX INT8 quantized version of C-Ilyas/arabic-pii-detector, optimized for CPU deployment.

The model was exported from PyTorch to ONNX format and dynamically quantized to INT8 using AVX2 instructions โ€” matched to the AMD Ryzen 5 3500U instruction set. It achieves identical F1 to the PyTorch model with significantly lower CPU latency.

Performance

Metric PyTorch (T4 GPU) ONNX INT8 (Ryzen 5 CPU)
Overall F1 0.9916 0.9916
Latency p50 7.35ms 57.29ms
Latency p95 7.97ms 96.38ms
Within 150ms target โœ“ โœ“

Zero accuracy loss from quantization โ€” F1 preserved at 0.9916.

Hardware: CPU benchmark on ThinkPad AMD Ryzen 5 3500U (4 cores, no discrete GPU).

Detected Entity Types

PERSON, EMAIL, PHONE_NUMBER, ADDRESS, ACCOUNT_NUMBER, BANK_ACCOUNT_NUMBER, IBAN

Usage

from optimum.onnxruntime import ORTModelForTokenClassification
from transformers import AutoTokenizer

model = ORTModelForTokenClassification.from_pretrained("C-Ilyas/arabic-pii-detector-onnx")
tokenizer = AutoTokenizer.from_pretrained("C-Ilyas/arabic-pii-detector-onnx")

For the full inference pipeline (BIO decoding, redaction, confidence scores) see scripts/infer_onnx.py in the project repository.

How it was created

python scripts/optimize_onnx.py \
    --model models/arabic-pii-detector \
    --output models/arabic-pii-detector-onnx

Uses AutoQuantizationConfig.avx2(is_static=False, per_channel=False) โ€” dynamic INT8 quantization with AVX2 kernels.

PyTorch Model

The original PyTorch model with full documentation, training details, and per-class metrics is at: C-Ilyas/arabic-pii-detector

Downloads last month
6
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for C-Ilyas/arabic-pii-detector-onnx

Quantized
(4)
this model