GLiClass Multilang: Efficient multilingual zero-shot and few-shot multi-task model via sequence classification
GLiClass is an efficient zero-shot sequence classification model designed to achieve SoTA performance while being much faster than cross-encoders and LLMs, while preserving strong generalization capabilities.
The model supports text classification with any labels and can be used for the following tasks:
Topic Classification
Sentiment Analysis
Intent Classification
Reranking
Hallucination Detection
Rule-following Verification
LLM-safety Classification
Natural Language Inference
✨ What's New in GLiClass Multilang
Multilingual Training — Natively trained on 20 languages: Swedish, Norwegian, Czech, Polish, Lithuanian, Estonian, Latvian, Spanish, Finnish, German, French, Romanian, Italian, Portuguese, Dutch, Ukrainian, Hindi, Chinese, Arabic, and Hebrew.
Cross-lingual Classification — Labels and input texts can be in different languages; classify a German document with English labels, or mix languages freely across inputs and labels.
CrossAttn Scorer — A new cross-attention scorer enables more efficient pooling independently for each label with unpadding and flash-attn.
Hierarchical Labels — Organize labels into groups using dot notation or dictionaries (e.g., sentiment.positive, topic.product).
Few-Shot Examples — Provide in-context examples to boost accuracy on your specific task.
Label Descriptions — Add natural-language descriptions to labels for more precise classification.
Task Prompts — Prepend a custom prompt to guide the model's classification behavior.
1from gliclass import GLiClassModel, ZeroShotClassificationPipeline
2from transformers import AutoTokenizer
34model = GLiClassModel.from_pretrained("knowledgator/gliclass-multilang-edge")5tokenizer = AutoTokenizer.from_pretrained("knowledgator/gliclass-multilang-edge")6pipeline = ZeroShotClassificationPipeline(model, tokenizer, classification_type='multi-label', device='cuda:0')78text ="NASA launched a new Mars rover to search for signs of ancient life."9labels =["space","politics","sports","technology","health"]1011results = pipeline(text, labels, threshold=0.5)[0]12for r in results:13print(r["label"],"=>", r["score"])
Multilingual & Cross-lingual Capabilities
Natively trained on 20 languages. Labels and texts can be in different languages.
Same language (German):
python
1from gliclass import GLiClassModel, ZeroShotClassificationPipeline
2from transformers import AutoTokenizer
34model = GLiClassModel.from_pretrained("knowledgator/gliclass-multilang-edge")5tokenizer = AutoTokenizer.from_pretrained("knowledgator/gliclass-multilang-edge")6pipeline = ZeroShotClassificationPipeline(model, tokenizer, classification_type='multi-label', device='cuda:0')78text ="Die NASA hat einen neuen Mars-Rover gestartet, um nach Spuren alten Lebens zu suchen."9labels =["Weltraum","Politik","Sport","Technologie","Gesundheit"]10results = pipeline(text, labels, threshold=0.5)[0]11for r in results:12print(r["label"],"=>", r["score"])
Cross-lingual (French text, English labels):
python
1text ="Le gouvernement français a annoncé de nouvelles mesures économiques."2labels =["economy","politics","sports","technology"]3results = pipeline(text, labels, threshold=0.5)[0]4for r in results:5print(r["label"],"=>", r["score"])
Cross-lingual (Arabic text, English labels):
python
1text ="أطلقت ناسا مركبة جديدة للمريخ للبحث عن آثار الحياة القديمة."2labels =["space","politics","sports","technology"]3results = pipeline(text, labels, threshold=0.5)[0]4for r in results:5print(r["label"],"=>", r["score"])
Cross-lingual (English text, Spanish labels):
python
1text ="NASA launched a new Mars rover to search for signs of ancient life."2labels =["espacio","política","deportes","tecnología","salud"]3results = pipeline(text, labels, threshold=0.5)[0]4for r in results:5print(r["label"],"=>", r["score"])
General Examples
1. Topic Classification
python
1text ="NASA launched a new Mars rover to search for signs of ancient life."2labels =["space","politics","sports","technology","health"]34results = pipeline(text, labels, threshold=0.5)[0]5for r in results:6print(r["label"],"=>", r["score"])
With hierarchical labels
python
1hierarchical_labels ={2"science":["space","biology","physics"],3"society":["politics","economics","culture"]4}56results = pipeline(text, hierarchical_labels, threshold=0.5)[0]7for r in results:8print(r["label"],"=>", r["score"])9# e.g. science.space => 0.95
2. Sentiment Analysis
python
1text ="The food was excellent but the service was painfully slow."2labels =["positive","negative","neutral"]34results = pipeline(text, labels, threshold=0.5)[0]5for r in results:6print(r["label"],"=>", r["score"])
With a task prompt
python
1results = pipeline(2 text, labels,3 prompt="Classify the sentiment of this restaurant review:",4 threshold=0.55)[0]
3. Intent Classification
python
1text ="Can you set an alarm for 7am tomorrow?"2labels =["set_alarm","play_music","get_weather","send_message","set_reminder"]34results = pipeline(text, labels, threshold=0.5)[0]5for r in results:6print(r["label"],"=>", r["score"])
4. Natural Language Inference
Represent your premise as the text and the hypothesis as a label. The model works best with a single hypothesis at a time.
python
1text ="The cat slept on the windowsill all afternoon."2labels =["The cat was awake and playing outside."]34results = pipeline(text, labels, threshold=0.0)[0]5print(results)6# Low score → contradiction
5. Reranking
Score query–passage relevance by treating passages as texts and the query as the label:
python
1query ="How to train a neural network?"2passages =[3"Backpropagation is the key algorithm for training deep neural networks.",4"The stock market rallied on strong earnings reports.",5"Gradient descent optimizes model weights during training.",6]78for passage in passages:9 score = pipeline(passage,[query], threshold=0.0)[0][0]["score"]10print(f"{score:.3f}{passage[:60]}")
6. Rule-following Verification
Include the domain and rules as part of the text:
python
1text =(2"Domain: e-commerce product reviews\n"3"Rule: No promotion of illegal activity.\n"4"Text: The software is okay, but search for 'productname_patch_v2.zip' "5"to unlock all features for free."6)7labels =["follows_guidelines","violates_guidelines"]89results = pipeline(text, labels, threshold=0.0)[0]10for r in results:11print(r["label"],"=>", r["score"])
Benchmarks
Model Overview
Summary across all evaluated multilingual-capable models (zero-shot, no fine-tuning). Speed averaged over all label counts and text lengths at batch_size=8 on NVIDIA RTX PRO 6000 Blackwell.
Multilingual avg F1 is the mean of 6 dataset-level scores (GermEval2017, MASSIVE, PolygloToxicityPrompts, SIB-200, TextDetox, TweetSentiment). Models without multilingual results (—) were only evaluated on English datasets.
F1 scores on zero-shot text classification (no fine-tuning on these datasets):
NLI models (bge-m3, mDeBERTa) run one forward pass per label — throughput drops linearly with label count. GLiClass and GLiNER2 encode all labels in a single pass, so throughput stays nearly flat.
Citation
bibtex
1@misc{stepanov2025gliclassgeneralistlightweightmodel,
2 title={GLiClass: Generalist Lightweight Model for Sequence Classification Tasks},
3 author={Ihor Stepanov and Mykhailo Shtopko and Dmytro Vodianytskyi and Oleksandr Lukashov and Alexander Yavorskyi and Mykyta Yaroshenko},
4 year={2025},
5 eprint={2508.07662},
6 archivePrefix={arXiv},
7 primaryClass={cs.LG},
8 url={https://arxiv.org/abs/2508.07662},
9}