knowledgator/gliclass-small-v1.0

Model

⭐ GLiClass: Generalist and Lightweight Model for Sequence Classification

3

6 commits

2 linked in READMEs

updated Aug 12, 2025

See the code

README

⭐ 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 synthetic data and can be used in commercial applications.

How to use:

First of all, you need to install GLiClass library:

pip install gliclass

Than you need to initialize a model and a pipeline:

from gliclass import GLiClassModel, ZeroShotClassificationPipeline
from transformers import AutoTokenizer

model = GLiClassModel.from_pretrained("knowledgator/gliclass-small-v1.0")
tokenizer = AutoTokenizer.from_pretrained("knowledgator/gliclass-small-v1.0")

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"])

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.

ModelIMDBAG_NEWSEmotions
gliclass-large-v1.0 (438 M)0.94040.75160.4874
gliclass-base-v1.0 (186 M)0.86500.68370.4749
gliclass-small-v1.0 (144 M)0.86500.68050.4664
Bart-large-mnli (407 M)0.890.68870.3765
Deberta-base-v3 (184 M)0.850.64550.5095
Comprehendo (184M)0.900.79820.5660
SetFit BAAI/bge-small-en-v1.5 (33.4M)0.860.56360.5754

Below you can find a comparison with other GLiClass models:

Datasetgliclass-small-v1.0-lwgliclass-base-v1.0-lwgliclass-large-v1.0-lwgliclass-small-v1.0gliclass-base-v1.0gliclass-large-v1.0
CR0.88860.90970.92260.88240.89420.9219
sst20.83920.89870.92470.85180.89790.9269
sst50.28650.37790.28910.24240.27890.3900
20_news_groups0.45720.39530.40830.33660.35760.3863
spam0.51180.51260.36420.40890.49380.3661
rotten_tomatoes0.80150.84290.88070.79870.85080.8808
massive0.31800.46350.56060.25460.18930.4376
banking0.17680.43960.33170.13740.20770.2847
yahoo_topics0.46860.47840.47600.44770.45160.4921
financial_phrasebank0.86650.88800.90440.89010.89550.8735
imdb0.90480.93510.94290.89820.92380.9333
ag_news0.72520.69850.75590.72420.68480.7503
dair_emotion0.40120.35160.39510.34500.23570.4013
capsotu0.37940.46430.47490.34320.43750.4644
Average:0.57320.61830.61650.54010.55710.6078

Here you can see how the performance of the model grows providing more examples:

ModelNum Examplessst5spammassivebankingag newsdair emotioncapsotuAverage
gliclass-small-v1.0-lw00.28650.51180.3180.17680.72520.40120.37940.3998428571
gliclass-base-v1.0-lw00.37790.51260.46350.43960.69850.35160.46430.4725714286
gliclass-large-v1.0-lw00.28910.36420.56060.33170.75590.39510.47490.4530714286
gliclass-small-v1.000.24240.40890.25460.13740.72420.3450.34320.3508142857
gliclass-base-v1.000.27890.49380.18930.20770.68480.23570.43750.3611
gliclass-large-v1.000.390.36610.43760.28470.75030.40130.46440.4420571429
gliclass-small-v1.0-lw80.27090.840260.620.68830.77860.4490.49180.5912657143
gliclass-base-v1.0-lw80.42750.88360.7290.76670.79680.38660.48580.6394285714
gliclass-large-v1.0-lw80.33450.89970.76580.8480.848430.52190.5080.67519
gliclass-small-v1.080.30420.56830.63320.70720.7590.45090.44340.5523142857
gliclass-base-v1.080.33870.73610.70590.74560.78960.43230.48020.6040571429
gliclass-large-v1.080.43650.90180.770.85330.85090.50610.49350.6874428571

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}, 
}
endpoints_compatible
GLiClass
onnx
safetensors
sentiment analysis
small language models
text classification
transformers
zero-shot
zero-shot-classification

Contributors

Ihor

3 commits

werent4

2 commits

BioMike

1 commits

