Text Classification
sentence-transformers
Safetensors
English
modernbert
cross-encoder
reranker
Generated from Trainer
dataset_size:942069
loss:PrecomputedDistillationLoss
Eval Results (legacy)
text-embeddings-inference
Instructions to use dleemiller/EttinX-nli-xxs with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use dleemiller/EttinX-nli-xxs with sentence-transformers:
from sentence_transformers import CrossEncoder model = CrossEncoder("dleemiller/EttinX-nli-xxs") 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
File size: 4,671 Bytes
0a048a4 7cf05f1 0a048a4 7cf05f1 0a048a4 7cf05f1 0a048a4 e563719 0a048a4 7cf05f1 0a048a4 7cf05f1 e563719 7cf05f1 0a048a4 7cf05f1 0a048a4 7cf05f1 0a048a4 fb6d5b9 35a01bd 0a048a4 7cf05f1 0a048a4 7cf05f1 0a048a4 7cf05f1 0a048a4 7cf05f1 0a048a4 7cf05f1 0a048a4 7cf05f1 0a048a4 7cf05f1 0a048a4 7cf05f1 0a048a4 7cf05f1 0a048a4 7cf05f1 0a048a4 7cf05f1 0a048a4 7cf05f1 0a048a4 7cf05f1 e563719 7cf05f1 0a048a4 7cf05f1 0a048a4 7cf05f1 0a048a4 7cf05f1 0a048a4 7cf05f1 0a048a4 7cf05f1 0a048a4 7cf05f1 0a048a4 7cf05f1 0a048a4 7cf05f1 0a048a4 7cf05f1 0a048a4 7cf05f1 0a048a4 7cf05f1 0a048a4 7cf05f1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | ---
language:
- en
tags:
- sentence-transformers
- cross-encoder
- reranker
- generated_from_trainer
- dataset_size:942069
- loss:PrecomputedDistillationLoss
base_model: jhu-clsp/ettin-encoder-17m
datasets:
- dleemiller/all-nli-distill
pipeline_tag: text-classification
library_name: sentence-transformers
metrics:
- f1_macro
- f1_micro
- f1_weighted
model-index:
- name: CrossEncoder based on jhu-clsp/ettin-encoder-17m
results:
- task:
type: cross-encoder-classification
name: Cross Encoder Classification
dataset:
name: AllNLI dev
type: AllNLI-dev
metrics:
- type: f1_macro
value: 0.8355168437553738
name: F1 Macro
- type: f1_micro
value: 0.8359363076766546
name: F1 Micro
- type: f1_weighted
value: 0.8361547068271069
name: F1 Weighted
- task:
type: cross-encoder-classification
name: Cross Encoder Classification
dataset:
name: AllNLI test
type: AllNLI-test
metrics:
- type: f1_macro
value: 0.8410958360043347
name: F1 Macro
- type: f1_micro
value: 0.8415242165242165
name: F1 Micro
- type: f1_weighted
value: 0.8417682261741827
name: F1 Weighted
---
# EttinX Cross-Encoder: Natural Language Inference (NLI)
This cross encoder performs sequence classification for contradiction/neutral/entailment labels. This has
drop-in compatibility with comparable sentence transformers cross encoders.
To train this model, I added teacher logits to the all-nli dataset `dleemiller/all-nli-distill` from the
`dleemiller/ModernCE-large-nli` model. This significantly improves performance above standard training.
This 17m architecture is based on ModernBERT and is an excellent candidate for lightweight **CPU inference**.
---
## Features
- **High performing:** Achieves **80.19%** and **86.50%** (Micro F1) on MNLI mismatched and SNLI test.
- **Efficient architecture:** Based on the Ettin-17m encoder design (17M parameters), offering faster inference speeds.
- **Extended context length:** Processes sequences up to 8192 tokens, great for LLM output evals.
---
## Performance
| Model | MNLI Mismatched | SNLI Test | Context Length | # Parameters |
|---------------------------|-------------------|--------------|----------------|----------------|
| `dleemiller/ModernCE-large-nli` | **0.9202** | 0.9110 | 8192 | 395M |
| `dleemiller/ModernCE-base-nli` | 0.9034 | 0.9025 | 8192 | 149M |
| `cross-encoder/deberta-v3-large` | 0.9049 | 0.9220 | 512 | 435M |
| `cross-encoder/deberta-v3-base` | 0.9004 | 0.9234 | 512 | 184M |
| `cross-encoder/nli-distilroberta-base` | 0.8398 | 0.8838 | 512 | 82M |
| `dleemiller/EttinX-nli-sts` | 0.8019 | 0.8650 | 8192 | 17M |
---
## Usage
To use EttinX for NLI tasks, you can load the model with the Hugging Face `sentence-transformers` library:
```python
from sentence_transformers import CrossEncoder
# Load EttinX model
model = CrossEncoder("dleemiller/EttinX-nli-xxs")
scores = model.predict([
('A man is eating pizza', 'A man eats something'),
('A black race car starts up in front of a crowd of people.', 'A man is driving down a lonely road.')
])
# Convert scores to labels
label_mapping = ['contradiction', 'entailment', 'neutral']
labels = [label_mapping[score_max] for score_max in scores.argmax(axis=1)]
# ['entailment', 'contradiction']
```
---
## Training Details
### Pretraining
We initialize the `` weights.
Details:
- Batch size: 512
- Learning rate: 1e-4
- **Attention Dropout:** attention dropout 0.1
### Fine-Tuning
Fine-tuning was performed on the `dleemiller/all-nli-distill` dataset.
### Validation Results
The model achieved the following test set micro f1 performance after fine-tuning:
- **MNLI Unmatched:** 0.8019
- **SNLI:** 0.8650
---
## Model Card
- **Architecture:** Ettin-encoder-17m
- **Fine-Tuning Data:** `dleemiller/all-nli-distill`
---
## Thank You
Thanks to the Johns Hopkins team for providing the ModernBERT models, and the Sentence Transformers team for their leadership in transformer encoder models.
---
## Citation
If you use this model in your research, please cite:
```bibtex
@misc{moderncenli2025,
author = {Miller, D. Lee},
title = {EttinX NLI: An NLI cross encoder model},
year = {2025},
publisher = {Hugging Face Hub},
url = {https://huggingface.co/dleemiller/EttinX-nli-xxs},
}
```
---
## License
This model is licensed under the [MIT License](LICENSE). |