Skip to main content

GLiNER: Generalist and Lightweight Model for Named Entity Recognition

Zero-shot NER | Streaming NER | Relation Extraction | PII Detection | Information Extraction | Token Classification

GLiNER Documentation GLiNER Paper Open GLiNER In Colab License
GLiNER Community Discord Reddit r/GLiNER Open GLiNER In HF Spaces HuggingFace Models
GLiNER Downloads GLiNER GitHub stars

GLiNER Banner

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. GLiNER is fine-tunable, optimized to run on CPUs and consumer hardware, and has performance competitive with LLMs several times its size, like ChatGPT and UniNER.

Other tasks such as text classification, entity linking, and schema extraction are supported through projects in the Ecosystem.

Why GLiNER?

Zero-shot Recognition

Extract any entity type — no labeled data or task-specific training required

Runs Anywhere

CPU, INT8 quantization, torch.compile, ONNX export — deploy on any hardware

Millions of Labels

Bi-encoder pre-computes label embeddings, scaling to 100+ entity types without degradation

NER + Relations

Build knowledge graphs in a single pass with the joint RelEx architecture

PII Detection

State-of-the-art multilingual PII models covering major entity types across 100+ languages

Fine-Tune in Minutes

Few-shot learning on small datasets — bring your own labels and get competitive results fast

Quick Start

Installation

With pip:

pip install gliner

With uv (faster):

uv pip install gliner

With serving support (Ray Serve):

uv pip install gliner[serve]  # or: pip install gliner ray[serve]

Basic Usage

from gliner import GLiNER

model = GLiNER.from_pretrained("gliner-community/gliner_small-v2.5")

text = """
Cristiano Ronaldo dos Santos Aveiro (born 5 February 1985) is a Portuguese
professional footballer who plays as a forward for and captains both Saudi Pro
League club Al Nassr and the Portugal national team.
"""

labels = ["person", "date", "organization", "location"]

entities = model.predict_entities(text, labels, threshold=0.5)

for entity in entities:
    print(entity["text"], "=>", entity["label"])

Output:

Cristiano Ronaldo dos Santos Aveiro => person
5 February 1985 => date
Al Nassr => organization
Portugal => location

🚀 Optimizations

GLiNER models are already small, but quantization and compilation can make them significantly faster and more memory-efficient, important when running on edge devices, serving at high throughput, or keeping GPU costs low.

  • torch.compile fuses operations and removes Python overhead, yielding up to ~1.5x speedup with no quality loss.
  • FP16 quantization (quantize=True) halves model memory and speeds up matrix operations. Combined with compilation, this gives up to ~1.9x faster GPU inference with virtually no quality loss.
  • INT8 quantization cuts memory by another 2x on top of FP16 and is supported out of the box, however, models need to be trained with Quantization-Aware Training (QAT) to preserve accuracy at INT8 precision.
model = GLiNER.from_pretrained(
    "gliner-community/gliner_small-v2.5",
    map_location="cuda",
    quantize=True,
    compile_torch_model=True,
)

Find more information on compilation and other optimizations in the documentation.

Serving

For production workloads — high-throughput pipelines, multi-user services, or anywhere you need to go beyond single-process model.inference() calls — GLiNER provides a Ray Serve-based serving layer. It adds dynamic batching that automatically groups incoming requests, memory-aware batch sizing that prevents CUDA OOM by calibrating against your GPU, precompiled kernels for common batch sizes to avoid first-call latency, horizontal scaling across multiple GPUs via Ray replicas, and an HTTP API for language-agnostic access.

python -m gliner.serve --model gliner-community/gliner_small-v2.5 --dtype fp16

Then query from Python:

from gliner.serve import GLiNERClient

client = GLiNERClient()  # connects to http://localhost:8000/gliner
results = client.predict(
    ["John works at Google", "Paris is in France"],
    labels=["person", "organization", "location"],
)

More information on serving options and parameters can be found in the documentation.

Training

GLiNER models are easy to fine-tune on your own data. Prepare your dataset as a JSON file and use the training script:

