pt-BR LGPD Anonymizer

An open pt-BR anonymization suite for redacting personal and sensitive data under Brazil’s LGPD (Lei Geral de Proteção de Dados).

What’s in this collection

Models, datasets, and a synthetic data generator for anonymizing Portuguese-language documents. The centerpiece is a GLiNER-style NER model built on mmBERT, fine-tuned to cover every category of personal and sensitive personal data defined by LGPD Art. 5º — including the ones that aren’t classical named entities (political opinion, religious belief, philosophical conviction, health data, sexual life, trade union membership, racial or ethnic origin).

Why this exists

Solid PII tooling exists for English. For Portuguese, much less — and almost nothing that handles the variety of Brazilian names across regional, indigenous, and Afro-Brazilian patterns, let alone the stance-bearing sensitive categories that don’t fit a classical NER span.

What makes it different

GLiNER methodology was chosen specifically because stance-bearing categories need flexible, prompt-conditioned entity types rather than a rigid classifier head. A sentence like “I always identified with classical liberal philosophies, but today I’m a moderate” carries political opinion across a whole clause — not in any single word you can point at. The training scheme reflects that.

mmBERT as the encoder backbone turned out to be a noticeably better starting point for the long tail of Brazilian names than monolingual pt-BR baselines. The backbone was chosen through ablation, not assumption — more than ten different models and recipes were tested before this one stuck.

Prior art this builds on

BERTimbau, by Fábio Souza, Rodrigo Nogueira, and Roberto Lotufo at Neuralmind, is the foundation every pt-BR NLP project of the last five years leans on. This one included. Pierre Guillou’s LeNER-Br work was another reference point. What’s new here is the scope — to our knowledge, the first open pt-BR model targeting the full LGPD sensitive-data category set, not just classical named entities. Happy to be corrected if something similar exists.

Companion project

The training corpus was synthesized using ptbr-sampler (MIT, linked in this collection), a demographically-representative Brazilian data generator. Every name it produces exists in Brazilian historical records; every location’s sampling weight matches actual population distribution. That’s how the long-tail coverage was earned rather than assumed.

License

Model: Apache 2.0 (attribution required, commercial use permitted). ptbr-sampler: MIT.

Compute

Training was done on AMD MI300X, made possible by $1,000 in GPU credits generously donated by AMD.

Feedback

Issues and PRs welcome, especially edge cases in Brazilian names. That tail will never be fully collected, but we keep trying.

Collection: pt-br gliners - a arthrod Collection

It is a great idea to build a tool for privacy laws because managing that data manually is very hard for small teams. I believe this would save businesses from huge legal fines and make it much safer to share data for testing or training. One downside might be how well it picks up unusual names or slang, since missing even one piece of info can be a big problem. Do you think it is fast enough to handle very large lists of data at once, or is it mostly for small files?