knowledgator/gliner-stream-pii-v1.0

Model

21

stars

9

commits

1

repos using this model

2

linked in READMEs

Aug 4, 2026

updated

gliner
gliner-streaming
multilingual
named-entity-recognition
pii
privacy
pytorch
token-classification
zero-shot-ner
Browse cluster: GLiNER Named Entity Recognition

README

GLiNER Streaming PII — Qwen3 0.6B

An open-label PII detector built with the GLiNER streaming-span architecture and a Qwen3-0.6B causal backbone. It supports regular full-text inference, cached incremental streams, and full-session recomputation. This model was developed in collaboration between Wordcab and Knowledgator. For enterprise-ready, specialized PII/PHI/PCI models, contact us at info@knowledgator.com.

Architecture

Following the component schema in the GLiNER architecture docs, this checkpoint is composed of:

GLiNER Streaming Span architecture

Install and load

pip install "gliner>=0.2.28"
import torch
from gliner import GLiNER

device = "cuda" if torch.cuda.is_available() else "cpu"
dtype = "bf16" if device == "cuda" else "fp32"

model = GLiNER.from_pretrained(
    "knowledgator/gliner-stream-pii-v1.0",
    load_tokenizer=True,
    map_location=device,
    dtype=dtype,
).eval()

labels = [
    "person",
    "email address",
    "phone number",
    "street address",
    "credit card number",
    "passport number",
]

Three inference strategies

StrategyAPIWhat is computedBest for
1. Stateless full textNo session_idComplete input and label promptDocuments, batches, independent requests
2. Cached incrementalsession_id=[id]New chunk only; decoder KV, labels, words, and span history are reusedLive chat, ASR, logs, token streams
3. Full recomputesession_id=[id], recompute=TrueAccumulated session plus new chunk; cache and all spans are rebuiltFinal pass, changed labels, correction after drift

1. Stateless full text

entities = model.predict_entities(
    "Jane Doe can be reached at jane.doe@example.com.",
    labels,
    threshold=0.5,
)

2. Cached incremental session

session_id = "call-42"

for chunk in [
    "Customer Jane",
    " Doe asked us to call",
    " +1 (415) 555-0132.",
]:
    snapshot = model.inference(
        [chunk],
        labels,
        session_id=[session_id],
        threshold=0.5,
    )[0]
    print(snapshot)

3. Full-session recompute

# The next chunk must be non-empty. This reruns all accumulated text
# and also permits a changed label set.
final_labels = labels + ["account number"]
final_snapshot = model.inference(
    [" Account 12345678 was also mentioned."],
    final_labels,
    session_id=[session_id],
    recompute=True,
    threshold=0.5,
)[0]

model.clear_session(session_id)

Streaming details:

  • Each call returns the complete current session snapshot, not only new entities.
  • Chunks are concatenated verbatim; preserve boundary spaces and punctuation.
  • Offsets refer to the complete accumulated text.
  • Keep labels fixed unless using recompute=True; always clear finished sessions.

Evaluation

PIIMB ranking scores are label-agnostic, character-level masking metrics. They are micro-averaged within each task; group rows are unweighted averages across tasks. F2 is primary because it weights recall more heavily. Strict NER F1 also requires matching entity boundaries and type.

Scope / taskPrecisionRecallMasking F1Masking F2FPRStrict NER F1
English average87.36%91.55%89.18%90.53%3.01%
Multilingual average53.84%78.32%60.45%68.21%5.85%
ai4privacy-en94.69%95.16%94.92%95.06%1.52%67.99%
ai4privacy-multi87.34%92.96%90.07%91.78%3.82%55.39%
gretel86.95%95.58%91.06%93.72%5.20%67.38%
mapa-eur-lex20.34%63.67%30.83%44.65%7.88%10.91%
nemotron-pii72.75%88.07%79.68%84.51%4.98%68.93%
privy95.07%87.39%91.07%88.83%0.33%81.68%

Configuration: PIIMB v0.3.0, dataset revision 4a13e9ffe6fd0d275efbde8afd4d8d8f1ffc2133, sentences subset, threshold 0.5, bfloat16, evaluated 2026-07-24.

The main weakness is multilingual legal and administrative text: mapa-eur-lex reaches only 44.65% masking F2. Validate on the target languages, domains, labels, and threshold before deployment.

References

Contributors

Ihor

9 commits

