jugaadsrl/gliner2-privacy-filter-PII-multi-onnx
GLiNER2 Privacy-Filter PII Multi (ONNX Fragmented & IOBinding)
This repository contains the ONNX-exported weights of `fastino/gliner2-privacy-filter-PII-multi`, the multilingual PII detection model built on GLiNER2 by Fastino AI.
The model is exported in a fragmented format (encoder, tokengather, spanrep, schemagather, countpredargmax, countlstm_fixed, scorer, classifier) for direct compatibility with gliner2-rs, the official Zero-Python Native Rust inference engine for GLiNER2.
It supports detection of 42 PII entity types across 7 languages (EN, FR, ES, DE, IT, PT, NL).
๐ V2 Zero-Copy IOBinding Models
Like the `gliner2-multi-v1-onnx` base release, this repo ships the V2 fused IOBinding variant. Gather, ArgMax, MatMul operations are fused directly into the ONNX graphs so that tensors never leave the GPU/NPU VRAM, bypassing the PCIe bus and cutting inference latency by ~30 % on discrete GPUs.
๐ Available Variants
Each variant ships 8 fragments:
encoder_{precision}.onnx ~530โ1060 MB
token_gather_{precision}.onnx ~ <1 MB
span_rep_{precision}.onnx ~32โ63 MB
schema_gather_{precision}.onnx ~ <1 MB
count_pred_argmax_{precision}.onnx ~2โ5 MB
count_lstm_fixed_{precision}.onnx ~20โ41 MB
scorer_{precision}.onnx ~ <1 MB
classifier_{precision}.onnx ~2โ5 MBTotal: ~590 MB (FP16) or ~1.17 GB (FP32) per variant.
๐ฏ Supported PII Labels (42 types)
Person / Names (6 labels)
person, full_name, first_name, middle_name, last_name, date_of_birth
Contact / Address (8 labels)
email, phone_number, address, street_address, city, state_or_region, postal_code, country
Government / Tax IDs (7 labels)
government_id, national_id_number, passport_number, drivers_license_number, license_number, tax_id, tax_number
Banking / Payment (8 labels)
bank_account, account_number, routing_number, iban, payment_card, card_number, card_expiry, card_cvv
Digital Identity (4 labels)
username, ip_address, account_id, sensitive_account_id
Secrets / Credentials (5 labels)
password, secret, api_key, access_token, recovery_code
Sensitive Dates (4 labels)
sensitive_date, document_date, expiration_date, transaction_date
๐ Usage in Rust (gliner2-rs)
use gliner2_inference::{Gliner2Engine, ModelType, SchemaTask};
// Auto-downloads the V2 FP16 fragments from this HuggingFace repo
// and switches to the high-performance IOBinding engine.
let engine = Gliner2Engine::from_pretrained(
"jugaadsrl/gliner2-privacy-filter-PII-multi-onnx",
Some("fp16_v2"),
ModelType::HuggingFace,
)?;
let text = "Please contact Maria Jensen at maria.jensen@example.dk or +45 20 12 34 56.";
let tasks = vec![
SchemaTask::Entities(vec![
"person".into(), "email".into(), "phone_number".into(),
])
];
let (entities, _, _) = engine.extract(text, &tasks)?;Requires `gliner2-rs >= 0.4.1` for automatic V2 detection / IOBinding routing.
Newer engine
gliner2-rs is now a Cargo workspace. The snippet above uses gliner2-inference, the original engine, which is the one with from_pretrained and therefore the one that pulls these files from the Hub for you.
gliner2-privacy is the newer alternative: it reads this export's fp16_v2/ layout unchanged, carries the 42 labels below as typed groups, and adds redaction helpers. It takes a local directory rather than a Hub id.
use gliner2_core::{SpanConfig, SpanEngine};
use gliner2_privacy::{Group, redact};
let mut engine = SpanEngine::new(SpanConfig::new("path/to/this/export"))?;
let out = engine.extract(text, &[Group::Person.task(), Group::Contact.task()])?;
println!("{}", redact(text, &out.entities));๐ Usage in Python (onnxruntime)
Run the 8-fragment pipeline manually (no Python gliner2 dependency needed):
import onnxruntime as ort
# Per fragment (example for the encoder, CUDA backend)
encoder = ort.InferenceSession(
"encoder_fp16_iobinding.onnx",
providers=["CUDAExecutionProvider"],
)
# ...load the other 7 fragments analogously...
# Chain them via IOBinding (see validate_onnx_v2.py for a full reference impl)For a simpler entry point you can keep using the original PyTorch model via the gliner2 Python package on fastino/gliner2-privacy-filter-PII-multi; this ONNX repo is optimised for production deployment without Python.
๐ Pipeline Wiring (IOBinding chain)
encoder_fp16_iobinding.onnx
โ
โโ token_gather_fp16_iobinding.onnx
โ โโ span_rep_fp16_iobinding.onnx
โ
โโ schema_gather_fp16_iobinding.onnx
โโ count_pred_argmax_fp16_iobinding.onnx โ pred_count (int64)
โโ count_lstm_fixed_fp16_iobinding.onnx
โโ scorer_fp16_iobinding.onnx โ entity_scores
classifier_fp16_iobinding.onnx (only for classification tasks)โ๏ธ Technical Notes
- opset 17 (ONNX 1.14+) for maximum execution-provider compatibility.
count_lstm_fixedexports the GRU unrolled to 20 fixed steps at tracing time โ compatible with execution providers that don't support dynamic loops (Apple CoreML, Qualcomm QNN).scoreruses fused Reshape + MatMul + Transpose instead ofEinsumfor compatibility with QNN/CoreML FP16.- INT8 not supported: the DeBERTa-v3 disentangled-attention activations contain extreme outliers that saturate 8-bit ranges (the same limitation called out by the GLiNER2 maintainers). FP16 remains the optimal compression target.
- Encoder size: ~1.06 GB FP32 โ ~530 MB FP16. Larger than the multi-v1 base because of the wider classification head (42 PII labels) and per-language fine-tuning.
๐ชช License
Apache 2.0 โ same as the upstream model.
๐ Acknowledgements
- Upstream model: `fastino/gliner2-privacy-filter-PII-multi` by Fastino AI.
- GLiNER2 paper: Zaratiana et al., GLiNER2: Schema-Driven Multi-Task Learning for Structured Information Extraction, EMNLP 2025.
- ONNX fragmentation + IOBinding strategy: Semplifica s.r.l., as used in `gliner2-multi-v1-onnx`.
๐ Citation
@misc{fastino2026gliner2pii,
title = {GLiNER2-PII: Multilingual PII Extraction via Synthetic Fine-Tuning},
author = {{Fastino AI Team}},
year = {2026},
url = {https://huggingface.co/fastino/gliner2-privacy-filter-PII-multi}
}
@inproceedings{zaratiana-etal-2025-gliner2,
title = {GLiNER2: Schema-Driven Multi-Task Learning for Structured Information Extraction},
author = {Zaratiana, Urchade and Pasternak, Gil and Boyd, Oliver and Hurn-Maloney, George and Lewis, Ash},
booktitle = {Proceedings of EMNLP 2025: System Demonstrations},
year = {2025}
}