/ Модель

Характеристики

Лицензия
Apache 2.0
Архитектура
GLiClass · dense
Базовая модель
deberta-v3-base
Опубликована
17 фев 2025

gliclass-base-v2.0-rac-init

Классификация без дообученияТекст → label9 профессий

Лёгкая модель Knowledgator для классификации текста без размеченных примеров, анализа тональности и повторного ранжирования с использованием семантически похожих примеров.

203скачиваний за 30 дней12лайковвеса обновлены12 авг 2025

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

GLiClass base v2.0 RAC init — модель классификации последовательностей с нулевым примером от Knowledgator, основанная на microsoft/deberta-v3-base. Она использует признаки с разных слоёв сети и выполняет классификацию за один проход, что делает её вычислительно эффективной по сравнению с cross-encoder. Модель предназначена для тематической классификации, анализа тональности и повторного ранжирования в RAG-сценариях.

Версия RAC обучена учитывать примеры, найденные по семантическому сходству, и использовать их при предсказании. В тестах добавление таких примеров повышало средний F1 с 0,3090 без примеров до 0,4707 с двумя примерами; результаты зависят от набора данных и числа примеров. В карточке указана поддержка английского и французского языков. Модель распространяется в формате Safetensors по лицензии Apache-2.0; автор заявляет, что данные обучения допускают коммерческое использование.

Сценарии применения

  • классификация тем по заданным меткам без дообучения
  • определение тональности отзывов и сообщений
  • категоризация новостных статей
  • классификация вопросов по пользовательским категориям
  • повторное ранжирование документов в RAG с учётом похожих примеров

Ограничения

Качество зависит от набора данных и наличия подходящих семантически похожих примеров; результаты на отдельных тестах заметно различаются. Поддержка в карточке указана для английского и французского языков.

Для каких профессий подходит9

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Также подходит для

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

⭐ 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 and licensed data that allow commercial use and can be used in commercial applications.

This version of the model uses a layer-wise selection of features that enables a better understanding of different levels of language. The backbone model is microsoft/deberta-v3-base.

Retrieval-augmented Classification (RAC):

The main idea of this model is to utilize the information from semantically similar examples to enhance predictions in inference. The tests showed that providing the model with at least one example from the train dataset, which was retrieved by semantic similarity, could increase the F1 score from 0.3090 to 0.4275, in some cases from 0.2594 up to 0.6249. Moreover, the RAC approach, with 2 examples provided, showed an F1 score, compared to fine-tuning with 8 examples per label: 0.4707 and 0.4838, respectively.

RAC dataset generation strategy:

image/png image/png To further enhance classification performance, we generated a Retrieval-Augmented Classification (RAC) dataset. Each text example in the gliclass-v2.0 dataset was encoded using the paraphrase-MiniLM-L6-v2 sentence transformer and indexed in an HNSW (Hierarchical Navigable Small World) database. For 250k randomly selected samples, we retrieved up to three most similar examples (cosine similarity > 0.5) from the dataset.

During augmentation:

  • The number of retrieved examples per sample was randomly chosen between 1 and 3.
  • 30% of retrieved examples were replaced with random, unrelated examples to introduce controlled noise.
  • If true labels were present in a retrieved example, false labels were removed with a 50% probability to balance information clarity.

Each retrieved example was formatted using structured <<EXAMPLE>> ... <</EXAMPLE>> tags, where:

  • True labels were explicitly marked as <<TRUE_LABEL>> {label}.
  • False labels were marked as <<FALSE_LABEL>> {label}, unless removed.

For each randomly selected 250k examples, the “text” was modified as {original_text} <<EXAMPLE>> {retrieved_text} {true_labels_str} {false_labels_str} <</EXAMPLE>>... Where:

  • {original_text} is the original example text.
  • {retrieved_text} is a similar or randomly selected example.
  • {true_labels_str} contains true labels formatted as <<TRUE_LABEL>> {label}.
  • {false_labels_str} contains false labels formatted as <<FALSE_LABEL>> {label} (unless removed with 50% probability).

Such a strategy allows the model to learn how to utilize the provided information without overfocusing on RAC examples. With both relevant and randomly retrieved examples, the dataset maintains a balance between useful contextual information and controlled noise. This ensures that the model does not become overly reliant on retrieval-augmented inputs while still benefiting from additional context when available.

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-base-v2.0-rac-init")
tokenizer = AutoTokenizer.from_pretrained("knowledgator/gliclass-base-v2.0-rac-init")
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"])

To use with one RAC example:

example_1 = {
    "text": "A recently developed machine learning platform offers robust automation for complex data analysis workflows. While it enhances productivity, users have reported difficulties in integrating it with their current data infrastructure and a need for better documentation.",
    "all_labels": ["AI", "automation", "data_analysis", "usability", "integration"],
    "true_labels": ["AI", "integration", 'automation']
}

text = "The new AI-powered tool streamlines data analysis by automating repetitive tasks, improving efficiency for data scientists. However, its steep learning curve and limited integration with existing platforms pose challenges for widespread adoption."
labels = ["AI", "automation", "data_analysis", "usability", "integration"]

results = pipeline(text, labels, threshold=0.1, rac_examples=[example_1])[0]

for predict in results:
    print(predict["label"], " - ", predict["score"])

To use with several RAC examples:

example_1 = {
    "text": "A recently developed machine learning platform offers robust automation for complex data analysis workflows. While it enhances productivity, users have reported difficulties in integrating it with their current data infrastructure and a need for better documentation.",
    "all_labels": ["AI", "automation", "data_analysis", "usability", "integration"],
    "true_labels": ["AI", "integration", 'automation']
}
example_2 = {
    "text": "A cloud-based analytics tool leverages artificial intelligence to provide real-time insights. It significantly improves workflow efficiency but struggles with compatibility across different enterprise systems, requiring additional customization efforts.",
    "all_labels": ["AI", "automation", "data_analysis", "usability", "integration"],
    "true_labels": ["AI", "integration", "data_analysis"]
}
text = "The new AI-powered tool streamlines data analysis by automating repetitive tasks, improving efficiency for data scientists. However, its steep learning curve and limited integration with existing platforms pose challenges for widespread adoption."
labels = ["AI", "automation", "data_analysis", "usability", "integration"]

results = pipeline(text, labels, threshold=0.1, rac_examples=[example_1, example_2])[0]

for predict in results:
    print(predict["label"], " - ", predict["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 find a comparison with other GLiClass models:

Datasetgliclass-base-v1.0-initgliclass-large-v1.0-initgliclass-modern-base-v2.0-initgliclass-modern-large-v2.0-initgliclass-base-v2.0-rac-init
CR0.86720.80240.90410.89800.7852
sst20.83420.87340.90110.94340.8610
sst50.20480.16380.19720.11230.0598
20_news_groups0.23170.41510.24480.27920.4007
spam0.59630.54070.50740.63640.6739
financial_phrasebank0.35940.37050.25370.25620.2537
imdb0.87720.88360.82550.91370.8716
ag_news0.56140.70690.60500.69330.6759
emotion0.28650.38400.24740.37460.4160
cap_sotu0.39660.43530.29290.29190.3871
rotten_tomatoes0.66260.79330.66300.59280.7739
AVERAGE:0.53440.57900.51290.54470.5598

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

Dataset0 examples1 example2 examples3 examples
cap_sotu0.38570.46650.49350.4847
cap_sotu (8 examples)0.49380.50970.49760.4894
cap_sotu (Weak Supervision - 8)0.43190.47640.44880.4465
dair-ai_emotion0.44720.55050.56190.5705
dair-ai_emotion (8 examples)0.50880.56300.56230.5740
dair-ai_emotion (Weak Supervision - 8)0.41870.54790.56930.5828
ag_news0.67910.85070.87170.8866
ag_news (8 examples)0.84960.90020.90720.9091
ag_news (Weak Supervision - 8)0.65460.86230.88410.8978
sst50.05990.06750.11630.1267
sst5 (8 examples)0.28870.26900.26420.2394
sst5 (Weak Supervision - 8)0.07440.27800.28970.2912
ScienceQA0.11420.40350.45340.4495
ScienceQA (8 examples)0.64930.65470.69560.6770
ScienceQA (Weak Supervision - 8)0.29870.59190.59980.5674
Malicious_code_classification0.37170.62600.96720.9788
Malicious_code_classification (8 examples)0.84440.97220.97880.9772
Malicious_code_classification (Weak Supervision - 8)0.37450.92160.97880.9772
twitter-financial-news-topic0.25940.62490.64080.6427
twitter-financial-news-topic (8 examples)0.61370.70720.70990.6948
twitter-financial-news-topic (Weak Supervision - 8)0.40320.66510.63160.6114
20_newsgroups0.32110.13390.09060.1005
20_newsgroups (8 examples)0.09590.06570.04400.0445
20_newsgroups (Weak Supervision - 8)0.47650.10350.07750.0777
ChemProt0.20240.19110.15680.1329
ChemProt (8 examples)0.29850.34790.36360.3538
ChemProt (Weak Supervision - 8)0.23690.20670.19110.1780
AVERAGE:0 examples1 example2 examples3 examples
Standard0.30900.42750.47070.4718
8 examples0.48380.52450.52880.5244
Weak Supervision - 80.36610.48620.48680.4821

Here you can see how the performance of the model grows, providing more examples in comparison to other models:

ModelNum Examplessst5ag_newsemotionAVERAGE:
gliclass-base-v2.0-rac-init00.05990.67910.44720.3934
gliclass-base-v2.0-rac-init80.28870.84960.50880.6149
gliclass-base-v2.0-rac-initWeak Supervision0.07440.65460.41870.3983
gliclass-modern-large-v2.0-init00.11230.69330.37460.3934
gliclass-modern-large-v2.0-init80.50980.83390.50100.6149
gliclass-modern-large-v2.0-initWeak Supervision0.09510.64780.45200.3983
gliclass-modern-base-v2.0-init00.19720.60500.24740.3499
gliclass-modern-base-v2.0-init80.36040.74810.44200.5168
gliclass-modern-base-v2.0-initWeak Supervision0.15990.57130.32160.3509
gliclass-large-v1.0-init00.16390.70690.38400.4183
gliclass-large-v1.0-init80.42260.84150.48860.5842
gliclass-large-v1.0-initWeak Supervision0.16890.70510.45860.4442
gliclass-base-v1.0-init00.20480.56140.28650.3509
gliclass-base-v1.0-init80.20070.83590.48560.5074
gliclass-base-v1.0-initWeak Supervision0.06810.66270.30660.3458

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

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · zero-shot-classification

Нельзя запустить

Архитектура GLiClass неизвестна transformers в образе рантайма.

Класс архитектуры
GLiClassModel
Ревизия весов
ee98a6b

0 моделей