knowledgator/gliner-bi-large-v2.0

Model

17

stars

5

commits

4

repos using this model

1

linked in READMEs

Apr 22, 2026

updated

bi-encoder
encoder
entity recognition
gliner
GLiNER
information extraction
modernbert
NER
pytorch
scalable-ner
token-classification
zero-shot-ner
Browse cluster: GLiNER Named Entity Recognition

README

GLiNER-bi-Encoder: Scalable Zero-Shot Named Entity Recognition

image

About

GLiNER-bi-Encoder is a novel architecture for Named Entity Recognition (NER) that combines zero-shot flexibility with industrial-scale efficiency. Unlike the original GLiNER, which uses joint encoding, the bi-encoder design decouples text and entity-type encoding, enabling the recognition of thousands of entity types simultaneously with minimal computational overhead.

Key Advantages

Massive Scalability: Handle 1000+ entity types with near-constant inference speed when using pre-computed label embeddings

130× Faster: Up to 130× throughput improvement compared to uni-encoder approaches at 1024 entity types

State-of-the-Art Performance: Achieves 61.5% Micro-F1 on CrossNER benchmark in zero-shot setting

Efficient Caching: Pre-compute and cache entity type embeddings for instant reuse across millions of documents

Architecture

The bi-encoder architecture employs two specialized, independent transformers:

  • Text Encoder: Processes input sequences using ModernBERT-based encoders (Ettin family)
  • Label Encoder: Embeds entity type descriptions using specialized sentence transformers (BGE, MiniLM)

This separation removes the context-window bottleneck and enables:

  • Pre-computation of entity type embeddings
  • Constant memory usage for text encoding regardless of entity count
  • Efficient nearest-neighbor search for entity matching

Model Variants

GLiNER-bi-V2 Models:

Model nameParamsText EncoderLabel EncoderAvg. CrossNERInference Speed (H100, ex/s)Inference Speed (pre-computed)
gliner-bi-edge-v2.060 Mettin-encoder-32mall-MiniLM-L6-v254.0%13.6424.62
gliner-bi-small-v2.0108 Mettin-encoder-68mall-MiniLM-L12-v257.2%7.9915.22
gliner-bi-base-v2.0194 Mettin-encoder-150mbge-small-en-v1.560.3%5.919.51
gliner-bi-large-v2.0530 Mettin-encoder-400mbge-base-en-v1.561.5%2.683.60

Recommendation: The base variant (194M) achieves 98% of large model performance while operating 2.6× faster, making it optimal for most production scenarios.

Installation & Usage

Installation

pip install gliner -U
pip install transformers==4.57.0

For flash attention support:

pip install flash-attn triton

Basic Usage

from gliner import GLiNER

# Load model
model = GLiNER.from_pretrained("knowledgator/gliner-bi-base-v2.0")

text = """
Cristiano Ronaldo dos Santos Aveiro (Portuguese pronunciation: [kɾiʃˈtjɐnu ʁɔˈnaldu]; 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. Widely regarded as one of the greatest players of all time, Ronaldo has won five Ballon d'Or awards, a record three UEFA Men's Player of the Year Awards, and four European Golden Shoes, the most by a European player.
"""

labels = ["person", "award", "date", "competitions", "teams"]

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

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

Output:

Cristiano Ronaldo dos Santos Aveiro => person
5 February 1985 => date
Al Nassr => teams
Portugal national team => teams
Ballon d'Or => award
UEFA Men's Player of the Year Awards => award
European Golden Shoes => award

Advanced Usage: Pre-computing Entity Embeddings

For scenarios with large, static entity taxonomies (hundreds to millions of types):

from gliner import GLiNER

model = GLiNER.from_pretrained("knowledgator/gliner-bi-base-v2.0")

# Pre-compute embeddings for thousands of entity types
entity_types = ["person", "organization", "location", ...] # Can be thousands
texts = ["Your documents here", ...]

# Encode entity types once
entity_embeddings = model.encode_labels(entity_types, batch_size=8)

