knowledgator/gliclass-edge-v3.0

Model

GLiClass: Generalist and Lightweight Model for Sequence Classification

18

10 commits

2 linked in READMEs

updated Aug 12, 2025

See the code

README

image/png

GLiClass: Generalist and Lightweight Model for Sequence Classification

This is an efficient zero-shot classifier inspired by GLiNER work. It demonstrates the same performance as a cross-encoder while being more compute-efficient because classification is done at a single forward path.

It can be used for topic classification, sentiment analysis, and as a reranker in RAG pipelines.

The model was trained on logical tasks to induce reasoning. LoRa adapters were used to fine-tune the model without destroying the previous knowledge.

LoRA parameters:

gliclass‑modern‑base‑v3.0gliclass‑modern‑large‑v3.0gliclass‑base‑v3.0gliclass‑large‑v3.0
LoRa r512768384384
LoRa α10241536768768
focal loss α0.70.70.70.7
Target modules"Wqkv", "Wo", "Wi", "linear_1", "linear_2""Wqkv", "Wo", "Wi", "linear_1", "linear_2""query_proj", "key_proj", "value_proj", "dense", "linear_1", "linear_2", mlp.0", "mlp.2", "mlp.4""query_proj", "key_proj", "value_proj", "dense", "linear_1", "linear_2", mlp.0", "mlp.2", "mlp.4"

GLiClass-V3 Models:

Model nameSizeParamsAverage BanchmarkAverage Inference Speed (batch size = 1, a6000, examples/s)
gliclass‑edge‑v3.0131 MB32.7M0.487397.29
gliclass‑modern‑base‑v3.0606 MB151M0.557154.46
gliclass‑modern‑large‑v3.01.6 GB399M0.608243.80
gliclass‑base‑v3.0746 MB187M0.655651.61
gliclass‑large‑v3.01.75 GB439M0.700125.22

image/png

How to use:

First of all, you need to install GLiClass library:

pip install gliclass
pip install -U transformers>=4.48.0

Then you need to initialize a model and a pipeline:

from gliclass import GLiClassModel, ZeroShotClassificationPipeline
from transformers import AutoTokenizer

model = GLiClassModel.from_pretrained("knowledgator/gliclass-edge-v3.0")
tokenizer = AutoTokenizer.from_pretrained("knowledgator/gliclass-edge-v3.0", add_prefix_space=True)
pipeline = ZeroShotClassificationPipeline(model, tokenizer, classification_type='multi-label', device='cuda:0')

text = "One day I will see the world!"
labels = ["travel", "dreams", "sport", "science", "politics"]
results = pipeline(text, labels, threshold=0.5)[0] #because we have one text
for result in results:
 print(result["label"], "=>", result["score"])

If you want to use it for NLI type of tasks, we recommend representing your premise as a text and hypothesis as a label, you can put several hypotheses, but the model works best with a single input hypothesis.

# Initialize model and multi-label pipeline
text = "The cat slept on the windowsill all afternoon"
labels = ["The cat was awake and playing outside."]
results = pipeline(text, labels, threshold=0.0)[0]
print(results)

Benchmarks:

Below, you can see the F1 score on several text classification datasets. All tested models were not fine-tuned on those datasets and were tested in a zero-shot setting.

GLiClass-V3:

Datasetgliclass‑large‑v3.0gliclass‑base‑v3.0gliclass‑modern‑large‑v3.0gliclass‑modern‑base‑v3.0gliclass‑edge‑v3.0
CR0.93980.91270.89520.89020.8215
sst20.91920.89590.93300.89590.8199
sst50.46060.33760.46190.27560.2823
20_news_
groups
0.59580.47590.39050.34330.2217
spam0.75840.67600.58130.63980.5623
financial_
phrasebank
0.90000.89710.59290.42000.5004
imdb0.93660.92510.94020.91580.8485
ag_news0.71810.72790.72690.66630.6645
emotion0.45060.44470.45170.42540.3851
cap_sotu0.45890.46140.40720.36250.2583
rotten_
tomatoes
0.84110.79430.76640.70700.7024
massive0.56490.50400.39050.34420.2414
banking0.55740.46980.36830.35610.0272
snips0.96920.94740.77070.56630.5257
AVERAGE0.71930.67640.61970.55770.4900

