--- language: - pl license: apache-2.0 library_name: gliner2 pipeline_tag: token-classification base_model: fastino/gliner2-privacy-filter-PII-multi tags: - gliner2 - ner - pii - polish - privacy - de-identification - span-extraction datasets: - klusai/ds-kp-general-pl-50k - clarin-pl/kpwr-ner - klusai/europriv-bench - flowxai/cee-pii-bench metrics: - precision - recall - f1 model-index: - name: GLiNER2 Polish PII results: - task: type: token-classification name: Polish PII NER dataset: name: EuroPriv PL real-skeleton v1 type: klusai/europriv-bench config: pl-realskeleton-v1 metrics: - type: f1 name: Exact span micro-F1 (balanced) value: 0.8442 - type: f1 name: Overlap span micro-F1 (balanced) value: 0.8715 - task: type: token-classification name: Polish PII NER dataset: name: KPWr NER test, six-label canonical mapping type: clarin-pl/kpwr-ner metrics: - type: f1 name: Exact span micro-F1 (balanced) value: 0.7446 - type: f1 name: Overlap span micro-F1 (balanced) value: 0.7788 - task: type: token-classification name: Polish PII NER dataset: name: CEE-PII-Bench v0.2 PL type: flowxai/cee-pii-bench config: pl metrics: - type: f1 name: Exact span micro-F1 (precision profile) value: 0.7713 - type: precision name: Exact span micro-precision (precision profile) value: 0.9017 - type: recall name: Exact span micro-recall (precision profile) value: 0.6739 --- # GLiNER2 Polish PII `GLiNER2 Polish PII` is an open-vocabulary named-entity recognition model adapted to the detection of personally identifiable and sensitive information in Polish text. It was obtained by full-parameter fine-tuning of [`fastino/gliner2-privacy-filter-PII-multi`](https://huggingface.co/fastino/gliner2-privacy-filter-PII-multi) on Polish PII data, selected human-annotated entities from KPWr, explicit negative label queries and augmented examples of Polish structured identifiers. The model returns character-level spans and supports schema-driven inference with either the supplied taxonomy or user-defined labels. The release contains three calibrated operating profiles: - `thresholds-balanced.json`, selected for overall NER F1; - `thresholds-precision.json`, intended for settings in which false positives are costly; - `thresholds-privacy.json`, an experimental privacy-oriented profile that requires validation on the target domain. The model is a detection component rather than a complete de-identification system, and its use does not by itself establish GDPR compliance. ## Intended use - local PII discovery and redaction candidates in Polish text; - training-data and log hygiene; - document review and de-identification support; - research on Polish open-vocabulary NER. For consequential applications, predictions should be combined with deterministic checksum validation for PESEL, NIP, REGON and IBAN, application-specific post-processing and, where appropriate, human review. ## Supported taxonomy The release includes `taxonomy.json` with Polish descriptions for 31 canonical labels: `person`, `organization`, `first_name`, `last_name`, `date_of_birth`, `email`, `phone_number`, `address`, `street_address`, `city`, `state_or_region`, `postal_code`, `country`, `pesel`, `nip`, `regon`, `krs`, `id_card_number`, `passport_number`, `drivers_license_number`, `national_id_number`, `iban`, `bank_account`, `payment_card`, `account_id`, `ip_address`, `username`, `url`, `license_plate`, `health_condition`, `sensitive_date`. Public benchmark coverage differs across labels. Per-label reports should therefore be reviewed and the operating thresholds validated on data representative of the intended application. ## Installation and inference ```bash pip install "gliner2[local]==1.3.2" ``` Load the model with `GLiNER2.from_pretrained("piotrmaciejbednarski/gliner2-polish-pii")` and request only the labels required by your application. When loading directly from the Hub, download the selected threshold profile or package it with the deployment image. Results obtained with calibrated per-label thresholds must not be presented as performance at a single global threshold of 0.5. ### End-to-end extraction and redaction example The following example illustrates an inference and redaction pipeline. It is not part of the evaluation harness. The pipeline comprises model inference, calibrated filtering and deterministic post-processing: | Component | Role | Description | |---|---|---| | Schema query | Model input | Open-vocabulary labels with Polish descriptions derived from `taxonomy.json` | | Length-preserving layout normalization | Pre-processing | Replaces `\r`, `\n` and `\t` with spaces while preserving character offsets | | `extract_entities(..., threshold=0.05)` | Model inference | Generates candidate spans with confidence scores and character offsets | | Per-label filtering | Calibration | Applies the thresholds published in `thresholds-privacy.json` | | Component address labels | Query design | Queries `address` together with `street_address`, `postal_code` and `city`; redaction uses their union | | `expand_repeated_mentions` | Post-processing | Locates exact repetitions of previously accepted surface forms | | `anonymize` | Post-processing | Resolves overlapping spans and replaces selected entities with `