python train.py --config configs/config.yaml

Or train programmatically:

from gliner import GLiNER

model = GLiNER.from_pretrained("gliner-community/gliner_small-v2.5")

model.train_model(
    train_dataset=train_data,
    eval_dataset=eval_data,
    output_dir="models",
    max_steps=10000,
    per_device_train_batch_size=8,
    learning_rate=1e-5,
    bf16=True,
)

For detailed training examples, see the example notebooks:

Architectures

GLiNER supports multiple architectures tailored to different use cases:

Architecture Description Example Model
Uni-encoder Strong zero-shot capabilities, supports up to ~50 entity types. The original GLiNER architecture. gliner_multi_pii-v1
Bi-encoder Scalable to massive numbers of entity types via separate text and label encoding. gliner-bi-base-v2.0
RelEx Joint NER and relation extraction in a single model. gliner-relex-large-v1.0
GLiNER Decoder Hybrid architecture for open NER: entity types are generated with a small decoder for maximum flexibility. gliner-decoder-large-v1.0
StreamingSpan Causal span model that reuses decoder, label, and word caches for incremental NER and rolling prediction updates. gliner-stream-pii-v1.0

For more details, see the documentation.

Popular Use Cases

Ecosystem

GLiNER has a rich ecosystem of community projects and integrations:

Project Description
GLiNER2 Unified multi-task model for NER, text classification, and structured data extraction
GLiClass Zero-shot text classification using GLiNER-style architecture
GLinker Entity linking with GLiNER
GLiNER.cpp C++ implementation for high-performance inference
gline-rs Rust implementation of GLiNER
vllm-factory vLLM integration for scalable GLiNER serving
gliner-spacy spaCy integration for GLiNER

Documentation

Full documentation is available at urchade.github.io/GLiNER.

Authors & Creators

GLiNER was originally developed by:

We gratefully acknowledge the contributions of the open-source community, whose efforts have helped shape and improve this project.

Maintainers

Urchade Zaratiana
Member of technical staff at Fastino
LinkedIn
Ihor Stepanov
Co-Founder at Knowledgator
LinkedIn

Community

Contributing

We welcome contributions from the community! Here's how to get started:

  1. Fork the repository and create a new branch from main.
  2. Install the development dependencies: pip install -e ".[dev]".
  3. Make your changes — bug fixes, new features, documentation improvements, and new examples are all appreciated.
  4. Lint and format your code with Ruff before committing:
    ruff check . --fix
    ruff format .
    
  5. Write tests for any new functionality and make sure existing tests pass.
  6. Submit a pull request with a clear description of what you changed and why.

For bug reports and feature requests, please open an issue. For questions and discussions, join us on Discord.

Citations

If you find GLiNER useful in your research, please consider citing the original paper:

@inproceedings{zaratiana-etal-2024-gliner,
    title = "{GL}i{NER}: Generalist Model for Named Entity Recognition using Bidirectional Transformer",
    author = "Zaratiana, Urchade and
      Tomeh, Nadi and
      Holat, Pierre and
      Charnois, Thierry",
    booktitle = "Proceedings of the 2024 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (Volume 1: Long Papers)",
    year = "2024",
    url = "https://aclanthology.org/2024.naacl-long.300",
    pages = "5364--5376",
}

Related and Follow-up Work

The GLiNER family has since been extended to additional information extraction and classification tasks:

GLiNER multi-task

@misc{stepanov2024glinermultitaskgeneralistlightweight,
      title={GLiNER multi-task: Generalist Lightweight Model for Various Information Extraction Tasks}, 
      author={Ihor Stepanov and Mykhailo Shtopko},
      year={2024},
      eprint={2406.12925},
      archivePrefix={arXiv},
      primaryClass={cs.LG},
      url={https://arxiv.org/abs/2406.12925}, 
}

GLiNER bi-encoder

@misc{stepanov2026millionlabelnerbreakingscale,
      title={The Million-Label NER: Breaking Scale Barriers with GLiNER bi-encoder}, 
      author={Ihor Stepanov and Mykhailo Shtopko and Dmytro Vodianytskyi and Oleksandr Lukashov},
      year={2026},
      eprint={2602.18487},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2602.18487}, 
}

