🚀 Bloomz-3b-NLI Model
The Bloomz-3b-NLI model is fine - tuned from the Bloomz - 3b - chat - dpo foundation model, trained on a language - agnostic Natural Language Inference (NLI) task.
🚀 Quick Start
The Bloomz-3b-NLI model is fine-tuned from the Bloomz-3b-chat-dpo foundation model. It is trained on a Natural Language Inference (NLI) task in a language-agnostic manner. The NLI task focuses on determining the semantic relationship between a hypothesis and a set of premises, typically presented as sentence pairs. The goal is to predict textual entailment (whether sentence A implies, contradicts, or has no relation to sentence B), which is a classification task.
Language-agnostic approach
It's worth noting that hypotheses and premises are randomly selected from English and French, with each language combination having a 25% probability.
Performance
class |
precision (%) |
f1-score (%) |
support |
global |
81.96 |
81.07 |
5,010 |
contradiction |
81.80 |
84.04 |
1,670 |
entailment |
84.82 |
81.96 |
1,670 |
neutral |
76.85 |
77.20 |
1,670 |
Benchmark
Hypothesis and premise in French
Hypothesis in French and premise in English (cross - language context)
✨ Features
Zero-shot Classification
The main advantage of training such models lies in their zero-shot classification performance. This means the model can classify any text with any label without specific training. What differentiates the Bloomz-3b-NLI LLMs in this area is their ability to model and extract information from much more complex and lengthy text structures compared to models like BERT, RoBERTa, or CamemBERT.
The zero-shot classification task can be summarized by:
$$P(hypothesis=i\in\mathcal{C}|premise)=\frac{e^{P(premise=entailment\vert hypothesis=i)}}{\sum_{j\in\mathcal{C}}e^{P(premise=entailment\vert hypothesis=j)}}$$
Here, i represents a hypothesis composed of a template (e.g., "This text is about {}."), and #C represents candidate labels ("cinema", "politics", etc.). The set of hypotheses consists of {"This text is about cinema.", "This text is about politics.", ...}. We measure these hypotheses against the premise, which is the sentence we want to classify.
Performance
The model is evaluated based on sentiment analysis on the French film review site Allociné. The dataset contains 20,000 reviews labeled into two classes: positive and negative comments. We use the hypothesis template "Ce commentaire est {}." and the candidate classes "positif" and "negatif".
💻 Usage Examples
Basic Usage
from transformers import pipeline
classifier = pipeline(
task='zero-shot-classification',
model="cmarkea/bloomz-3b-nli"
)
result = classifier (
sequences="Le style très cinéphile de Quentin Tarantino "
"se reconnaît entre autres par sa narration postmoderne "
"et non linéaire, ses dialogues travaillés souvent "
"émaillés de références à la culture populaire, et ses "
"scènes hautement esthétiques mais d'une violence "
"extrême, inspirées de films d'exploitation, d'arts "
"martiaux ou de western spaghetti.",
candidate_labels="cinéma, technologie, littérature, politique",
hypothesis_template="Ce texte parle de {}."
)
result
{"labels": ["cinéma",
"littérature",
"technologie",
"politique"],
"scores": [0.8745610117912292,
0.10403601825237274,
0.014962797053158283,
0.0064402492716908455]}
result = classifier (
sequences="Quentin Tarantino's very cinephile style is "
"recognized, among other things, by his postmodern and "
"non-linear narration, his elaborate dialogues often "
"peppered with references to popular culture, and his "
"highly aesthetic but extremely violent scenes, inspired by "
"exploitation films, martial arts or spaghetti western.",
candidate_labels="cinéma, technologie, littérature, politique",
hypothesis_template="Ce texte parle de {}."
)
result
{"labels": ["cinéma",
"littérature",
"technologie",
"politique"],
"scores": [0.9314399361610413,
0.04960821941494942,
0.013468802906572819,
0.005483036395162344]}
📄 License
The model uses the bigscience-bloom-rail-1.0 license.
Property |
Details |
Model Type |
Bloomz-3b-NLI |
Training Data |
xnli |
License |
bigscience-bloom-rail-1.0 |
Languages |
French, English |
Pipeline Tag |
zero-shot-classification |
Base Model |
cmarkea/bloomz-3b-dpo-chat |
📚 Documentation
Citation
@online{DeBloomzNLI,
AUTHOR = {Cyrile Delestre},
URL = {https://huggingface.co/cmarkea/bloomz-3b-nli},
YEAR = {2024},
KEYWORDS = {NLP ; Transformers ; LLM ; Bloomz},
}