urchade/GLiNER

Generalist and Lightweight Model for Named Entity Recognition (Extract any entity types from texts)

What it solves

GLiNER is designed to overcome the limitations of traditional Named Entity Recognition (NER) models, which typically require extensive labeled data and task-specific training for each new entity type. It provides a lightweight, generalist framework that can extract any entity type in a zero-shot manner without needing new training data.

How it works

GLiNER uses a transformer-based architecture to perform token classification. It offers several specialized architectures:

  • Uni-encoder: The original architecture for strong zero-shot capabilities.
  • Bi-encoder: Scales to hundreds or thousands of entity types by pre-computing label embeddings.
  • RelEx: A joint architecture for extracting both entities and the relations between them.
  • GLiNER Decoder: A hybrid architecture that generates entity types for maximum flexibility.
  • StreamingSpan: A causal span model for incremental NER and rolling prediction updates.

To optimize performance, it supports torch.compile, FP16 and INT8 quantization, and ONNX export for deployment on CPUs and consumer hardware.

Who it’s for

This tool is for developers and data scientists working on information extraction tasks, such as PII detection, knowledge graph construction, and domain-specific NER (e.g., legal or biomedical) across multiple languages.

Highlights

  • Zero-shot Recognition: Extract any entity type without labeled data.
  • High Scalability: Bi-encoder architecture supports millions of labels without performance degradation.
  • Joint Extraction: Extracts both entities and relations in a single pass.
  • Production-Ready: Includes a Ray Serve-based serving layer with dynamic batching and horizontal scaling.
  • Hardware Efficient: Optimized for CPUs and consumer hardware via quantization and compilation.

Related

  • Project
  • Project
  • Project
  • Project
  • Project