Previous GLiClass models:

Datasetgliclass‑large‑v1.0‑lwgliclass‑base‑v1.0‑lwgliclass‑modern‑large‑v2.0gliclass‑modern‑base‑v2.0
CR0.92260.90970.91540.8977
sst20.92470.89870.93080.8524
sst50.28910.37790.21520.2346
20_news_
groups
0.40830.39530.38130.3857
spam0.36420.51260.66030.4608
financial_
phrasebank
0.90440.88800.31520.3465
imdb0.94290.93510.94490.9188
ag_news0.75590.69850.69990.6836
emotion0.39510.35160.43410.3926
cap_sotu0.47490.46430.40950.3588
rotten_
tomatoes
0.88070.84290.73860.6066
massive0.56060.46350.23940.3458
banking0.33170.43960.13550.2907
snips0.97070.95720.84680.7378
AVERAGE0.65180.65250.56190.5366

Cross-Encoders:

Datasetdeberta‑v3‑large‑zeroshot‑v2.0deberta‑v3‑base‑zeroshot‑v2.0roberta‑large‑zeroshot‑v2.0‑ccomprehend_it‑base
CR0.91340.90510.91410.8936
sst20.92720.91760.85730.9006
sst50.38610.38480.41590.4140
enron_
spam
0.59700.46400.50400.3637
financial_
phrasebank
0.58200.66900.45500.4695
imdb0.91800.89900.90400.4644
ag_news0.77100.74200.74500.6016
emotion0.48400.49500.48600.4165
cap_sotu0.50200.47700.52300.3823
rotten_
tomatoes
0.86800.86000.84100.4728
massive0.51800.52000.52000.3314
banking770.56700.44600.29000.4972
snips0.83400.74770.54300.7227
AVERAGE0.68210.65590.61520.5331

Inference Speed:

Each model was tested on examples with 64, 256, and 512 tokens in text and 1, 2, 4, 8, 16, 32, 64, and 128 labels on an a6000 GPU. Then, scores were averaged across text lengths.

image/png

Model  Name / n samples per second per m labels1248163264128Average
gliclass‑edge‑v3.0103.81101.01103.50103.5098.3696.7788.7682.6497.29
gliclass‑modern‑base‑v3.056.0055.4654.9555.6654.7354.9553.4850.3454.46
gliclass‑modern‑large‑v3.046.3046.8246.6646.3043.9344.7342.7732.8943.80
gliclass‑base‑v3.049.4250.2540.0557.6957.1456.3955.9745.9451.61
gliclass‑large‑v3.019.0526.8623.6429.2729.0428.7927.5517.6025.22
deberta‑v3‑base‑zeroshot‑v2.024.5530.4015.387.623.771.870.940.4710.63
deberta‑v3‑large‑zeroshot‑v2.016.8215.827.933.981.990.990.490.256.03
roberta‑large‑zeroshot‑v2.0‑c50.4239.2719.959.955.012.481.250.6416.12
comprehend_it‑base21.7927.3213.607.583.801.900.970.499.72

Citation

