Coral-MNLI
is a high-quality zero-shot classification model based on BART-large, fine-tuned on MultiNLI.
It delivers strong performance for zero-shot and few-shot text classification without any task-specific training.
What it is good at
Zero-shot text classification
Multi-label classification
Natural Language Inference (NLI)
Topic detection, sentiment, intent, content moderation, and many other classification tasks
Just provide the text and a list of candidate labels — the model ranks them by how well they fit.
Model Details
Property
Value
Architecture
BART-large
Task
Sequence Classification (NLI)
Labels
contradiction / neutral / entailment
Max Sequence Length
1024
Vocabulary Size
50,265
License
MIT
Quick Start
Using the Pipeline (recommended)
from transformers import pipeline
classifier = pipeline(
"zero-shot-classification",
model="path/to/Coral-MNLI"
)
sequence = "One day I will see the world"
candidate_labels = ["travel", "cooking", "dancing"]
result = classifier(sequence, candidate_labels)
print(result)
Multi-label mode
result = classifier(
sequence,
candidate_labels=["travel", "cooking", "dancing", "exploration"],
multi_label=True
)
Manual usage
from transformers import AutoModelForSequenceClassification, AutoTokenizer
import torch
model = AutoModelForSequenceClassification.from_pretrained("path/to/Coral-MNLI")
tokenizer = AutoTokenizer.from_pretrained("path/to/Coral-MNLI")
premise = "One day I will see the world"
label = "travel"
hypothesis = f"This example is {label}."
inputs = tokenizer(premise, hypothesis, return_tensors="pt", truncation=True)
with torch.no_grad():
logits = model(**inputs).logits
# Take only contradiction (0) and entailment (2)
probs = torch.softmax(logits[:, [0, 2]], dim=1)
prob_label_is_true = probs[0, 1].item()
print(f"Probability that the text is about '{label}': {prob_label_is_true:.4f}")
How Zero-Shot Classification works
The model treats the input text as a
premise
and turns each candidate label into a
hypothesis
of the form:
"This example is {label}."
It then uses the entailment probability as the score for that label. This simple trick works surprisingly well across many domains.
Tips for best results
Use clear and specific labels
Prefer multi_label=True when several labels can be true at the same time
For short texts the model is usually very accurate
For very long texts, keep the most important part near the beginning (truncation keeps the start)
Coral huggingface.co is an AI model on huggingface.co that provides Coral's model effect (), which can be used instantly with this roskosmos19 Coral model. huggingface.co supports a free trial of the Coral model, and also provides paid use of the Coral. Support call Coral model through api, including Node.js, Python, http.
Coral huggingface.co is an online trial and call api platform, which integrates Coral's modeling effects, including api services, and provides a free online trial of Coral, you can try Coral online for free by clicking the link below.
roskosmos19 Coral online free url in huggingface.co:
Coral is an open source model from GitHub that offers a free installation service, and any user can find Coral on GitHub to install. At the same time, huggingface.co provides the effect of Coral install, users can directly use Coral installed effect in huggingface.co for debugging and trial. It also supports api for free installation.