# Use pre-computed embeddings for fast inference
outputs = model.batch_predict_with_embeds(texts, entity_embeddings, entity_types)

This approach provides:

  • 130× speedup at 1024 entity types
  • Constant inference time regardless of entity count
  • Efficient caching for repeated use

Flash Attention & Extended Context

model = GLiNER.from_pretrained(
    "knowledgator/gliner-bi-base-v2.0",
    _attn_implementation='flash_attention_2',
    max_len=2048
).to('cuda:0')

Zero-Shot NER Performance

Comprehensive evaluation across 19 diverse NER datasets:

Datasetgliner-bi-edge-v2.0gliner-bi-small-v2.0gliner-bi-base-v2.0gliner-bi-large-v2.0
ACE 200426.4%27.5%28.9%31.9%
ACE 200526.2%28.1%30.0%31.4%
AnatEM39.1%43.6%35.4%39.5%
Broad Tweet Corpus70.0%71.7%72.1%70.9%
CoNLL 200361.6%64.2%65.6%66.5%
FabNER22.4%23.2%24.3%22.7%
FindVehicle35.6%40.3%40.6%39.1%
GENIA_NER50.1%53.8%56.8%60.1%
HarveyNER15.0%10.6%12.6%14.7%
MultiNERD64.6%66.0%68.0%64.0%
Ontonotes31.4%31.9%33.3%32.5%
PolyglotNER45.1%46.3%46.6%46.8%
TweetNER736.9%40.9%40.4%41.7%
WikiANN en52.3%54.0%54.9%56.3%
WikiNeural78.0%79.9%80.0%76.6%
bc2gm58.1%59.9%62.7%61.4%
bc4chemd45.8%49.1%53.6%50.5%
bc5cdr68.5%71.5%73.0%71.7%
ncbi65.9%65.4%65.2%65.9%
Average47.0%48.8%49.7%49.7%

CrossNER Zero-Shot Benchmark

Datasetgliner-bi-edge-v2.0gliner-bi-small-v2.0gliner-bi-base-v2.0gliner-bi-large-v2.0
CrossNER_AI53.8%54.7%58.3%57.4%
CrossNER_literature56.2%62.6%65.2%63.2%
CrossNER_music68.2%72.3%73.4%74.0%
CrossNER_politics68.7%70.0%70.8%73.0%
CrossNER_science63.2%66.1%68.0%67.6%
mit-movie30.5%35.2%46.2%51.0%
mit-restaurant37.1%39.5%40.3%44.3%
Average (Zero-Shot Benchmark)54.0%57.2%60.3%61.5%

Inference Speed Comparison

Throughput (examples/second) by number of entity types on H100 GPU (batch_size=1):

Model12481632641282565121024Avg
gliner-bi-edge-v2.017.027.05.0522.417.513.915.212.510.85.433.2313.64
gliner-bi-edge-v2.0 (pre-computed)19.325.028.232.631.032.622.222.722.216.918.324.62
gliner-bi-small-v2.012.512.85.9811.610.69.436.947.355.743.331.607.99
gliner-bi-small-v2.0 (pre-computed)14.715.914.315.315.415.415.615.315.515.714.315.22
gliner-bi-base-v2.08.138.624.858.007.526.765.715.214.643.212.305.91
gliner-bi-base-v2.0 (pre-computed)9.5210.29.809.9510.09.938.936.719.359.7110.59.51
gliner-bi-large-v2.03.522.533.873.503.663.191.902.462.391.620.872.68
gliner-bi-large-v2.0 (pre-computed)4.374.074.534.544.473.463.853.042.821.842.643.60
gliner_small-v2.5 (uni-encoder)10.714.614.113.211.910.37.914.261.290.430.148.08
gliner_medium-v2.5 (uni-encoder)7.818.518.397.587.125.624.182.190.680.230.074.76
gliner_large-v2.5 (uni-encoder)2.893.283.292.902.612.331.711.120.310.090.031.87