GLiNER2

@misc{zaratiana2025gliner2efficientmultitaskinformation,
      title={GLiNER2: An Efficient Multi-Task Information Extraction System with Schema-Driven Interface},
      author={Urchade Zaratiana and Gil Pasternak and Oliver Boyd and George Hurn-Maloney and Ash Lewis},
      year={2025},
      eprint={2507.18546},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2507.18546},
}

GLiGuard

@misc{zaratiana2026gliguardschemaconditionedclassificationllm,
      title={GLiGuard: Schema-Conditioned Classification for LLM Safeguard},
      author={Urchade Zaratiana and Mary Newhauser and George Hurn-Maloney and Ash Lewis},
      year={2026},
      eprint={2605.07982},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2605.07982},
}

GLiNER2-PII

@misc{zaratiana2026gliner2piimultilingualmodelpersonally,
      title={GLiNER2-PII: A Multilingual Model for Personally Identifiable Information Extraction},
      author={Urchade Zaratiana and Ash Lewis and George Hurn-Maloney},
      year={2026},
      eprint={2605.09973},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2605.09973},
}

Support and Funding

This project has been supported and funded by F.initiatives and Laboratoire Informatique de Paris Nord.

F.initiatives has been an expert in public funding strategies for R&D, Innovation, and Investments (R&D&I) for over 20 years. With a team of more than 200 qualified consultants, F.initiatives guides its clients at every stage of developing their public funding strategy: from structuring their projects to submitting their aid application, while ensuring the translation of their industrial and technological challenges to public funders. Through its continuous commitment to excellence and integrity, F.initiatives relies on the synergy between methods and tools to offer tailored, high-quality, and secure support.

FI Group

We also extend our heartfelt gratitude to the open-source community for their invaluable contributions, which have been instrumental in the success of this project. ❤️


GLiNER — open-source named entity recognition, zero-shot NER, relation extraction, PII detection, information extraction, knowledge graph construction, NLP, natural language processing, token classification, text mining, lightweight NER model, transformer-based NER

Release files for gliner 0.2.29

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gliner 0.2.29
File Size Uploaded
gliner-0.2.29.tar.gz 299.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gliner 0.2.29
File Interpreter ABI Platform
gliner-0.2.29-py3-none-any.whl Python 3 none any Details

Total release size: 561.7 kB

Release files / gliner-0.2.29.tar.gz

Download URL gliner-0.2.29.tar.gz
Size 299.7 kB
Tags Source
SHA-256 checksum
How to use checksums
39fa8f33c027627e1d6724bff972ab197bf37cea27e401cd3d40f2f95909b0a4
BLAKE2b-256 checksum
How to use checksums
9302ab43b9ad919d3cc1bcbb35485b2cdf7508ede0cddcebf72e765711795c30
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 8, 2026.

Transparency log

Release files / gliner-0.2.29-py3-none-any.whl

Download URL gliner-0.2.29-py3-none-any.whl
Size 262.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0c8cfb9f5c2daf7aff329ebb5ab1609052d7ad0aca0ef26049b9476b018b3fde
BLAKE2b-256 checksum
How to use checksums
787674ec5493e2167350c53a51c0f1db8e6a096c1b99f7110e2d9fc7daaf5cdc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 8, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.29 This release

2 release files

0.2.28

2 release files

0.2.27

2 release files

0.2.26

2 release files

0.2.25

2 release files

0.2.24

2 release files

0.2.23

2 release files

0.2.22

2 release files

0.2.21

2 release files

0.2.20

2 release files

0.2.19

2 release files

0.2.18

2 release files

0.2.17

2 release files

0.2.16

2 release files

0.2.15

2 release files

0.2.13

2 release files

0.2.12

2 release files

0.2.10

2 release files

0.2.9

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.14

2 release files

0.1.13

2 release files

0.1.12

2 release files

0.1.11

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page