A Python package for training and running compact NER models with zero-shot entity types. Supports extraction, relations, PII detection, and optional Ray Serve HTTP deployment.
Overview
GLiNER is a toolkit for building and running small named entity recognition models that can tag arbitrary entity types without task-specific training data. Beyond classic NER, the project describes streaming NER, joint entity and relation extraction, multi-task token classification, and PII-oriented use cases.
Models are intended to run on CPUs and consumer hardware, with optional quantization, torch.compile, and ONNX export paths documented for faster inference. A bi-encoder design precomputes label embeddings so many entity types can be used without the degradation described for some traditional setups.
You install the package with pip or uv, load published checkpoints, and run inference in Python. Fine-tuning is supported via JSON datasets and training scripts or programmatic APIs. For higher throughput, an optional Ray Serve layer adds batching, scaling, and an HTTP interface. Documentation covers architectures, training, runtime export, and serving.
Key features
- Zero-shot entity type recognition
- Fine-tuning on custom labels
- Relation extraction architectures
- CPU and ONNX inference paths
- Optional Ray Serve HTTP API
- FP16 and INT8 optimization options
- Streaming span decoding
- Multilingual PII-oriented models
Use cases
- Custom entity extraction pipelines
- PII detection in documents
- Knowledge graph entity and relation passes
- Domain-specific NER fine-tuning