GLiNER2
Safetensors
Basque
Spanish
English
extractor
named-entity-recognition
ner
basque
euskara
pii
privacy
information-extraction
Eval Results (legacy)
Instructions to use tknika/gliner2-PII-basque with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- GLiNER2
How to use tknika/gliner2-PII-basque with GLiNER2:
from gliner2 import AutoExtractor extractor = AutoExtractor.from_pretrained("tknika/gliner2-PII-basque") # Extract entities text = "Apple CEO Tim Cook announced iPhone 15 in Cupertino yesterday." result = extractor.extract_entities(text, ["company", "person", "product", "location"]) print(result) - Notebooks
- Google Colab
- Kaggle
Relicense to CC BY-NC-SA 4.0 (BasqueGLUE NERC); report test-split and held-out-template results
Browse files
README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
---
|
| 2 |
-
license:
|
| 3 |
base_model:
|
| 4 |
- fastino/gliner2-privacy-filter-PII-multi
|
| 5 |
datasets:
|
|
@@ -15,33 +15,27 @@ model-index:
|
|
| 15 |
results:
|
| 16 |
- task:
|
| 17 |
type: token-classification
|
| 18 |
-
name: PII Detection
|
| 19 |
dataset:
|
| 20 |
type: tknika/pii-synthetic-basque-v2
|
| 21 |
-
name: pii-synthetic-basque-v2 (
|
| 22 |
-
split:
|
| 23 |
-
revision: main
|
| 24 |
metrics:
|
| 25 |
- type: f1
|
| 26 |
-
name: Micro F1
|
| 27 |
-
value: 0.
|
| 28 |
-
- type: precision
|
| 29 |
-
name: Micro Precision
|
| 30 |
-
value: 0.774
|
| 31 |
-
- type: recall
|
| 32 |
-
name: Micro Recall
|
| 33 |
-
value: 0.882
|
| 34 |
- task:
|
| 35 |
type: token-classification
|
| 36 |
name: Basque Named Entity Recognition
|
| 37 |
dataset:
|
| 38 |
type: orai-nlp/basqueGLUE
|
| 39 |
-
name:
|
| 40 |
-
|
|
|
|
| 41 |
metrics:
|
| 42 |
- type: f1
|
| 43 |
-
name: Micro F1
|
| 44 |
-
value: 0.
|
| 45 |
- type: f1
|
| 46 |
name: Person name F1
|
| 47 |
value: 0.850
|
|
@@ -58,75 +52,32 @@ tags:
|
|
| 58 |
|
| 59 |
# gliner2-PII-basque
|
| 60 |
|
| 61 |
-
A Basque-adapted
|
| 62 |
|
| 63 |
-
|
| 64 |
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
Two data sources were combined (experience replay):
|
| 68 |
-
|
| 69 |
-
- **Basque NER**: the `nerc_id` split of [orai-nlp/basqueGLUE](https://huggingface.co/datasets/orai-nlp/basqueGLUE) (EIEC + naiz.eus, manually annotated PER/LOC/ORG/MISC; 2,842 sentences), mapped to the base model's existing types: `person name`, `location`, `organization`, `miscellaneous`.
|
| 70 |
-
- **Synthetic PII**: the train split of [tknika/pii-synthetic-basque](https://huggingface.co/datasets/tknika/pii-synthetic-basque) — 6,000 synthetic sentences in Basque, Spanish and English covering 14 common PII types, with checksum-valid values (Spanish national IDs mod-23, IBANs mod-97, Luhn-valid cards, phone formats). This follows the synthetic-data methodology of the [GLiNER2-PII paper](https://arxiv.org/abs/2605.09973), since the original training corpus is not public.
|
| 71 |
-
|
| 72 |
-
Training used **LoRA (r=16, alpha=32)** on the boundary/task heads, merged into the base model after training; the resulting adapter is only ~13 MB. The model card repository contains the merged standalone model.
|
| 73 |
-
|
| 74 |
-
## Results
|
| 75 |
-
|
| 76 |
-
### Basque NER
|
| 77 |
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
| Metric | Base (zero-shot) | **This model** |
|
| 81 |
-
|---|---|---|
|
| 82 |
-
| nerc_id/val person name F1 | 0.664 | **0.850** |
|
| 83 |
-
| nerc_id/val micro F1 | 0.464 | **0.787** |
|
| 84 |
-
| nerc_od/val (Wikipedia) person name F1 | 0.721 | 0.813 |
|
| 85 |
-
|
| 86 |
-
### PII detection
|
| 87 |
-
|
| 88 |
-
On a PII probe sentence combining several entity types:
|
| 89 |
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
| email | ✓ | ✓ |
|
| 94 |
-
| phone number | ✓ | ✓ |
|
| 95 |
-
| bank account number | ✓ | ✓ |
|
| 96 |
-
| date of birth | ✓ | ✓ |
|
| 97 |
-
| zip code | ✓ | ✓ |
|
| 98 |
-
| national id | ✗ | **✓** |
|
| 99 |
-
| address | ✗ | **✓** |
|
| 100 |
|
| 101 |
-
##
|
| 102 |
|
| 103 |
-
|
| 104 |
|
| 105 |
-
|
|
| 106 |
|---|---|---|---|
|
| 107 |
-
|
|
| 108 |
-
|
|
| 109 |
-
|
|
| 110 |
-
|
| 111 |
-
Per-type F1 of this model on the benchmark (types sorted by frequency):
|
| 112 |
-
|
| 113 |
-
| Type | F1 | | Type | F1 |
|
| 114 |
-
|---|---|---|---|---|
|
| 115 |
-
| person name | 0.899 | | national id | 0.897 |
|
| 116 |
-
| email | 0.774 | | location | 0.695 |
|
| 117 |
-
| phone number | 0.990 | | personal url | 0.670 |
|
| 118 |
-
| user name | 0.615 *(base 0.846)* | | city | 0.511 |
|
| 119 |
-
| date of birth | 0.916 | | zip code | 0.720 |
|
| 120 |
-
| student id | 0.937 | | bank account number | 0.844 |
|
| 121 |
-
| address | 0.866 | | age / date / credit card | 1.000 |
|
| 122 |
-
| organization | 0.744 | | | |
|
| 123 |
|
| 124 |
-
|
| 125 |
|
| 126 |
-
|
| 127 |
-
- `city` (0.511) is measured against gold mentions in their exact surface form (e.g. «Amorebietan»), while this model tends to output the undeclined form (e.g. «Amorebieta»), so part of that gap is an artifact of the stricter benchmark rather than pure model weakness.
|
| 128 |
-
|
| 129 |
-
Fine-tuning a PII model on new-language NER data alone typically causes catastrophic forgetting of the original entity types. The LoRA + experience replay combination used here preserves the base model's PII detection behavior (and even improves on `national id` and `address`) while achieving strong Basque NER results.
|
| 130 |
|
| 131 |
## Usage
|
| 132 |
|
|
@@ -134,28 +85,22 @@ Fine-tuning a PII model on new-language NER data alone typically causes catastro
|
|
| 134 |
from gliner2 import AutoExtractor
|
| 135 |
|
| 136 |
model = AutoExtractor.from_pretrained("tknika/gliner2-PII-basque")
|
| 137 |
-
|
| 138 |
-
text = ("Kaixo, Ane Azkune naiz, Bilboko La Casilla kalean bizi naiz. "
|
| 139 |
-
"Posta: ane.azkune@euskaltel.eus, telefonoa 688 123 456.")
|
| 140 |
result = model.extract_entities(
|
| 141 |
-
|
|
|
|
| 142 |
["person name", "location", "address", "email", "phone number",
|
| 143 |
-
"national id", "
|
| 144 |
-
"date of birth", "city", "zip code", "age", "date"],
|
| 145 |
)
|
| 146 |
```
|
| 147 |
|
| 148 |
## Limitations
|
| 149 |
|
| 150 |
-
-
|
| 151 |
-
-
|
| 152 |
-
- The
|
| 153 |
-
- The training corpus text is reconstructed by joining tokens with whitespace, so punctuation spacing is slightly non-standard.
|
| 154 |
|
| 155 |
## Citation
|
| 156 |
|
| 157 |
-
If you use this model, please cite:
|
| 158 |
-
|
| 159 |
```bibtex
|
| 160 |
@misc{tknika2026gliner2piibasque,
|
| 161 |
title = {gliner2-PII-basque: A Basque-Adapted Multilingual PII Detection Model},
|
|
@@ -163,17 +108,6 @@ If you use this model, please cite:
|
|
| 163 |
year = {2026},
|
| 164 |
url = {https://huggingface.co/tknika/gliner2-PII-basque}
|
| 165 |
}
|
| 166 |
-
```
|
| 167 |
-
|
| 168 |
-
This model builds on the following work, which you may also want to cite:
|
| 169 |
-
|
| 170 |
-
```bibtex
|
| 171 |
-
@misc{fastino2026gliner2pii,
|
| 172 |
-
title = {GLiNER2-PII: Multilingual PII Extraction via Synthetic Fine-Tuning},
|
| 173 |
-
author = {{Fastino AI Team}},
|
| 174 |
-
year = {2026},
|
| 175 |
-
url = {https://huggingface.co/fastino/gliner2-pii-v1}
|
| 176 |
-
}
|
| 177 |
|
| 178 |
@misc{zaratiana2026gliner2piimultilingualmodelpersonally,
|
| 179 |
title = {GLiNER2-PII: A Multilingual Model for Personally Identifiable Information Extraction},
|
|
@@ -181,7 +115,7 @@ This model builds on the following work, which you may also want to cite:
|
|
| 181 |
year = {2026},
|
| 182 |
eprint = {2605.09973},
|
| 183 |
archivePrefix = {arXiv},
|
| 184 |
-
url
|
| 185 |
}
|
| 186 |
|
| 187 |
@InProceedings{urbizu2022basqueglue,
|
|
@@ -189,18 +123,7 @@ This model builds on the following work, which you may also want to cite:
|
|
| 189 |
title = {BasqueGLUE: A Natural Language Understanding Benchmark for Basque},
|
| 190 |
booktitle = {Proceedings of the Language Resources and Evaluation Conference},
|
| 191 |
year = {2022},
|
| 192 |
-
address = {Marseille, France},
|
| 193 |
-
publisher = {European Language Resources Association},
|
| 194 |
pages = {1603--1612},
|
| 195 |
url = {https://aclanthology.org/2022.lrec-1.172}
|
| 196 |
}
|
| 197 |
-
|
| 198 |
-
@misc{he2021debertav3,
|
| 199 |
-
title = {DeBERTaV3: Improving DeBERTa using ELECTRA-Style Pre-Training with Gradient-Disentangled Embedding Sharing},
|
| 200 |
-
author = {He, Pengcheng and Gao, Jianfeng and Chen, Weizhu},
|
| 201 |
-
year = {2021},
|
| 202 |
-
eprint = {2111.09543},
|
| 203 |
-
archivePrefix = {arXiv},
|
| 204 |
-
url = {https://arxiv.org/abs/2111.09543}
|
| 205 |
-
}
|
| 206 |
```
|
|
|
|
| 1 |
---
|
| 2 |
+
license: cc-by-nc-sa-4.0
|
| 3 |
base_model:
|
| 4 |
- fastino/gliner2-privacy-filter-PII-multi
|
| 5 |
datasets:
|
|
|
|
| 15 |
results:
|
| 16 |
- task:
|
| 17 |
type: token-classification
|
| 18 |
+
name: PII Detection
|
| 19 |
dataset:
|
| 20 |
type: tknika/pii-synthetic-basque-v2
|
| 21 |
+
name: pii-synthetic-basque-v2 (held-out-template test)
|
| 22 |
+
split: test
|
|
|
|
| 23 |
metrics:
|
| 24 |
- type: f1
|
| 25 |
+
name: Micro F1 (exact span)
|
| 26 |
+
value: 0.845
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
- task:
|
| 28 |
type: token-classification
|
| 29 |
name: Basque Named Entity Recognition
|
| 30 |
dataset:
|
| 31 |
type: orai-nlp/basqueGLUE
|
| 32 |
+
name: BasqueGLUE NERC in-domain (nerc_id)
|
| 33 |
+
config: nerc_id
|
| 34 |
+
split: test
|
| 35 |
metrics:
|
| 36 |
- type: f1
|
| 37 |
+
name: Micro F1 (exact span)
|
| 38 |
+
value: 0.738
|
| 39 |
- type: f1
|
| 40 |
name: Person name F1
|
| 41 |
value: 0.850
|
|
|
|
| 52 |
|
| 53 |
# gliner2-PII-basque
|
| 54 |
|
| 55 |
+
A Basque-adapted fine-tune of [fastino/gliner2-privacy-filter-PII-multi](https://huggingface.co/fastino/gliner2-privacy-filter-PII-multi) (205M parameters, GLiNER2 architecture, mDeBERTa-v3-base encoder), a multilingual PII (personally identifiable information) detection model.
|
| 56 |
|
| 57 |
+
**Superseded by [tknika/gliner2-PII-basque-v2](https://huggingface.co/tknika/gliner2-PII-basque-v2)**, which is better on every benchmark below. Evaluation code: [github.com/tknika/gliner2-pii-basque](https://github.com/tknika/gliner2-pii-basque).
|
| 58 |
|
| 59 |
+
> **License change (October 2026).** This model was first published as Apache-2.0. It is trained on BasqueGLUE NERC, which its authors license under **CC BY-NC-SA 4.0**, so the model is now distributed under CC BY-NC-SA 4.0 as well: non-commercial use only, with attribution, and derivatives under the same license. The weights did not change.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
|
| 61 |
+
## Training
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
|
| 63 |
+
- **Basque NER**: BasqueGLUE `nerc_id/train` (2,842 sentences, EIEC newswire), with labels mapped to `person name`, `location`, `organization`, `miscellaneous`.
|
| 64 |
+
- **Synthetic PII replay**: 6,000 sentences from [tknika/pii-synthetic-basque](https://huggingface.co/datasets/tknika/pii-synthetic-basque) in eu/es/en, covering 14 PII types with checksum-valid values.
|
| 65 |
+
- **Method**: LoRA (r = 16, alpha = 32) on the encoder's attention and feed-forward layers and on the span, classifier and count heads. After training, the adapter was merged into the base model. 5 epochs, batch size 16, learning rate 1e-5 for the encoder and 5e-4 for the task layers, bf16. The checkpoint was selected on `nerc_id/validation` loss.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
|
| 67 |
+
## Evaluation
|
| 68 |
|
| 69 |
+
Scoring is exact match on (type, start, end) spans, micro-averaged. Brackets show 95% bootstrap confidence intervals. The default threshold is 0.5.
|
| 70 |
|
| 71 |
+
| Benchmark | Base (zero-shot) | **v1 (this model)** | v2 |
|
| 72 |
|---|---|---|---|
|
| 73 |
+
| BasqueGLUE nerc_id/test, micro F1 | 0.500 [0.479, 0.521] | **0.738 [0.722, 0.754]** | 0.752 |
|
| 74 |
+
| BasqueGLUE nerc_id/test, person name F1 | 0.716 | **0.850** | 0.861 |
|
| 75 |
+
| BasqueGLUE nerc_od/test, micro F1 | 0.511 [0.481, 0.541] | **0.690 [0.663, 0.717]** | 0.717 |
|
| 76 |
+
| PII, held-out templates (17 types), micro F1 | 0.742 [0.727, 0.757] | **0.845 [0.832, 0.858]** | 0.905 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
|
| 78 |
+
The PII benchmark is the held-out-template test split of [pii-synthetic-basque-v2](https://huggingface.co/datasets/tknika/pii-synthetic-basque-v2). This model never saw its three educational types (`user name`, `personal url`, `student id`). It handles `personal url` (0.915) and `student id` (0.826), but `user name` drops below the base model (0.766 vs. 0.865). That drop is consistent with forgetting of types that are absent from the replay data.
|
| 79 |
|
| 80 |
+
Earlier versions of this card reported numbers on 500 BasqueGLUE validation sentences, the same split used for checkpoint selection. Those numbers are replaced by the test-split results above.
|
|
|
|
|
|
|
|
|
|
| 81 |
|
| 82 |
## Usage
|
| 83 |
|
|
|
|
| 85 |
from gliner2 import AutoExtractor
|
| 86 |
|
| 87 |
model = AutoExtractor.from_pretrained("tknika/gliner2-PII-basque")
|
|
|
|
|
|
|
|
|
|
| 88 |
result = model.extract_entities(
|
| 89 |
+
"Kaixo, Ane Azkune naiz, Bilboko La Casilla kalean bizi naiz. "
|
| 90 |
+
"Posta: ane.azkune@euskaltel.eus, telefonoa 688 123 456.",
|
| 91 |
["person name", "location", "address", "email", "phone number",
|
| 92 |
+
"national id", "date of birth", "city", "zip code"],
|
|
|
|
| 93 |
)
|
| 94 |
```
|
| 95 |
|
| 96 |
## Limitations
|
| 97 |
|
| 98 |
+
- The PII evaluation uses synthetic text, and performance on real documents will be lower.
|
| 99 |
+
- Only 14 of the base model's 42 PII types were replayed; the others may have degraded.
|
| 100 |
+
- The training code for this version (v1 synthetic generator) is not maintained; see v2.
|
|
|
|
| 101 |
|
| 102 |
## Citation
|
| 103 |
|
|
|
|
|
|
|
| 104 |
```bibtex
|
| 105 |
@misc{tknika2026gliner2piibasque,
|
| 106 |
title = {gliner2-PII-basque: A Basque-Adapted Multilingual PII Detection Model},
|
|
|
|
| 108 |
year = {2026},
|
| 109 |
url = {https://huggingface.co/tknika/gliner2-PII-basque}
|
| 110 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
|
| 112 |
@misc{zaratiana2026gliner2piimultilingualmodelpersonally,
|
| 113 |
title = {GLiNER2-PII: A Multilingual Model for Personally Identifiable Information Extraction},
|
|
|
|
| 115 |
year = {2026},
|
| 116 |
eprint = {2605.09973},
|
| 117 |
archivePrefix = {arXiv},
|
| 118 |
+
url = {https://arxiv.org/abs/2605.09973}
|
| 119 |
}
|
| 120 |
|
| 121 |
@InProceedings{urbizu2022basqueglue,
|
|
|
|
| 123 |
title = {BasqueGLUE: A Natural Language Understanding Benchmark for Basque},
|
| 124 |
booktitle = {Proceedings of the Language Resources and Evaluation Conference},
|
| 125 |
year = {2022},
|
|
|
|
|
|
|
| 126 |
pages = {1603--1612},
|
| 127 |
url = {https://aclanthology.org/2022.lrec-1.172}
|
| 128 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
```
|