Technology · Agentic → Guardrails · Open Source · wiki:deep

GLiNER

GLiNER (Generalist and Lightweight Model for Named Entity Recognition) is a zero-shot / open-type NER framework: a bidirectional transformer matches natural-language entity type labels to text spans in latent space, instead of generating entities with a large LLM. Install with pip install gliner; models live on Hugging Face (Apache-2.0 from v2 onward; early v0/v1 weights were CC-BY-NC). The library now covers uni-encoder, bi-encoder (many labels), RelEx (entities + relations), decoder/open NER, streaming NER, and dedicated PII model lines. It is a detector, not a full anonymization product — pair with Presidio, MaskPipe, NeMo Anonymizer, or your own operators.

Why it matters here

Presidio’s default spaCy NER is fixed-schema and language-model heavy. GLiNER lets an install declare PII and domain labels in plain English (person, iban, project address, estimator name) and run CPU-friendly inference competitive with much larger LLMs on zero-shot NER benchmarks. That is the right shape for observe → redact before RAG/LLM/logs when entity types drift per tenant. Use it as the NER backend under Presidio-style pipelines or Databricks dbxredact-style unions — not as policy authority.

How it works

Labels and text are encoded (uni-encoder jointly, or bi-encoder with cached label embeddings). A span representation layer scores each candidate span against each label (dot product + sigmoid). Parallel span matching avoids autoregressive decoding. For PII, load a PII-tuned checkpoint (e.g. community multi-PII or nvidia/gliner-PII) and pass the entity vocabulary you care about; thresholds filter scores. Downstream tools map spans into Presidio RecognizerResults or spaCy docs for masking.

  1. pip install gliner and load GLiNER.from_pretrained(…).
  2. Choose labels as natural-language strings (schema for this request).
  3. predict_entities(text, labels, threshold=…).
  4. Feed spans into anonymizers (Presidio operators, MaskPipe, NeMo Anonymizer, …).

Related: presidio · llm-guard · guardrails-ai · nemo-guardrails

Flow

When to reach for it

  • Use when: you need open / zero-shot NER or PII typing with small models on CPU/GPU, or many custom labels without training a spaCy pipeline.
  • Skip when: you only need deterministic ID patterns (SSN, IBAN checksums) — regex/Presidio pattern recognizers are enough and cheaper.
  • Prefer instead: presidio for the full detect→anonymize→deanonymize product; commercial DLP when you buy accuracy/SLA.

Limits

  • Detection ≠ redaction — you still need operators, overlap resolution, and audit.
  • License split on weights — prefer Apache-2.0 v2/v2.1+ models for commercial installs; older CC-BY-NC checkpoints bind research-only.
  • Tweet / noisy text — founding paper notes weaker tweet NER vs UniNER.
  • False confidence — zero-shot labels hallucinate types; threshold + human eval on tenant samples.
  • Not the ledger.

What we checked

Claims below are backed by science sources on disk.

Architecture / zero-shot claims

GLiNER founding paper (arXiv / NAACL) · STRONG

“In this paper, we introduce a compact NER model trained to identify any type of entity. Leveraging a bidirectional transformer encoder, our model, GLiNER, facilitates parallel entity extraction, an advantage over the slow sequential token generation of LLMs.”

Framework / PII product framing

urchade/GLiNER README · STRONG

“GLiNER is a framework for training and deploying small Named Entity Recognition (NER) models with zero-shot capabilities. In addition to traditional NER, it supports incremental streaming NER, joint entity and relation extraction, and multi-task token classification.”

Pairing with Presidio stacks

Presidio as anonymizer peer (contrast) · MODERATE

“It provides fast identification and anonymization modules for private entities in text and images.”
Research inventory

9 tags · 40 out · 41 in · 3 artifacts · 0 gaps · 0 corpus docs

Catalog tags

landscape.layer
Agentic
landscape.subcategory
Guardrails
license_tag
Open Source
maps.dm
present
maps.features
11
one_liner
Zero-shot NER / PII detector (BiLM spans)
review.depth
science
slug
gliner
title
GLiNER

Artifacts

  • dm_map · present · technologies/gliner/document-management.md
  • features_map · present · technologies/gliner/features.md
  • readme · present · technologies/gliner/README.md

Out · alternative_to

Out · dm_axis

Out · maps_to

In · alternative_to

In · dm_axis

In · in_stack

In · maps_to