Downloads · 30 days
11
24% of all-time downloads
disi-unibo-nlp/foodex-facet-descriptors-reranker
foodex-facet-descriptors-reranker is a text classification model from disi-unibo-nlp. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as apache-2.0.
This is a CrossEncoder reranker model fine-tuned from distilroberta-base for the FoodEx2 domain. It is specifically optimized for re-ranking attribute-related candidate sentences based on relevance and precision for f…
Downloads · 30 days
11
24% of all-time downloads
All-time downloads
45
Public
Parameters
82.1M
328 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors328 MB · 99%
From the Hugging Face model README
This is a CrossEncoder reranker model fine-tuned from distilroberta-base for the FoodEx2 domain. It is specifically optimized for re-ranking attribute-related candidate sentences based on relevance and precision for food description and classification tasks. The model was trained on the disi-unibo-nlp/foodex2-clean dataset, with additional negative examples from the disi-unibo-nlp/foodex2-terms dataset.
This model employs a CrossEncoder architecture to compute similarity scores between candidate sentence pairs, enabling accurate differentiation among subtle variations in food-related attributes and terminologies.
The model was trained using a custom training script with the following parameters:
disi-unibo-nlp/foodex2-clean (positives), disi-unibo-nlp/foodex2-terms (negatives)Training was performed in a GPU-accelerated environment for improved efficiency and reproducibility.
The model was evaluated on the FoodEx2 attribute task test set using standard retrieval and ranking metrics:
| Metric | Value |
|---|---|
| Accuracy@1 | 0.9603 |
| Accuracy@3 | 0.9958 |
| Accuracy@5 | 1.0000 |
| Accuracy@10 | 1.0000 |
| Precision@1 | 0.9603 |
| Recall@1 | 0.8472 |
| Precision@3 | 0.4167 |
| Recall@3 | 0.9859 |
| Precision@5 | 0.2971 |
| Recall@5 | 0.9974 |
| Precision@10 | 0.2583 |
| Recall@10 | 0.9996 |
| MRR@10 | 0.9781 |
| NDCG@10 | 0.9817 |
| MAP@100 | 0.9736 |
| Avg Seconds per Example | 0.00139 |
Additionally, the model achieved a binary classification score of 0.9861, with the optimal threshold identified at 0.5454, yielding an F1 score of 0.3328.
To use the attribute-reranker model, follow these steps:
Install Dependencies:
pip install transformers torch
Load the Model:
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
tokenizer = AutoTokenizer.from_pretrained("your-username/attribute-reranker")
model = AutoModelForSequenceClassification.from_pretrained("your-username/attribute-reranker")
sentence_pair = ["Candidate attribute description", "Food product or context sentence"]
inputs = tokenizer(sentence_pair, return_tensors="pt", padding=True, truncation=True, max_length=256)
with torch.no_grad():
outputs = model(**inputs)
scores = outputs.logits
print(scores)
If you use this model in your research, please cite the following work:
@article{sanh2019distilbert,
title={DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lighter},
author={Sanh, Victor and Debut, Lysandre and Chaumond, Julien and Wolf, Thomas},
journal={arXiv preprint arXiv:1910.01108},
year={2019}
}