Text Classification
ONNX
glitext
text classification
nli
sentiment analysis
rpeel commited on
Commit
04a86b1
·
verified ·
1 Parent(s): 4b45291

Update model card and security scan results

Browse files
Files changed (1) hide show
  1. README.md +178 -16
README.md CHANGED
@@ -1,28 +1,199 @@
1
  ---
2
- library_name: glitext
3
  license: apache-2.0
 
 
 
 
 
 
4
  tags:
 
 
 
5
  - glitext
 
 
6
  glitext:
7
  name: class-base
8
  label: GliText Classification (Balanced)
9
- description: An efficient zero-shot text classification model tuned to balance speed and accuracy.
 
10
  recognition: false
11
  classification: true
12
  association: false
13
  span_mode: false
14
  size_gb: 1.0
15
- hf_repo: rpeel/glitext-class-base
16
  source_url: knowledgator/gliclass-base-v3.0
17
  ---
18
 
19
- # glitext-class-base
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
 
21
- An efficient zero-shot text classification model tuned to balance speed and accuracy.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
- ## Requirements
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
- To download this model to the SAS GLiText server:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
 
27
  ```
28
  POST /v1/models/download?name=class-base
@@ -34,11 +205,6 @@ To download and load into memory in one step:
34
  PUT /v1/models?name=class-base
35
  ```
36
 
