Skip to main content

Pretrained Models

This page provides detailed information about pre-trained Gliner models

Bi-Encoder Models

NameEncoderLabels EncoderSize (MB)Zero-Shot F1 Score
modern-gliner-bi-large-v1.0ModernBERT-largebge-base-en-v1.521200.598
modern-gliner-bi-base-v1.0ModernBERT-basebge-small-en-v1.58300.594
gliner-bi-llama-v1.0Sheared-LLaMA-encoder-1.3Bbge-small-en-v1.554400.589
gliner-bi-large-v1.0deberta-v3-largebge-base-en-v1.522800.567
gliner-bi-base-v1.0deberta-v3-basebge-small-en-v1.59690.563
gliner-poly-small-v1.0deberta-v3-smallbge-small-en-v1.58320.557
gliner-bi-small-v1.0deberta-v3-smallall-MiniLM-L6-v27570.546

Basic Usage

from gliner import GLiNER

model = GLiNER.from_pretrained("knowledgator/modern-gliner-bi-base-v1.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,[note 3] a record three UEFA Men's Player of the Year Awards, and four European Golden Shoes, the most by a European player. He has won 33 trophies in his career, including seven league titles, five UEFA Champions Leagues, the UEFA European Championship and the UEFA Nations League. Ronaldo holds the records for most appearances (183), goals (140) and assists (42) in the Champions League, goals in the European Championship (14), international goals (128) and international appearances (205). He is one of the few players to have made over 1,200 professional career appearances, the most by an outfield player, and has scored over 850 official senior career goals for club and country, making him the top goalscorer of all time.
"""

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

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

for entity in entities:
print(entity["text"], "=>", entity["label"])
Expected 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
UEFA Champions Leagues => competitions
UEFA European Championship => competitions
UEFA Nations League => competitions
Champions League => competitions
European Championship => competitions

Pre-compute Labels Embeddings

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,[note 3] a record three UEFA Men's Player of the Year Awards, and four European Golden Shoes, the most by a European player. He has won 33 trophies in his career, including seven league titles, five UEFA Champions Leagues, the UEFA European Championship and the UEFA Nations League. Ronaldo holds the records for most appearances (183), goals (140) and assists (42) in the Champions League, goals in the European Championship (14), international goals (128) and international appearances (205). He is one of the few players to have made over 1,200 professional career appearances, the most by an outfield player, and has scored over 850 official senior career goals for club and country, making him the top goalscorer of all time.
"""

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

entity_embeddings = model.encode_labels(labels, batch_size = 8)

output = model.batch_predict_with_embeds([text], entity_embeddings, labels)
for entities in output:
for entity in entities:
print(entity["text"], "=>", entity["label"])
Expected Output
Encoding labels: 100%|██████████| 1/1 [00:00<00:00,  2.51it/s]
Cristiano Ronaldo dos Santos Aveiro => person
5 February 1985 => date
Ballon d'Or => award
UEFA Men's Player of the Year Awards => award
European Golden Shoes => award
UEFA Champions Leagues => competitions
UEFA European Championship => competitions
UEFA Nations League => competitions

GLiNER-BioMed

GLiNER-biomed developed in collaboration with DS4DH from the University of Geneva, introduces a specialized suite of efficient open biomedical NER models based on the GLiNER framework. GLiNER-biomed leverages synthetic annotations distilled from large generative biomedical language models to achieve state-of-the-art zero-shot and few-shot performance in biomedical entity recognition tasks.

NameEncoderLabels EncoderSize MBZero-Shot F1 Score
gliner-biomed-large-v1.0deberta-v3-large-7810.5977
gliner-biomed-bi-base-v1.0deberta-v3-basebge-small-en-v1.59690.5831
gliner-biomed-bi-small-v1.0deberta-v3-smallall-MiniLM-L6-v27570.5693
gliner-biomed-bi-large-v1.0deberta-v3-largebge-base-en-v1.523340.549
gliner-biomed-base-v1.0deberta-v3-base-7810.5437
gliner-biomed-small-v1.0deberta-v3-small-6110.5253

Basic Usage

from gliner import GLiNER

model = GLiNER.from_pretrained("Ihor/gliner-biomed-bi-base-v1.0")

text = """
The patient, a 45-year-old male, was diagnosed with type 2 diabetes mellitus and hypertension.
He was prescribed Metformin 500mg twice daily and Lisinopril 10mg once daily.
A recent lab test showed elevated HbA1c levels at 8.2%.
"""

labels = ["Disease", "Drug", "Drug dosage", "Drug frequency", "Lab test", "Lab test value", "Demographic information"]

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

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

Expected Output
45-year-old male => Demographic information
type 2 diabetes mellitus => Disease
hypertension => Disease
Metformin => Drug
500mg => Drug dosage
twice daily => Drug frequency
Lisinopril => Drug
10mg => Drug dosage
once daily => Drug frequency
HbA1c levels => Lab test
8.2% => Lab test value

Pre-compute Labels Embeddings

text = """
The patient, a 45-year-old male, was diagnosed with type 2 diabetes mellitus and hypertension.
He was prescribed Metformin 500mg twice daily and Lisinopril 10mg once daily.
A recent lab test showed elevated HbA1c levels at 8.2%.
"""

labels = ["Disease", "Drug", "Drug dosage", "Drug frequency", "Lab test", "Lab test value", "Demographic information"]

entity_embeddings = model.encode_labels(labels, batch_size = 8)

output = model.batch_predict_with_embeds([text], entity_embeddings, labels)
for entities in output:
for entity in entities:
print(entity["text"], "=>", entity["label"])
Expected Output
Encoding labels: 100%|██████████| 1/1 [00:00<00:00,  2.51it/s]
45-year-old male => Demographic information
type 2 diabetes mellitus => Disease
hypertension => Disease
Metformin => Drug
500mg => Drug dosage
twice daily => Drug frequency
Lisinopril => Drug
10mg => Drug dosage
once daily => Drug frequency
HbA1c levels => Lab test
8.2% => Lab test value