knowledgator/gliner-stream-pii-v1.0

Model

21

stars

9

commits

1

repos using this model

2

linked in READMEs

Aug 4, 2026

updated

gliner
gliner-streaming
multilingual
named-entity-recognition
pii
privacy
pytorch
token-classification
zero-shot-ner
Browse cluster: GLiNER Named Entity Recognition

README

GLiNER Streaming PII — Qwen3 0.6B

An open-label PII detector built with the GLiNER streaming-span architecture and a Qwen3-0.6B causal backbone. It supports regular full-text inference, cached incremental streams, and full-session recomputation. This model was developed in collaboration between Wordcab and Knowledgator. For enterprise-ready, specialized PII/PHI/PCI models, contact us at info@knowledgator.com.

Architecture

Following the component schema in the GLiNER architecture docs, this checkpoint is composed of:

GLiNER Streaming Span architecture

Install and load

pip install "gliner>=0.2.28"
import torch
from gliner import GLiNER

device = "cuda" if torch.cuda.is_available() else "cpu"
dtype = "bf16" if device == "cuda" else "fp32"

model = GLiNER.from_pretrained(
    "knowledgator/gliner-stream-pii-v1.0",
    load_tokenizer=True,
    map_location=device,
    dtype=dtype,
).eval()

labels = [
    "person",
    "email address",
    "phone number",
    "street address",
    "credit card number",
    "passport number",
]

Three inference strategies

StrategyAPIWhat is computedBest for
1. Stateless full textNo session_idComplete input and label promptDocuments, batches, independent requests
2. Cached incrementalsession_id=[id]New chunk only; decoder KV, labels, words, and span history are reusedLive chat, ASR, logs, token streams
3. Full recomputesession_id=[id], recompute=TrueAccumulated session plus new chunk; cache and all spans are rebuiltFinal pass, changed labels, correction after drift

1. Stateless full text

entities = model.predict_entities(
    "Jane Doe can be reached at jane.doe@example.com.",
    labels,
    threshold=0.5,
)

2. Cached incremental session

session_id = "call-42"

for chunk in [
    "Customer Jane",
    " Doe asked us to call",
    " +1 (415) 555-0132.",
]:
    snapshot = model.inference(
        [chunk],
        labels,
        session_id=[session_id],
        threshold=0.5,
    )[0]
    print(snapshot)

3. Full-session recompute

# The next chunk must be non-empty. This reruns all accumulated text
# and also permits a changed label set.
final_labels = labels + ["account number"]
final_snapshot = model.inference(
    [" Account 12345678 was also mentioned."],
    final_labels,
    session_id=[session_id],
    recompute=True,
    threshold=0.5,
)[0]

model.clear_session(session_id)

Streaming details:

  • Each call returns the complete current session snapshot, not only new entities.
  • Chunks are concatenated verbatim; preserve boundary spaces and punctuation.
  • Offsets refer to the complete accumulated text.
  • Keep labels fixed unless using recompute=True; always clear finished sessions.

Evaluation

PIIMB ranking scores are label-agnostic, character-level masking metrics. They are micro-averaged within each task; group rows are unweighted averages across tasks. F2 is primary because it weights recall more heavily. Strict NER F1 also requires matching entity boundaries and type.

Scope / taskPrecisionRecallMasking F1Masking F2FPRStrict NER F1
English average87.36%91.55%89.18%90.53%3.01%
Multilingual average53.84%78.32%60.45%68.21%5.85%
ai4privacy-en94.69%95.16%94.92%95.06%1.52%67.99%
ai4privacy-multi87.34%92.96%90.07%91.78%3.82%55.39%
gretel86.95%95.58%91.06%93.72%5.20%67.38%
mapa-eur-lex20.34%63.67%30.83%44.65%7.88%10.91%
nemotron-pii72.75%88.07%79.68%84.51%4.98%68.93%
privy95.07%87.39%91.07%88.83%0.33%81.68%

Configuration: PIIMB v0.3.0, dataset revision 4a13e9ffe6fd0d275efbde8afd4d8d8f1ffc2133, sentences subset, threshold 0.5, bfloat16, evaluated 2026-07-24.

The main weakness is multilingual legal and administrative text: mapa-eur-lex reaches only 44.65% masking F2. Validate on the target languages, domains, labels, and threshold before deployment.

References

Contributors

Ihor

9 commits