@misc{stepanov2025gliclassgeneralistlightweightmodel,
      title={GLiClass: Generalist Lightweight Model for Sequence Classification Tasks}, 
      author={Ihor Stepanov and Mykhailo Shtopko and Dmytro Vodianytskyi and Oleksandr Lukashov and Alexander Yavorskyi and Mykyta Yaroshenko},
      year={2025},
      eprint={2508.07662},
      archivePrefix={arXiv},
      primaryClass={cs.LG},
      url={https://arxiv.org/abs/2508.07662}, 
}
GLiClass
safetensors
sentiment analysis
text classification
text-classification

knowledgator/gliclass-edge-v3.0

Model

GLiClass: Generalist and Lightweight Model for Sequence Classification

18

10 commits

2 linked in READMEs

updated Aug 12, 2025

See the code

README

image/png

GLiClass: Generalist and Lightweight Model for Sequence Classification

This is an efficient zero-shot classifier inspired by GLiNER work. It demonstrates the same performance as a cross-encoder while being more compute-efficient because classification is done at a single forward path.

It can be used for topic classification, sentiment analysis, and as a reranker in RAG pipelines.

The model was trained on logical tasks to induce reasoning. LoRa adapters were used to fine-tune the model without destroying the previous knowledge.

LoRA parameters:

gliclass‑modern‑base‑v3.0gliclass‑modern‑large‑v3.0gliclass‑base‑v3.0gliclass‑large‑v3.0
LoRa r512768384384
LoRa α10241536768768
focal loss α0.70.70.70.7
Target modules"Wqkv", "Wo", "Wi", "linear_1", "linear_2""Wqkv", "Wo", "Wi", "linear_1", "linear_2""query_proj", "key_proj", "value_proj", "dense", "linear_1", "linear_2", mlp.0", "mlp.2", "mlp.4""query_proj", "key_proj", "value_proj", "dense", "linear_1", "linear_2", mlp.0", "mlp.2", "mlp.4"

GLiClass-V3 Models:

Model nameSizeParamsAverage BanchmarkAverage Inference Speed (batch size = 1, a6000, examples/s)
gliclass‑edge‑v3.0131 MB32.7M0.487397.29
gliclass‑modern‑base‑v3.0606 MB151M0.557154.46
gliclass‑modern‑large‑v3.01.6 GB399M0.608243.80
gliclass‑base‑v3.0746 MB187M0.655651.61
gliclass‑large‑v3.01.75 GB439M0.700125.22

image/png

How to use:

First of all, you need to install GLiClass library:

pip install gliclass
pip install -U transformers>=4.48.0

Then you need to initialize a model and a pipeline:

from gliclass import GLiClassModel, ZeroShotClassificationPipeline
from transformers import AutoTokenizer

model = GLiClassModel.from_pretrained("knowledgator/gliclass-edge-v3.0")
tokenizer = AutoTokenizer.from_pretrained("knowledgator/gliclass-edge-v3.0", add_prefix_space=True)
pipeline = ZeroShotClassificationPipeline(model, tokenizer, classification_type='multi-label', device='cuda:0')

text = "One day I will see the world!"
labels = ["travel", "dreams", "sport", "science", "politics"]
results = pipeline(text, labels, threshold=0.5)[0] #because we have one text
for result in results:
 print(result["label"], "=>", result["score"])

If you want to use it for NLI type of tasks, we recommend representing your premise as a text and hypothesis as a label, you can put several hypotheses, but the model works best with a single input hypothesis.

# Initialize model and multi-label pipeline
text = "The cat slept on the windowsill all afternoon"
labels = ["The cat was awake and playing outside."]
results = pipeline(text, labels, threshold=0.0)[0]
print(results)

Benchmarks:

Below, you can see the F1 score on several text classification datasets. All tested models were not fine-tuned on those datasets and were tested in a zero-shot setting.

GLiClass-V3:

Datasetgliclass‑large‑v3.0gliclass‑base‑v3.0gliclass‑modern‑large‑v3.0gliclass‑modern‑base‑v3.0gliclass‑edge‑v3.0
CR0.93980.91270.89520.89020.8215
sst20.91920.89590.93300.89590.8199
sst50.46060.33760.46190.27560.2823
20_news_
groups
0.59580.47590.39050.34330.2217
spam0.75840.67600.58130.63980.5623
financial_
phrasebank
0.90000.89710.59290.42000.5004
imdb0.93660.92510.94020.91580.8485
ag_news0.71810.72790.72690.66630.6645
emotion0.45060.44470.45170.42540.3851
cap_sotu0.45890.46140.40720.36250.2583
rotten_
tomatoes
0.84110.79430.76640.70700.7024
massive0.56490.50400.39050.34420.2414
banking0.55740.46980.36830.35610.0272
snips0.96920.94740.77070.56630.5257
AVERAGE0.71930.67640.61970.55770.4900

Previous GLiClass models:

Datasetgliclass‑large‑v1.0‑lwgliclass‑base‑v1.0‑lwgliclass‑modern‑large‑v2.0gliclass‑modern‑base‑v2.0
CR0.92260.90970.91540.8977
sst20.92470.89870.93080.8524
sst50.28910.37790.21520.2346
20_news_
groups
0.40830.39530.38130.3857
spam0.36420.51260.66030.4608
financial_
phrasebank
0.90440.88800.31520.3465
imdb0.94290.93510.94490.9188
ag_news0.75590.69850.69990.6836
emotion0.39510.35160.43410.3926
cap_sotu0.47490.46430.40950.3588
rotten_
tomatoes
0.88070.84290.73860.6066
massive0.56060.46350.23940.3458
banking0.33170.43960.13550.2907
snips0.97070.95720.84680.7378
AVERAGE0.65180.65250.56190.5366

Cross-Encoders:

Datasetdeberta‑v3‑large‑zeroshot‑v2.0deberta‑v3‑base‑zeroshot‑v2.0roberta‑large‑zeroshot‑v2.0‑ccomprehend_it‑base
CR0.91340.90510.91410.8936
sst20.92720.91760.85730.9006
sst50.38610.38480.41590.4140
enron_
spam
0.59700.46400.50400.3637
financial_
phrasebank
0.58200.66900.45500.4695
imdb0.91800.89900.90400.4644
ag_news0.77100.74200.74500.6016
emotion0.48400.49500.48600.4165
cap_sotu0.50200.47700.52300.3823
rotten_
tomatoes
0.86800.86000.84100.4728
massive0.51800.52000.52000.3314
banking770.56700.44600.29000.4972
snips0.83400.74770.54300.7227
AVERAGE0.68210.65590.61520.5331

Inference Speed:

Each model was tested on examples with 64, 256, and 512 tokens in text and 1, 2, 4, 8, 16, 32, 64, and 128 labels on an a6000 GPU. Then, scores were averaged across text lengths.

image/png

Model  Name / n samples per second per m labels1248163264128Average
gliclass‑edge‑v3.0103.81101.01103.50103.5098.3696.7788.7682.6497.29
gliclass‑modern‑base‑v3.056.0055.4654.9555.6654.7354.9553.4850.3454.46
gliclass‑modern‑large‑v3.046.3046.8246.6646.3043.9344.7342.7732.8943.80
gliclass‑base‑v3.049.4250.2540.0557.6957.1456.3955.9745.9451.61
gliclass‑large‑v3.019.0526.8623.6429.2729.0428.7927.5517.6025.22
deberta‑v3‑base‑zeroshot‑v2.024.5530.4015.387.623.771.870.940.4710.63
deberta‑v3‑large‑zeroshot‑v2.016.8215.827.933.981.990.990.490.256.03
roberta‑large‑zeroshot‑v2.0‑c50.4239.2719.959.955.012.481.250.6416.12
comprehend_it‑base21.7927.3213.607.583.801.900.970.499.72

Citation

@misc{stepanov2025gliclassgeneralistlightweightmodel,
      title={GLiClass: Generalist Lightweight Model for Sequence Classification Tasks}, 
      author={Ihor Stepanov and Mykhailo Shtopko and Dmytro Vodianytskyi and Oleksandr Lukashov and Alexander Yavorskyi and Mykyta Yaroshenko},
      year={2025},
      eprint={2508.07662},
      archivePrefix={arXiv},
      primaryClass={cs.LG},
      url={https://arxiv.org/abs/2508.07662}, 
}
GLiClass
safetensors
sentiment analysis
text classification
text-classification