CoolFace
Modelpublic

arthrod/gliner-opf-ptbr-pii-v1

sourceHugging Faceapache-2.0updated 5mo agoView on Hugging Face
0likes35downloads
Model Card

gliner-opf-ptbr-pii-v1

Fine-tune of openai/privacy-filter on Brazilian-Portuguese PII, 9-round chunked schedule (3 epochs × 3 saves per epoch). Trained on 914,452 rows of natural-text upstream data (arthrod/oai-pf-ptbr-chunked-v2), evaluated on the same 5,000 PT-BR val set used for the GLiNER models.

Best checkpoint: e3_c3 (final pass) — detection.span typed F1 0.885 (P 0.894 / R 0.876).

Headline performance

opf eval --eval-mode typed on the 5,000-row natural val:

  • —detection.span typed F1 = 0.885 (P=0.894 R=0.876)

Apples-to-apples vs the GLiNER series (same val, same 24 PT-BR labels, nervaluate)

Modelpartial Ppartial R**partial F1**exact F1
gliner-opf-ptbr-pii-v1 (this)0.9170.8790.8970.853
mmBERT-small × 3 (41400)0.9510.8320.8880.870
ettin-68m easter-egg0.8930.7610.8220.789
ettin-32m easter-egg0.9050.7290.8080.769

This model wins partial F1 by +0.01; mmBERT wins exact F1 by +0.017. Roughly tied overall, with different strengths:

opf wins on free-text sensitive descriptors (medical +0.16, organizational +0.34, political +0.24, sexual +0.14, religious +0.04, ethnicity +0.03) mmBERT wins on structured PII + names (first/middle/last names by 0.04–0.16, locations by 0.05–0.14, full address) Both perfect on cpf/rg/pis/credit_card/phone/email/zip (F1 ≥ 0.99)

Learning curve (9-round chunked schedule)

ckptPRF1
baseline (untyped)0.6330.4660.537
e1_c10.7460.7490.748
e1_c20.8310.8080.819
e1_c3 (epoch 1)0.8520.8360.844
e2_c10.8760.8350.855
e2_c20.8890.8440.866
e2_c3 (epoch 2)0.8950.8510.872
e3_c10.8960.8600.878
e3_c20.8800.8800.880
e3_c3 (final, released)0.8940.8760.885

Per-entity F1 (e3_c3, span-typed, top entities)

labelPRF1
cpfdocumentnumber0.9981.0000.999
rgdocumentnumber0.9990.9990.999
phone_number0.9970.9990.998
pisdocumentnumber0.9990.9960.997
dob0.9950.9990.997
email_address0.9960.9960.996
location_zip0.9901.0000.995
credit_card1.0000.9900.995
locationbuildingnumber0.9670.9720.969
last_name0.9490.9650.957
location_street0.9260.9540.940
locationstateabbreviation0.9210.8610.890
first_name0.8810.8740.878
personaldescriptionof_ethnicity0.8470.8420.844
personaldescriptionofreligiousconvictions0.8460.8050.825
personaldescriptionofsexualinformation0.8530.7880.819
personaldescriptionofpoliticalopinion0.8210.8150.818
personaldescriptionoforganizationalaffiliation0.8000.7940.797
personaldescriptionofmedicalconditions0.8160.7550.784
location_state0.7750.7630.769
location_neighborhood0.7920.6360.705
location_city0.6660.5910.626
middle_name0.6000.5300.563

(Entries with zero gold in val are omitted.)

Training recipe

  • —Backbone: openai/privacy-filter (8-layer MoE transformer, 128 experts, ~2.7B-equivalent params via top-4 routing)
  • —Schedule: 3 epochs × 3 saves per epoch (9 sequential opf train --epochs 1 invocations, each on a deterministic 1/3 chunk, resuming from the previous checkpoint)
  • —Optimizer: AdamW, LR 1e-5, weight decay 0.01, max grad norm 1.0
  • —Batch: 32 windows × 4 grad-accum = effective 128
  • —Context: n-ctx 256
  • —Precision: bf16 weights, fp32 accumulators
  • —Loss: standard CE on BIESO token labels (1 + 72 entities × 4 = 289 token labels)
  • —Decoding: constrained Viterbi
  • —Hardware: AMD MI300X single-GPU partition, ROCm 7.2

Dataset

  • —Train: arthrod/oai-pf-ptbr-chunked-v2 (private) — 914,452 rows, 100% upstream raw text
  • —99.8% from ai4privacy/open-pii-masking-500k-ai4privacy
  • —100% from ai4privacy/pii-masking-400k
  • —84.6% from arthrod/gliner2-pii-ptbr-reward-split
  • —93.4% from nvidia/Nemotron-PII
  • —4 small spam/phishing sources at 100% (negative evidence)
  • —3 sources dropped entirely (schema mismatches, ~18.6k rows)
  • —Val: same 5,000 PT-BR rows used for the GLiNER models — direct head-to-head comparison

Usage

python
import opf
# CLI:
# opf redact --checkpoint <download_dir> "text com cpf 123.456.789-09 e telefone (11) 91234-5678"

Related

  • —GLiNER series (same val): mmBERT-small × 3 (partial F1 0.823), ettin-68m-easter-egg (0.682), ettin-32m-easter-egg (0.603)
  • —Demo: arthrod/gliner-ptbr-pii-demo
  • —Note: easter-egg label berco-de-tiradentes is NOT supported here — use the mmBERT-small model for that.