knowledgator/gliclass-small-v1.0

Model

⭐ GLiClass: Generalist and Lightweight Model for Sequence Classification

3

6 commits

2 linked in READMEs

updated Aug 12, 2025

See the code

README

⭐ 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 synthetic data and can be used in commercial applications.

How to use:

First of all, you need to install GLiClass library:

pip install gliclass

Than you need to initialize a model and a pipeline:

from gliclass import GLiClassModel, ZeroShotClassificationPipeline
from transformers import AutoTokenizer

model = GLiClassModel.from_pretrained("knowledgator/gliclass-small-v1.0")
tokenizer = AutoTokenizer.from_pretrained("knowledgator/gliclass-small-v1.0")

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"])

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.

ModelIMDBAG_NEWSEmotions
gliclass-large-v1.0 (438 M)0.94040.75160.4874
gliclass-base-v1.0 (186 M)0.86500.68370.4749
gliclass-small-v1.0 (144 M)0.86500.68050.4664
Bart-large-mnli (407 M)0.890.68870.3765
Deberta-base-v3 (184 M)0.850.64550.5095
Comprehendo (184M)0.900.79820.5660
SetFit BAAI/bge-small-en-v1.5 (33.4M)0.860.56360.5754

Below you can find a comparison with other GLiClass models:

Datasetgliclass-small-v1.0-lwgliclass-base-v1.0-lwgliclass-large-v1.0-lwgliclass-small-v1.0gliclass-base-v1.0gliclass-large-v1.0
CR0.88860.90970.92260.88240.89420.9219
sst20.83920.89870.92470.85180.89790.9269
sst50.28650.37790.28910.24240.27890.3900
20_news_groups0.45720.39530.40830.33660.35760.3863
spam0.51180.51260.36420.40890.49380.3661
rotten_tomatoes0.80150.84290.88070.79870.85080.8808
massive0.31800.46350.56060.25460.18930.4376
banking0.17680.43960.33170.13740.20770.2847
yahoo_topics0.46860.47840.47600.44770.45160.4921
financial_phrasebank0.86650.88800.90440.89010.89550.8735
imdb0.90480.93510.94290.89820.92380.9333
ag_news0.72520.69850.75590.72420.68480.7503
dair_emotion0.40120.35160.39510.34500.23570.4013
capsotu0.37940.46430.47490.34320.43750.4644
Average:0.57320.61830.61650.54010.55710.6078

Here you can see how the performance of the model grows providing more examples:

ModelNum Examplessst5spammassivebankingag newsdair emotioncapsotuAverage
gliclass-small-v1.0-lw00.28650.51180.3180.17680.72520.40120.37940.3998428571
gliclass-base-v1.0-lw00.37790.51260.46350.43960.69850.35160.46430.4725714286
gliclass-large-v1.0-lw00.28910.36420.56060.33170.75590.39510.47490.4530714286
gliclass-small-v1.000.24240.40890.25460.13740.72420.3450.34320.3508142857
gliclass-base-v1.000.27890.49380.18930.20770.68480.23570.43750.3611
gliclass-large-v1.000.390.36610.43760.28470.75030.40130.46440.4420571429
gliclass-small-v1.0-lw80.27090.840260.620.68830.77860.4490.49180.5912657143
gliclass-base-v1.0-lw80.42750.88360.7290.76670.79680.38660.48580.6394285714
gliclass-large-v1.0-lw80.33450.89970.76580.8480.848430.52190.5080.67519
gliclass-small-v1.080.30420.56830.63320.70720.7590.45090.44340.5523142857
gliclass-base-v1.080.33870.73610.70590.74560.78960.43230.48020.6040571429
gliclass-large-v1.080.43650.90180.770.85330.85090.50610.49350.6874428571

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}, 
}
endpoints_compatible
GLiClass
onnx
safetensors
sentiment analysis
small language models
text classification
transformers
zero-shot
zero-shot-classification

Contributors

Ihor

3 commits

werent4

2 commits

BioMike

1 commits