Text Classification
sentence-transformers
Safetensors
English
modernbert
cross-encoder
reranker
Generated from Trainer
dataset_size:1024986
loss:CrossEntropyLoss
mnli
snli
anli
Eval Results (legacy)
text-embeddings-inference
Instructions to use dleemiller/finecat-nli-s with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use dleemiller/finecat-nli-s with sentence-transformers:
from sentence_transformers import CrossEncoder model = CrossEncoder("dleemiller/finecat-nli-s") query = "Which planet is known as the Red Planet?" passages = [ "Venus is often called Earth's twin because of its similar size and proximity.", "Mars, known for its reddish appearance, is often referred to as the Red Planet.", "Jupiter, the largest planet in our solar system, has a prominent red spot.", "Saturn, famous for its rings, is sometimes mistaken for the Red Planet." ] scores = model.predict([(query, passage) for passage in passages]) print(scores) - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -48,49 +48,55 @@ model-index:
|
|
| 48 |
<img src="https://cdn-uploads.huggingface.co/production/uploads/65ff92ea467d83751a727538/Jzq_CZCyRYGrVgbto3eRr.png" style="width: 400px;">
|
| 49 |
</p>
|
| 50 |
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
|
| 55 |
This model and dataset specifically targets improving NLI, through high quality sources. The tasksource models
|
| 56 |
are the best checkpoints to start from, although training from ModernBERT is also competitive.
|
| 57 |
|
| 58 |
-
|
| 59 |
|
| 60 |
# NLI Evaluation Results
|
| 61 |
|
| 62 |
F1-Micro scores (equivalent to accuracy) for each dataset.
|
|
|
|
| 63 |
|
| 64 |
-
| Model | finecat | mnli | mnli_mismatched | snli | anli_r1 | anli_r2 | anli_r3 | wanli | lingnli |
|
| 65 |
-
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
|
| 66 |
-
| `
|
| 67 |
-
| `
|
| 68 |
-
| `
|
| 69 |
-
| `dleemiller/
|
| 70 |
-
| `
|
| 71 |
-
| `
|
| 72 |
-
| `cross-encoder/nli-deberta-v3-large` | 0.7618 | 0.9019 | 0.9049 | 0.9220 | 0.5300 | 0.4170 | 0.3758 | 0.6548 | 0.8466 |
|
| 73 |
-
| `tasksource/ModernBERT-base-nli` | 0.7595 | 0.8685 | 0.8979 | 0.8915 | 0.6300 | 0.4820 | 0.4192 | 0.6632 | 0.8118 |
|
| 74 |
-
| `dleemiller/ModernCE-base-nli` | 0.7533 | 0.8923 | 0.9035 | 0.9187 | 0.5240 | 0.3950 | 0.3333 | 0.6464 | 0.8282 |
|
| 75 |
-
| `cross-encoder/nli-deberta-v3-xsmall` | 0.7269 | 0.8781 | 0.8777 | 0.9164 | 0.3620 | 0.3030 | 0.3183 | 0.6096 | 0.8122 |
|
| 76 |
-
| `dleemiller/EttinX-nli-s` | 0.7251 | 0.8765 | 0.8798 | 0.9128 | 0.3360 | 0.2790 | 0.3083 | 0.6234 | 0.8012 |
|
| 77 |
-
| `cross-encoder/nli-MiniLM2-L6-H768` | 0.7119 | 0.8660 | 0.8683 | 0.9137 | 0.3090 | 0.2850 | 0.2867 | 0.5830 | 0.7905 |
|
| 78 |
-
| `dleemiller/EttinX-nli-xs` | 0.7013 | 0.8376 | 0.8380 | 0.8979 | 0.2780 | 0.2840 | 0.2800 | 0.5838 | 0.7521 |
|
| 79 |
-
| `cross-encoder/nli-distilroberta-base` | 0.6936 | 0.8365 | 0.8398 | 0.8996 | 0.2660 | 0.2810 | 0.2975 | 0.5516 | 0.7516 |
|
| 80 |
-
| `dleemiller/EttinX-nli-xxs` | 0.6842 | 0.7988 | 0.8047 | 0.8851 | 0.2590 | 0.3060 | 0.2992 | 0.5426 | 0.7018 |
|
| 81 |
-
|
| 82 |
|
|
|
|
| 83 |
|
|
|
|
| 84 |
|
| 85 |
-
##
|
| 86 |
-
|
| 87 |
-
Label Map:
|
| 88 |
- `entailment`: 0
|
| 89 |
- `neutral`: 1
|
| 90 |
- `contradiction`: 2
|
| 91 |
|
| 92 |
|
| 93 |
-
##
|
| 94 |
|
| 95 |
First install the Sentence Transformers library:
|
| 96 |
|
|
@@ -104,7 +110,7 @@ Then you can load the model and run inference.
|
|
| 104 |
from sentence_transformers import CrossEncoder
|
| 105 |
import numpy as np
|
| 106 |
|
| 107 |
-
model = CrossEncoder("dleemiller/finecat-nli-
|
| 108 |
id2label = model.model.config.id2label # {0:'entailment', 1:'neutral', 2:'contradiction'}
|
| 109 |
|
| 110 |
pairs = [
|
|
@@ -129,3 +135,19 @@ for (prem, hyp), row in zip(pairs, logits):
|
|
| 129 |
|
| 130 |
```
|
| 131 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
<img src="https://cdn-uploads.huggingface.co/production/uploads/65ff92ea467d83751a727538/Jzq_CZCyRYGrVgbto3eRr.png" style="width: 400px;">
|
| 49 |
</p>
|
| 50 |
|
| 51 |
+
-----
|
| 52 |
+
|
| 53 |
+
# Overview
|
| 54 |
+
|
| 55 |
+
This model is a fine-tune of `jhu-clsp/ettin-encoder-68m`,
|
| 56 |
+
trained on the `dleemiller/FineCat-NLI` dataset—a compilation of several high-quality
|
| 57 |
+
NLI data sources with quality screening and reduction of easy samples in the training split.
|
| 58 |
+
The training also incorporates logit distillation from `dleemiller/finecat-nli-l`.
|
| 59 |
+
|
| 60 |
+
Distillation loss looks like this:
|
| 61 |
+
$$
|
| 62 |
+
\begin{equation}
|
| 63 |
+
\mathcal{L} = \alpha \cdot \mathcal{L}_{\text{CE}}(z^{(s)}, y) + \beta \cdot \mathcal{L}_{\text{MSE}}(z^{(s)}, z^{(t)})
|
| 64 |
+
\end{equation}
|
| 65 |
+
$$
|
| 66 |
+
|
| 67 |
+
where \\(z^{(s)}\\) and \\(z^{(t)}\\) are the student and teacher logits, \\(y\\) are the ground truth labels,
|
| 68 |
+
and \\(\alpha\\) and \\(\beta\\) are equally weighted at 0.5.
|
| 69 |
|
| 70 |
This model and dataset specifically targets improving NLI, through high quality sources. The tasksource models
|
| 71 |
are the best checkpoints to start from, although training from ModernBERT is also competitive.
|
| 72 |
|
| 73 |
+
-----
|
| 74 |
|
| 75 |
# NLI Evaluation Results
|
| 76 |
|
| 77 |
F1-Micro scores (equivalent to accuracy) for each dataset.
|
| 78 |
+
Performance was measured at bs=32 using a Nvidia Blackwell PRO 6000 Max-Q.
|
| 79 |
|
| 80 |
+
| Model | finecat | mnli | mnli_mismatched | snli | anli_r1 | anli_r2 | anli_r3 | wanli | lingnli | Throughput (samples/s) | Peak GPU Mem (MB) |
|
| 81 |
+
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
|
| 82 |
+
| `dleemiller/finecat-nli-s` | 0.7834 | 0.8725 | 0.8725 | 0.8973 | 0.6400 | 0.4660 | 0.4617 | 0.7284 | 0.8072 | 2291.87 | 415.65 |
|
| 83 |
+
| `tasksource/deberta-small-long-nli` | 0.7492 | 0.8194 | 0.8206 | 0.8613 | 0.5670 | 0.4220 | 0.4475 | 0.7034 | 0.7605 | 2250.66 | 1351.08 |
|
| 84 |
+
| `cross-encoder/nli-deberta-v3-xsmall` | 0.7269 | 0.8781 | 0.8777 | 0.9164 | 0.3620 | 0.3030 | 0.3183 | 0.6096 | 0.8122 | 2510.05 | 753.91 |
|
| 85 |
+
| `dleemiller/EttinX-nli-s` | 0.7251 | 0.8765 | 0.8798 | 0.9128 | 0.3360 | 0.2790 | 0.3083 | 0.6234 | 0.8012 | 2348.21 | 415.65 |
|
| 86 |
+
| `cross-encoder/nli-MiniLM2-L6-H768` | 0.7119 | 0.8660 | 0.8683 | 0.9137 | 0.3090 | 0.2850 | 0.2867 | 0.5830 | 0.7905 | 2885.72 | 566.64 |
|
| 87 |
+
| `cross-encoder/nli-distilroberta-base` | 0.6936 | 0.8365 | 0.8398 | 0.8996 | 0.2660 | 0.2810 | 0.2975 | 0.5516 | 0.7516 | 2838.17 | 566.64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
|
| 89 |
+
-----
|
| 90 |
|
| 91 |
+
# Usage
|
| 92 |
|
| 93 |
+
### Label Map:
|
|
|
|
|
|
|
| 94 |
- `entailment`: 0
|
| 95 |
- `neutral`: 1
|
| 96 |
- `contradiction`: 2
|
| 97 |
|
| 98 |
|
| 99 |
+
## Direct Usage (Sentence Transformers)
|
| 100 |
|
| 101 |
First install the Sentence Transformers library:
|
| 102 |
|
|
|
|
| 110 |
from sentence_transformers import CrossEncoder
|
| 111 |
import numpy as np
|
| 112 |
|
| 113 |
+
model = CrossEncoder("dleemiller/finecat-nli-s")
|
| 114 |
id2label = model.model.config.id2label # {0:'entailment', 1:'neutral', 2:'contradiction'}
|
| 115 |
|
| 116 |
pairs = [
|
|
|
|
| 135 |
|
| 136 |
```
|
| 137 |
|
| 138 |
+
|
| 139 |
+
## Acknowledgments
|
| 140 |
+
|
| 141 |
+
We thank the creators and contributors of `tasksource` and `MoritzLaurer` for making their work available.
|
| 142 |
+
This model would not be possible without their efforts and open source contributions.
|
| 143 |
+
|
| 144 |
+
## Citation
|
| 145 |
+
|
| 146 |
+
```bibtex
|
| 147 |
+
@misc{nli-compiled-2025,
|
| 148 |
+
title = {FineCat NLI Dataset},
|
| 149 |
+
author = {Lee Miller},
|
| 150 |
+
year = {2025},
|
| 151 |
+
howpublished = {Refined compilation of 6 major NLI datasets}
|
| 152 |
+
}
|
| 153 |
+
```
|