Instructions to use Flaglab/ESNLIR-Baseline with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Scikit-learn
How to use Flaglab/ESNLIR-Baseline with Scikit-learn:
from huggingface_hub import hf_hub_download import joblib model = joblib.load( hf_hub_download("Flaglab/ESNLIR-Baseline", "sklearn_model.joblib") ) # only load pickle files from sources you trust # read more about it here https://skops.readthedocs.io/en/stable/persistence.html - Notebooks
- Google Colab
- Kaggle
Add model card
Browse files
README.md
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-4.0
|
| 3 |
+
language:
|
| 4 |
+
- es
|
| 5 |
+
pipeline_tag: text-classification
|
| 6 |
+
library_name: sklearn
|
| 7 |
+
datasets:
|
| 8 |
+
- Flaglab/ESNLIR-dataset
|
| 9 |
+
metrics:
|
| 10 |
+
- accuracy
|
| 11 |
+
- f1
|
| 12 |
+
tags:
|
| 13 |
+
- nli
|
| 14 |
+
- spanish
|
| 15 |
+
- causal
|
| 16 |
+
- esnlir
|
| 17 |
+
- xgboost
|
| 18 |
+
- baseline
|
| 19 |
+
---
|
| 20 |
+
|
| 21 |
+
# ESNLIR — XGBoost baseline
|
| 22 |
+
|
| 23 |
+
The **non-neural reference point** for ESNLIR: XGBoost over bag-of-words features from both
|
| 24 |
+
sentences. It exists to show how much of the task is solvable without contextual representations —
|
| 25 |
+
the answer is *not much*, which is what makes the BERT results meaningful.
|
| 26 |
+
|
| 27 |
+
> **ESNLIR: Expanding Spanish NLI Benchmarks with Multi-Genre and Causal Annotation**
|
| 28 |
+
> Johan R. Portela, Nicolás Pérez-Terán, Rubén Manrique — Universidad de los Andes, Bogotá
|
| 29 |
+
> *Applied Informatics*, Springer, 2026, pp. 345–361 —
|
| 30 |
+
> [doi:10.1007/978-3-032-07175-0_23](https://doi.org/10.1007/978-3-032-07175-0_23)
|
| 31 |
+
|
| 32 |
+
Part of the [ESNLIR collection](https://huggingface.co/collections/Flaglab/esnlir-6914a3103bb229f3c3f09567).
|
| 33 |
+
|
| 34 |
+
## Results on the ESNLIR test set (80,216 pairs, class-balanced)
|
| 35 |
+
|
| 36 |
+
| accuracy | macro F1 | contrasting | entailment | neutral | reasoning |
|
| 37 |
+
|---|---|---|---|---|---|
|
| 38 |
+
| **0.3501** | **0.3481** | 0.345 | 0.436 | 0.278 | 0.341 |
|
| 39 |
+
|
| 40 |
+
Ten points above the 0.250 majority-class floor, and roughly **half** what the fine-tuned encoders
|
| 41 |
+
reach:
|
| 42 |
+
|
| 43 |
+
| model | accuracy | macro F1 |
|
| 44 |
+
|---|---|---|
|
| 45 |
+
| Majority class | 0.250 | 0.250 |
|
| 46 |
+
| **XGBoost (this model)** | **0.350** | **0.348** |
|
| 47 |
+
| [BERTIN RoBERTa](https://huggingface.co/Flaglab/ESNLIR-RoBERTa) | 0.663 | 0.664 |
|
| 48 |
+
| [XLM-RoBERTa](https://huggingface.co/Flaglab/ESNLIR-XLM-RoBERTa) | 0.676 | 0.676 |
|
| 49 |
+
|
| 50 |
+
Lexical features alone barely move the needle, so the relations in ESNLIR are not recoverable from
|
| 51 |
+
word identity — contextual sentence representations are doing the work.
|
| 52 |
+
|
| 53 |
+
### Stress tests
|
| 54 |
+
|
| 55 |
+
| test | accuracy | macro F1 | contrasting | entailment | neutral | reasoning |
|
| 56 |
+
|---|---|---|---|---|---|---|
|
| 57 |
+
| `test` | 0.3501 | 0.3481 | 0.345 | 0.436 | 0.278 | 0.341 |
|
| 58 |
+
| `test_length_mismatch` | 0.3257 | 0.2945 | 0.204 | 0.307 | 0.111 | 0.681 |
|
| 59 |
+
| `test_negation` | 0.3381 | 0.3287 | 0.401 | 0.266 | 0.200 | 0.486 |
|
| 60 |
+
| `test_overlap` | 0.3409 | 0.3313 | 0.226 | 0.360 | 0.245 | 0.532 |
|
| 61 |
+
| `test_spelling` | 0.3490 | 0.3473 | 0.340 | 0.428 | 0.280 | 0.348 |
|
| 62 |
+
|
| 63 |
+
The perturbations push predictions hard toward `reasoning` (0.341 → 0.681 under length mismatch),
|
| 64 |
+
which is what a bag-of-words model does when tokens are injected: the added words shift the feature
|
| 65 |
+
vector rather than the meaning.
|
| 66 |
+
|
| 67 |
+
## Labels
|
| 68 |
+
|
| 69 |
+
| id | label |
|
| 70 |
+
|---|---|
|
| 71 |
+
| 0 | `contrasting` |
|
| 72 |
+
| 1 | `entailment` |
|
| 73 |
+
| 2 | `neutral` |
|
| 74 |
+
| 3 | `reasoning` |
|
| 75 |
+
|
| 76 |
+
Label order is alphabetical, from `sklearn.preprocessing.LabelEncoder`.
|
| 77 |
+
|
| 78 |
+
## Files
|
| 79 |
+
|
| 80 |
+
`model.pkl` — a pickled scikit-learn/XGBoost estimator. `metrics.zip` — full metrics per split,
|
| 81 |
+
broken down by genre, domain and source corpus.
|
| 82 |
+
|
| 83 |
+
## Usage
|
| 84 |
+
|
| 85 |
+
```python
|
| 86 |
+
import pickle
|
| 87 |
+
from huggingface_hub import hf_hub_download
|
| 88 |
+
|
| 89 |
+
with open(hf_hub_download("Flaglab/ESNLIR-Baseline", "model.pkl"), "rb") as fh:
|
| 90 |
+
model = pickle.load(fh)
|
| 91 |
+
```
|
| 92 |
+
|
| 93 |
+
> Loading a pickle executes arbitrary code — only do this because you trust the source.
|
| 94 |
+
>
|
| 95 |
+
> The vectorizer is **not** included in this repository, so the model cannot be applied to raw text
|
| 96 |
+
> as published. Rebuild the bag-of-words features with
|
| 97 |
+
> [`jd-rodriguezp1234/esnlir`](https://github.com/jd-rodriguezp1234/esnlir)
|
| 98 |
+
> (`auto_nli/model/baseline/dataset.py`), which fits the vectorizer and label encoder on the
|
| 99 |
+
> training split. For inference on new text, prefer
|
| 100 |
+
> [`ESNLIR-XLM-RoBERTa`](https://huggingface.co/Flaglab/ESNLIR-XLM-RoBERTa).
|
| 101 |
+
|
| 102 |
+
## Training
|
| 103 |
+
|
| 104 |
+
| | |
|
| 105 |
+
|---|---|
|
| 106 |
+
| features | bag-of-words over both sentences |
|
| 107 |
+
| data | [`Flaglab/ESNLIR-dataset`](https://huggingface.co/datasets/Flaglab/ESNLIR-dataset) |
|
| 108 |
+
| max samples | 1,000,000 (subsampled from the 4.4M train split) |
|
| 109 |
+
|
| 110 |
+
Trained with `auto_nli/model/baseline/run.py`, config `params/model/baseline.json`.
|
| 111 |
+
|
| 112 |
+
## Citation
|
| 113 |
+
|
| 114 |
+
```bibtex
|
| 115 |
+
@InProceedings{portela2025esnlirspanishmultigenredataset,
|
| 116 |
+
author = {Portela, Johan R. and P{\'e}rez-Ter{\'a}n, Nicol{\'a}s and Manrique, Rub{\'e}n},
|
| 117 |
+
editor = {Florez, Hector and Peluffo-Ordo{\~{n}}ez, Diego},
|
| 118 |
+
title = {{ESNLIR}: Expanding Spanish {NLI} Benchmarks with Multi-genre and Causal Annotation},
|
| 119 |
+
booktitle = {Applied Informatics},
|
| 120 |
+
year = {2026},
|
| 121 |
+
publisher = {Springer Nature Switzerland},
|
| 122 |
+
address = {Cham},
|
| 123 |
+
pages = {345--361},
|
| 124 |
+
isbn = {978-3-032-07175-0},
|
| 125 |
+
doi = {10.1007/978-3-032-07175-0_23},
|
| 126 |
+
}
|
| 127 |
+
```
|