Key Insight: Bi-encoder with pre-computed embeddings maintains near-constant speed (5.2% degradation from 1→1024 labels) while uni-encoder shows 98.7% degradation.

Use Cases

Biomedical Entity Linking

Process millions of documents against UMLS (4M+ concepts), SNOMED CT, or other large medical ontologies with pre-computed embeddings.

Enterprise Knowledge Extraction

Deploy dynamic taxonomies that evolve without model retraining. Add new entity types instantly by computing their embeddings.

Scientific Literature Mining

Extract entities across multiple specialized domains (chemistry, biology, physics) with domain-specific label encoders.

Entity Linking with GLiNKER

GLiNER-bi-Encoder extends naturally to entity linking through the GLiNKER framework—a modular DAG-based pipeline for:

  • Mention extraction with GLiNER
  • Candidate retrieval from knowledge bases via pre-computed embeddings
  • Entity disambiguation using bi-encoder scoring

Learn more: GLiNKER Repository

Model Details

Training Data

  • Pre-training: 8M samples (Large/Base/Small), 10M samples (Edge) from FineFineWeb, annotated with GPT-4o
  • Post-training: 40K high-quality samples with sequences up to 2048 tokens for long-context refinement

Training Configuration

  • Focal Loss: α=0.7 (pre-training), α=0.8 (post-training), γ=2.0
  • Optimizer: AdamW with differential learning rates (encoder: 1e-5, other: 3e-5)
  • Context Length: 1024 tokens (pre-training), 2048 tokens (post-training)
  • Maximum Span Width: 12 tokens
  • Dropout: 0.35

Citation

If you use GLiNER-bi-Encoder in your research, please cite:

@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}, 
}

Acknowledgments

We sincerely thank Urchade Zaratiana (creator of GLiNER) and Tom Aarsen (maintainer of Sentence Transformers) for their foundational work.

Join Our Community

Connect with our community on Discord for news, support, and discussions: Join Discord

Resources


Knowledgator Engineering © 2026

Contributors

BioMike

3 commits

Ihor

2 commits

knowledgator/gliner-bi-large-v2.0

Model

17

stars

5

commits

4

repos using this model

1

linked in READMEs

Apr 22, 2026

updated

bi-encoder
encoder
entity recognition
gliner
GLiNER
information extraction
modernbert
NER
pytorch
scalable-ner
token-classification
zero-shot-ner
Browse cluster: GLiNER Named Entity Recognition

README

GLiNER-bi-Encoder: Scalable Zero-Shot Named Entity Recognition

image

About

GLiNER-bi-Encoder is a novel architecture for Named Entity Recognition (NER) that combines zero-shot flexibility with industrial-scale efficiency. Unlike the original GLiNER, which uses joint encoding, the bi-encoder design decouples text and entity-type encoding, enabling the recognition of thousands of entity types simultaneously with minimal computational overhead.

Key Advantages

Massive Scalability: Handle 1000+ entity types with near-constant inference speed when using pre-computed label embeddings

130× Faster: Up to 130× throughput improvement compared to uni-encoder approaches at 1024 entity types

State-of-the-Art Performance: Achieves 61.5% Micro-F1 on CrossNER benchmark in zero-shot setting

Efficient Caching: Pre-compute and cache entity type embeddings for instant reuse across millions of documents

Architecture

The bi-encoder architecture employs two specialized, independent transformers:

  • Text Encoder: Processes input sequences using ModernBERT-based encoders (Ettin family)
  • Label Encoder: Embeds entity type descriptions using specialized sentence transformers (BGE, MiniLM)

This separation removes the context-window bottleneck and enables:

  • Pre-computation of entity type embeddings
  • Constant memory usage for text encoding regardless of entity count
  • Efficient nearest-neighbor search for entity matching

Model Variants

GLiNER-bi-V2 Models:

Model nameParamsText EncoderLabel EncoderAvg. CrossNERInference Speed (H100, ex/s)Inference Speed (pre-computed)
gliner-bi-edge-v2.060 Mettin-encoder-32mall-MiniLM-L6-v254.0%13.6424.62
gliner-bi-small-v2.0108 Mettin-encoder-68mall-MiniLM-L12-v257.2%7.9915.22
gliner-bi-base-v2.0194 Mettin-encoder-150mbge-small-en-v1.560.3%5.919.51
gliner-bi-large-v2.0530 Mettin-encoder-400mbge-base-en-v1.561.5%2.683.60

Recommendation: The base variant (194M) achieves 98% of large model performance while operating 2.6× faster, making it optimal for most production scenarios.

Installation & Usage

Installation

pip install gliner -U
pip install transformers==4.57.0

For flash attention support:

pip install flash-attn triton

Basic Usage

from gliner import GLiNER

# Load model
model = GLiNER.from_pretrained("knowledgator/gliner-bi-base-v2.0")

text = """
Cristiano Ronaldo dos Santos Aveiro (Portuguese pronunciation: [kɾiʃˈtjɐnu ʁɔˈnaldu]; 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. Widely regarded as one of the greatest players of all time, Ronaldo has won five Ballon d'Or awards, a record three UEFA Men's Player of the Year Awards, and four European Golden Shoes, the most by a European player.
"""

labels = ["person", "award", "date", "competitions", "teams"]

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

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

Output:

Cristiano Ronaldo dos Santos Aveiro => person
5 February 1985 => date
Al Nassr => teams
Portugal national team => teams
Ballon d'Or => award
UEFA Men's Player of the Year Awards => award
European Golden Shoes => award

Advanced Usage: Pre-computing Entity Embeddings

For scenarios with large, static entity taxonomies (hundreds to millions of types):

from gliner import GLiNER

model = GLiNER.from_pretrained("knowledgator/gliner-bi-base-v2.0")

# Pre-compute embeddings for thousands of entity types
entity_types = ["person", "organization", "location", ...] # Can be thousands
texts = ["Your documents here", ...]

# Encode entity types once
entity_embeddings = model.encode_labels(entity_types, batch_size=8)

# Use pre-computed embeddings for fast inference
outputs = model.batch_predict_with_embeds(texts, entity_embeddings, entity_types)

This approach provides:

  • 130× speedup at 1024 entity types
  • Constant inference time regardless of entity count
  • Efficient caching for repeated use

Flash Attention & Extended Context

model = GLiNER.from_pretrained(
    "knowledgator/gliner-bi-base-v2.0",
    _attn_implementation='flash_attention_2',
    max_len=2048
).to('cuda:0')

Zero-Shot NER Performance

Comprehensive evaluation across 19 diverse NER datasets:

Datasetgliner-bi-edge-v2.0gliner-bi-small-v2.0gliner-bi-base-v2.0gliner-bi-large-v2.0
ACE 200426.4%27.5%28.9%31.9%
ACE 200526.2%28.1%30.0%31.4%
AnatEM39.1%43.6%35.4%39.5%
Broad Tweet Corpus70.0%71.7%72.1%70.9%
CoNLL 200361.6%64.2%65.6%66.5%
FabNER22.4%23.2%24.3%22.7%
FindVehicle35.6%40.3%40.6%39.1%
GENIA_NER50.1%53.8%56.8%60.1%
HarveyNER15.0%10.6%12.6%14.7%
MultiNERD64.6%66.0%68.0%64.0%
Ontonotes31.4%31.9%33.3%32.5%
PolyglotNER45.1%46.3%46.6%46.8%
TweetNER736.9%40.9%40.4%41.7%
WikiANN en52.3%54.0%54.9%56.3%
WikiNeural78.0%79.9%80.0%76.6%
bc2gm58.1%59.9%62.7%61.4%
bc4chemd45.8%49.1%53.6%50.5%
bc5cdr68.5%71.5%73.0%71.7%
ncbi65.9%65.4%65.2%65.9%
Average47.0%48.8%49.7%49.7%

CrossNER Zero-Shot Benchmark