37
- ## Source Model
38
-
39
- Exported from [knowledgator/gliclass-base-v3.0](https://huggingface.co/knowledgator/gliclass-base-v3.0).
40
- See the [original model card](https://huggingface.co/knowledgator/gliclass-base-v3.0) for full architecture and training details.
41
-
42
  ## Security Scan
43
 
44
  Scanned with [modelaudit](https://github.com/promptfoo/modelaudit) v0.2.40 on 2026-04-26. 16/16 checks passed. [Full results](modelaudit.json).
@@ -47,7 +213,3 @@ Scanned with [modelaudit](https://github.com/promptfoo/modelaudit) v0.2.40 on 20
47
  | File | Size | SHA-256 |
48
  |------|------|---------|
49
  | `model.onnx` | 747.3 MB | `1395fde4ae8de8e4…` |
50
-
51
- ## License
52
-
53
- [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0). Derived from [knowledgator/gliclass-base-v3.0](https://huggingface.co/knowledgator/gliclass-base-v3.0) by [knowledgator](https://huggingface.co/knowledgator).
 
1
  ---
 
2
  license: apache-2.0
3
+ datasets:
4
+ - BioMike/formal-logic-reasoning-gliclass-2k
5
+ - knowledgator/gliclass-v3-logic-dataset
6
+ - tau/commonsense_qa
7
+ metrics:
8
+ - f1
9
  tags:
10
+ - text classification
11
+ - nli
12
+ - sentiment analysis
13
  - glitext
14
+ pipeline_tag: text-classification
15
+ library_name: glitext
16
  glitext:
17
  name: class-base
18
  label: GliText Classification (Balanced)
19
+ description: An efficient zero-shot text classification model tuned to balance speed
20
+ and accuracy.
21
  recognition: false
22
  classification: true
23
  association: false
24
  span_mode: false
25
  size_gb: 1.0
26
+ hf_repo: sassoftware/glitext-class-base
27
  source_url: knowledgator/gliclass-base-v3.0
28
  ---
29
 
30
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/6405f62ba577649430be5124/I9RAQol7giilBHbbf2T7M.png)
31
+
32
+ # GLiClass: Generalist and Lightweight Model for Sequence Classification
33
+
34
+ This is an efficient zero-shot classifier inspired by [GLiNER](https://github.com/urchade/GLiNER/tree/main) work. It demonstrates the same performance as a cross-encoder while being more compute-efficient because classification is done at a single forward path.
35
+
36
+ It can be used for `topic classification`, `sentiment analysis`, and as a reranker in `RAG` pipelines.
37
+
38
+ The model was trained on logical tasks to induce reasoning. LoRa adapters were used to fine-tune the model without destroying the previous knowledge.
39
+
40
+ LoRA parameters:
41
+ | | [gliclass‑modern‑base‑v3.0](https://huggingface.co/knowledgator/gliclass-modern-base-v3.0) | [gliclass‑modern‑large‑v3.0](https://huggingface.co/knowledgator/gliclass-modern-large-v3.0) | [gliclass‑base‑v3.0](https://huggingface.co/knowledgator/gliclass-base-v3.0) | [gliclass‑large‑v3.0](https://huggingface.co/knowledgator/gliclass-large-v3.0) |
42
+ |----------------------|---------------------------------|----------------------------------|--------------------------------|---------------------------------|
43
+ | LoRa r | 512 | 768 | 384 | 384 |
44
+ | LoRa α | 1024 | 1536 | 768 | 768 |
45
+ | focal loss α | 0.7 | 0.7 | 0.7 | 0.7 |
46
+ | 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" |
47
+
48
+ GLiClass-V3 Models:
49
+ Model name | Size | Params | Average Banchmark | Average Inference Speed (batch size = 1, a6000, examples/s)
50
+ |----------|------|--------|-------------------|---------------------------------------------------------|
51
+ [gliclass‑edge‑v3.0](https://huggingface.co/knowledgator/gliclass‑edge‑v3.0)| 131 MB | 32.7M | 0.4873 | 97.29 |
52
+ [gliclass‑modern‑base‑v3.0](https://huggingface.co/knowledgator/gliclass-modern-base-v3.0)| 606 MB | 151M | 0.5571 | 54.46 |
53
+ [gliclass‑modern‑large‑v3.0](https://huggingface.co/knowledgator/gliclass-modern-large-v3.0)| 1.6 GB | 399M | 0.6082 | 43.80 |
54
+ [gliclass‑base‑v3.0](https://huggingface.co/knowledgator/gliclass-base-v3.0)| 746 MB | 187M | 0.6556 | 51.61 |
55
+ [gliclass‑large‑v3.0](https://huggingface.co/knowledgator/gliclass-large-v3.0)| 1.75 GB | 439M | 0.7001 | 25.22 |
56
+
57
+
58
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/6405f62ba577649430be5124/MvfWyOdG824KWWB4Hy-dG.png)
59
+
60
+ ### How to use:
61
+ First of all, you need to install GLiClass library:
62
+ ```bash
63
+ pip install gliclass
64
+ pip install -U transformers>=4.48.0
65
+ ```
66
+
67
+ Then you need to initialize a model and a pipeline:
68
+ ```python
69
+ from gliclass import GLiClassModel, ZeroShotClassificationPipeline
70
+ from transformers import AutoTokenizer
71
+
72
+ model = GLiClassModel.from_pretrained("knowledgator/gliclass-base-v3.0")
73
+ tokenizer = AutoTokenizer.from_pretrained("knowledgator/gliclass-base-v3.0")
74
+ pipeline = ZeroShotClassificationPipeline(model, tokenizer, classification_type='multi-label', device='cuda:0')
75
+
76
+ text = "One day I will see the world!"
77
+ labels = ["travel", "dreams", "sport", "science", "politics"]
78
+ results = pipeline(text, labels, threshold=0.5)[0] #because we have one text
79
+ for result in results:
80
+ print(result["label"], "=>", result["score"])
81
+ ```
82
+
83
+ 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.
84
+ ```python
85
+ # Initialize model and multi-label pipeline
86
+ text = "The cat slept on the windowsill all afternoon"
87
+ labels = ["The cat was awake and playing outside."]
88
+ results = pipeline(text, labels, threshold=0.0)[0]
89
+ print(results)
90
+ ```
91
+
92
+ ### Benchmarks:
93
+ 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.
94
 
95
+ GLiClass-V3:
96
+ | Dataset | [gliclass‑large‑v3.0](https://huggingface.co/knowledgator/gliclass-large-v3.0) | [gliclass‑base‑v3.0](https://huggingface.co/knowledgator/gliclass-base-v3.0) | [gliclass‑modern‑large‑v3.0](https://huggingface.co/knowledgator/gliclass-modern-large-v3.0) | [gliclass‑modern‑base‑v3.0](https://huggingface.co/knowledgator/gliclass-modern-base-v3.0) | [gliclass‑edge‑v3.0](https://huggingface.co/knowledgator/gliclass-edge-v3.0) |
97
+ |----------------------------|---------|---------|---------|---------|---------|
98
+ | CR | 0.9398 | 0.9127 | 0.8952 | 0.8902 | 0.8215 |
99
+ | sst2 | 0.9192 | 0.8959 | 0.9330 | 0.8959 | 0.8199 |
100
+ | sst5 | 0.4606 | 0.3376 | 0.4619 | 0.2756 | 0.2823 |
101
+ | 20_news_<br>groups | 0.5958 | 0.4759 | 0.3905 | 0.3433 | 0.2217 |
102
+ | spam | 0.7584 | 0.6760 | 0.5813 | 0.6398 | 0.5623 |
103
+ | financial_<br>phrasebank | 0.9000 | 0.8971 | 0.5929 | 0.4200 | 0.5004 |
104
+ | imdb | 0.9366 | 0.9251 | 0.9402 | 0.9158 | 0.8485 |
105
+ | ag_news | 0.7181 | 0.7279 | 0.7269 | 0.6663 | 0.6645 |
106
+ | emotion | 0.4506 | 0.4447 | 0.4517 | 0.4254 | 0.3851 |
107
+ | cap_sotu | 0.4589 | 0.4614 | 0.4072 | 0.3625 | 0.2583 |
108
+ | rotten_<br>tomatoes | 0.8411 | 0.7943 | 0.7664 | 0.7070 | 0.7024 |
109
+ | massive | 0.5649 | 0.5040 | 0.3905 | 0.3442 | 0.2414 |
110
+ | banking | 0.5574 | 0.4698 | 0.3683 | 0.3561 | 0.0272 |
111
+ | snips | 0.9692 | 0.9474 | 0.7707 | 0.5663 | 0.5257 |
112
+ | **AVERAGE** | **0.7193** | **0.6764** | **0.6197** | **0.5577** | **0.4900** |
113
 
114
+ Previous GLiClass models:
115
+ | Dataset | [gliclass‑large‑v1.0‑lw](https://huggingface.co/knowledgator/gliclass-large-v1.0-lw) | [gliclass‑base‑v1.0‑lw](https://huggingface.co/knowledgator/gliclass-base-v1.0-lw) | [gliclass‑modern‑large‑v2.0](https://huggingface.co/knowledgator/gliclass-modern-large-v2.0) | [gliclass‑modern‑base‑v2.0](https://huggingface.co/knowledgator/gliclass-modern-base-v2.0) |
116
+ |----------------------------|---------------------------------|--------------------------------|----------------------------------|---------------------------------|
117
+ | CR | 0.9226 | 0.9097 | 0.9154 | 0.8977 |
118
+ | sst2 | 0.9247 | 0.8987 | 0.9308 | 0.8524 |
119
+ | sst5 | 0.2891 | 0.3779 | 0.2152 | 0.2346 |
120
+ | 20_news_<br>groups | 0.4083 | 0.3953 | 0.3813 | 0.3857 |
121
+ | spam | 0.3642 | 0.5126 | 0.6603 | 0.4608 |
122
+ | financial_<br>phrasebank | 0.9044 | 0.8880 | 0.3152 | 0.3465 |
123
+ | imdb | 0.9429 | 0.9351 | 0.9449 | 0.9188 |
124
+ | ag_news | 0.7559 | 0.6985 | 0.6999 | 0.6836 |
125
+ | emotion | 0.3951 | 0.3516 | 0.4341 | 0.3926 |
126
+ | cap_sotu | 0.4749 | 0.4643 | 0.4095 | 0.3588 |
127
+ | rotten_<br>tomatoes | 0.8807 | 0.8429 | 0.7386 | 0.6066 |
128
+ | massive | 0.5606 | 0.4635 | 0.2394 | 0.3458 |
129
+ | banking | 0.3317 | 0.4396 | 0.1355 | 0.2907 |
130
+ | snips | 0.9707 | 0.9572 | 0.8468 | 0.7378 |
131
+ | **AVERAGE** | **0.6518** | **0.6525** | **0.5619** | **0.5366** |
132
 
133
+
134
+ Cross-Encoders:
135
+ | Dataset | [deberta‑v3‑large‑zeroshot‑v2.0](https://huggingface.co/MoritzLaurer/deberta-v3-large-zeroshot-v2.0) | [deberta‑v3‑base‑zeroshot‑v2.0](https://huggingface.co/MoritzLaurer/deberta-v3-base-zeroshot-v2.0) | [roberta‑large‑zeroshot‑v2.0‑c](https://huggingface.co/MoritzLaurer/roberta-large-zeroshot-v2.0-c) | [comprehend_it‑base](https://huggingface.co/knowledgator/comprehend_it-base) |
136
+ |------------------------------------|--------|--------|--------|--------|
137
+ | CR | 0.9134 | 0.9051 | 0.9141 | 0.8936 |
138
+ | sst2 | 0.9272 | 0.9176 | 0.8573 | 0.9006 |
139
+ | sst5 | 0.3861 | 0.3848 | 0.4159 | 0.4140 |
140
+ | enron_<br>spam | 0.5970 | 0.4640 | 0.5040 | 0.3637 |
141
+ | financial_<br>phrasebank | 0.5820 | 0.6690 | 0.4550 | 0.4695 |
142
+ | imdb | 0.9180 | 0.8990 | 0.9040 | 0.4644 |
143
+ | ag_news | 0.7710 | 0.7420 | 0.7450 | 0.6016 |
144
+ | emotion | 0.4840 | 0.4950 | 0.4860 | 0.4165 |
145
+ | cap_sotu | 0.5020 | 0.4770 | 0.5230 | 0.3823 |
146
+ | rotten_<br>tomatoes | 0.8680 | 0.8600 | 0.8410 | 0.4728 |
147
+ | massive | 0.5180 | 0.5200 | 0.5200 | 0.3314 |
148
+ | banking77 | 0.5670 | 0.4460 | 0.2900 | 0.4972 |
149
+ | snips | 0.8340 | 0.7477 | 0.5430 | 0.7227 |
150
+ | **AVERAGE** | **0.6821** | **0.6559** | **0.6152** | **0.5331** |
151
+
152
+
153
+ Inference Speed:
154
+
155
+ 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.
156
+
157
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/6405f62ba577649430be5124/YipDUMZuIqL4f8mWl7IHt.png)
158
+
159
+ Model  Name / n samples per second per m labels | 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128 | **Average** |
160
+ |---------------------|---|---|---|---|----|----|----|-----|---------|
161
+ | [gliclass‑edge‑v3.0](https://huggingface.co/knowledgator/gliclass-edge-v3.0) | 103.81 | 101.01 | 103.50 | 103.50 | 98.36 | 96.77 | 88.76 | 82.64 | **97.29** |
162
+ | [gliclass‑modern‑base‑v3.0](https://huggingface.co/knowledgator/gliclass-modern-base-v3.0) | 56.00 | 55.46 | 54.95 | 55.66 | 54.73 | 54.95 | 53.48 | 50.34 | **54.46** |
163
+ | [gliclass‑modern‑large‑v3.0](https://huggingface.co/knowledgator/gliclass-modern-large-v3.0) | 46.30 | 46.82 | 46.66 | 46.30 | 43.93 | 44.73 | 42.77 | 32.89 | **43.80** |
164
+ | [gliclass‑base‑v3.0](https://huggingface.co/knowledgator/gliclass-base-v3.0) | 49.42 | 50.25 | 40.05 | 57.69 | 57.14 | 56.39 | 55.97 | 45.94 | **51.61** |
165
+ | [gliclass‑large‑v3.0](https://huggingface.co/knowledgator/gliclass-large-v3.0) | 19.05 | 26.86 | 23.64 | 29.27 | 29.04 | 28.79 | 27.55 | 17.60 | **25.22** |
166
+ | [deberta‑v3‑base‑zeroshot‑v2.0](https://huggingface.co/MoritzLaurer/deberta-v3-base-zeroshot-v2.0) | 24.55 | 30.40 | 15.38 | 7.62 | 3.77 | 1.87 | 0.94 | 0.47 | **10.63** |
167
+ | [deberta‑v3‑large‑zeroshot‑v2.0](https://huggingface.co/MoritzLaurer/deberta-v3-large-zeroshot-v2.0) | 16.82 | 15.82 | 7.93 | 3.98 | 1.99 | 0.99 | 0.49 | 0.25 | **6.03** |
168
+ | [roberta‑large‑zeroshot‑v2.0‑c](https://huggingface.co/MoritzLaurer/roberta-large-zeroshot-v2.0-c) | 50.42 | 39.27 | 19.95 | 9.95 | 5.01 | 2.48 | 1.25 | 0.64 | **16.12** |
169
+ | [comprehend_it‑base](https://huggingface.co/knowledgator/comprehend_it-base) | 21.79 | 27.32 | 13.60 | 7.58 | 3.80 | 1.90 | 0.97 | 0.49 | **9.72** |
170
+
171
+ ## Citation
172
+ ```bibtex
173
+ @misc{stepanov2025gliclassgeneralistlightweightmodel,
174
+ title={GLiClass: Generalist Lightweight Model for Sequence Classification Tasks},
175
+ author={Ihor Stepanov and Mykhailo Shtopko and Dmytro Vodianytskyi and Oleksandr Lukashov and Alexander Yavorskyi and Mykyta Yaroshenko},
176
+ year={2025},
177
+ eprint={2508.07662},
178
+ archivePrefix={arXiv},
179
+ primaryClass={cs.LG},
180
+ url={https://arxiv.org/abs/2508.07662},
181
+ }
182
+ ```
183
+
184
+ ## Source Model Repo
185
+
186
+ This model is derived from [`knowledgator/gliclass-base-v3.0`](https://huggingface.co/knowledgator/gliclass-base-v3.0). See the upstream repository for the original safetensors weights, training data, and the full upstream model card.
187
+
188
+ ## ONNX Weights
189
+
190
+ ONNX weights added by SAS — converted from the upstream safetensors checkpoint.
191
+
192
+ File in this repo: `model.onnx`.
193
+
194
+ ## Using this Model with the SAS GLiText API
195
+
196
+ This repo is consumed by the SAS GLiText product. To download it onto a SAS GLiText server:
197
 
198
  ```
199
  POST /v1/models/download?name=class-base
 
205
  PUT /v1/models?name=class-base
206
  ```
207
 
 
 
 
 
 
208
  ## Security Scan
209
 
210
  Scanned with [modelaudit](https://github.com/promptfoo/modelaudit) v0.2.40 on 2026-04-26. 16/16 checks passed. [Full results](modelaudit.json).
 
213
  | File | Size | SHA-256 |
214
  |------|------|---------|
215
  | `model.onnx` | 747.3 MB | `1395fde4ae8de8e4…` |