Datasetgliner-bi-edge-v2.0gliner-bi-small-v2.0gliner-bi-base-v2.0gliner-bi-large-v2.0
CrossNER_AI53.8%54.7%58.3%57.4%
CrossNER_literature56.2%62.6%65.2%63.2%
CrossNER_music68.2%72.3%73.4%74.0%
CrossNER_politics68.7%70.0%70.8%73.0%
CrossNER_science63.2%66.1%68.0%67.6%
mit-movie30.5%35.2%46.2%51.0%
mit-restaurant37.1%39.5%40.3%44.3%
Average (Zero-Shot Benchmark)54.0%57.2%60.3%61.5%

Inference Speed Comparison

Throughput (examples/second) by number of entity types on H100 GPU (batch_size=1):

Model12481632641282565121024Avg
gliner-bi-edge-v2.017.027.05.0522.417.513.915.212.510.85.433.2313.64
gliner-bi-edge-v2.0 (pre-computed)19.325.028.232.631.032.622.222.722.216.918.324.62
gliner-bi-small-v2.012.512.85.9811.610.69.436.947.355.743.331.607.99
gliner-bi-small-v2.0 (pre-computed)14.715.914.315.315.415.415.615.315.515.714.315.22
gliner-bi-base-v2.08.138.624.858.007.526.765.715.214.643.212.305.91
gliner-bi-base-v2.0 (pre-computed)9.5210.29.809.9510.09.938.936.719.359.7110.59.51
gliner-bi-large-v2.03.522.533.873.503.663.191.902.462.391.620.872.68
gliner-bi-large-v2.0 (pre-computed)4.374.074.534.544.473.463.853.042.821.842.643.60
gliner_small-v2.5 (uni-encoder)10.714.614.113.211.910.37.914.261.290.430.148.08
gliner_medium-v2.5 (uni-encoder)7.818.518.397.587.125.624.182.190.680.230.074.76
gliner_large-v2.5 (uni-encoder)2.893.283.292.902.612.331.711.120.310.090.031.87

Key Insight: Bi-encoder with pre-computed embeddings maintains near-constant speed (5.2% degradation from 1→1024 labels) while uni-encoder shows 98.7% degradation.

Use Cases

Biomedical Entity Linking

Process millions of documents against UMLS (4M+ concepts), SNOMED CT, or other large medical ontologies with pre-computed embeddings.

Enterprise Knowledge Extraction

Deploy dynamic taxonomies that evolve without model retraining. Add new entity types instantly by computing their embeddings.

Scientific Literature Mining

Extract entities across multiple specialized domains (chemistry, biology, physics) with domain-specific label encoders.

Entity Linking with GLiNKER

GLiNER-bi-Encoder extends naturally to entity linking through the GLiNKER framework—a modular DAG-based pipeline for:

  • Mention extraction with GLiNER
  • Candidate retrieval from knowledge bases via pre-computed embeddings
  • Entity disambiguation using bi-encoder scoring

Learn more: GLiNKER Repository

Model Details

Training Data

  • Pre-training: 8M samples (Large/Base/Small), 10M samples (Edge) from FineFineWeb, annotated with GPT-4o
  • Post-training: 40K high-quality samples with sequences up to 2048 tokens for long-context refinement

Training Configuration

  • Focal Loss: α=0.7 (pre-training), α=0.8 (post-training), γ=2.0
  • Optimizer: AdamW with differential learning rates (encoder: 1e-5, other: 3e-5)
  • Context Length: 1024 tokens (pre-training), 2048 tokens (post-training)
  • Maximum Span Width: 12 tokens
  • Dropout: 0.35

Citation

If you use GLiNER-bi-Encoder in your research, please cite:

@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}, 
}

Acknowledgments

We sincerely thank Urchade Zaratiana (creator of GLiNER) and Tom Aarsen (maintainer of Sentence Transformers) for their foundational work.

Join Our Community

Connect with our community on Discord for news, support, and discussions: Join Discord

Resources


Knowledgator Engineering © 2026

Contributors

BioMike

3 commits

Ihor

2 commits