glance-roberta-v4
Architettura GLANCE: encoder addestrato con statement tuning multi-domanda (template di statement-tuning, adattati alla forma stato/statement): dato un testo (lo stato) e uno o piu' statement, restituisce la probabilita' che ogni statement sia vero.
Gli statement condividono lo stato nella stessa sequenza, ma una maschera di attenzione bidirezionale a blocchi li rende indipendenti: il punteggio di uno statement e' identico a quello che si otterrebbe valutandolo da solo.
Uso
Basta transformers: il codice del modello e' incluso nel repository (trust_remote_code=True).
from transformers import AutoModel
model = AutoModel.from_pretrained("stefra/glance-roberta-v4", trust_remote_code=True)
model.predict("The vase is broken.", ["The vase is intact.", "It is sad."]) # un array, uno per domanda
model.predict([("The vase is broken.", ["It is sad."]), # batch di (stato, domande):
("I love it.", ["It is positive.", "It is sad."])]) # una lista di array, uno per stato
Non e' un modello generativo: predict restituisce la probabilita' che ogni statement sia vero. Su GPU il modello
viene caricato in float16; si puo' scegliere con device= e dtype=.
Contenuto
| File | Contenuto |
|---|---|
modeling_glance.py |
codice dell'architettura GLANCE, usato da AutoModel |
config.json |
configurazione per AutoModel |
backbone/ |
encoder fine-tuned (formato transformers) |
head.safetensors |
testa vero/falso |
statement_encoder.json |
pooling e configurazione del packing usata in training |
tokenizer* |
tokenizer |
eval_report.json |
metriche finali per sorgente |
training_config.json |
iperparametri del training e dei dati |
training_history.json |
metriche a ogni valutazione durante il training |
training_curves.png |
grafico dell'andamento del training |
Iperparametri
| parametro | valore |
|---|---|
| backbone | FacebookAI/roberta-large |
| learning rate del backbone | 2e-05 |
| learning rate della testa (0 = come il backbone) | 0.0001 |
| epoche (massimo) | 2 |
| pack per GPU | 4 |
| accumulo del gradiente | 4 |
| GPU | 2 |
| batch effettivo (pack) | 32 |
| warmup (frazione degli step) | 0.1 |
| weight decay | 0.01 |
| valutazione ogni (step) | 300 |
| early stopping (valutazioni senza miglioramenti) | 5 |
| metrica per scegliere il checkpoint | heldout_roc_auc |
| pooling | cls |
| dropout della testa | 0.1 |
| token massimi dello stato | 384 |
| token massimi di uno statement | 96 |
| statement per pack | 8 |
| token per pack | 1024 |
| precisione | auto |
| seed | 12345 |
| stati per sorgente | 1700 |
| stati held-out per sorgente | 2000 |
| statement per stato | 6 |
| quota di riferimenti generici ("the text") | 0.5 |
| quota di template in stile statement-tuning | 0.3 |
| template per classe | 3 |
| stati di training | 47284 |
| statement di training | 249704 |
| pack di training | 47284 |
| stati di validazione | 2488 |
| stati held-out | 5066 |
Sorgenti di training (30): absa, ade, amazon_reviews, app_reviews, banking77, complaints, dbpedia, dpr, entity_matching, fewnerd, massive, mintaka, mnli, paws, piqa, product_catalog, qasc, qqp, race, samsum, sciq, snli, squad, tweet_irony, tweet_offensive, tweet_sentiment, tweet_stance, winogrande, yahoo_answers, yelp_polarity
Sorgenti held-out (3): ag_news, emotion, rotten_tomatoes
Andamento del training
| step | epoca | train loss | val loss | val F1 | val ROC-AUC | val ECE | held-out loss | held-out F1 | held-out ROC-AUC | held-out ECE |
|---|---|---|---|---|---|---|---|---|---|---|
| 300 | 0.20 | 0.689 | 0.634 | 0.671 | 0.691 | 0.060 | 0.644 | 0.650 | 0.748 | 0.126 |
| 600 | 0.41 | 0.519 | 0.449 | 0.788 | 0.875 | 0.053 | 0.512 | 0.771 | 0.847 | 0.069 |
| 900 | 0.61 | 0.408 | 0.385 | 0.813 | 0.909 | 0.022 | 0.521 | 0.770 | 0.856 | 0.075 |
| 1200 | 0.81 | 0.379 | 0.365 | 0.827 | 0.920 | 0.025 | 0.501 | 0.784 | 0.869 | 0.077 |
| 1500 | 1.01 | 0.351 | 0.348 | 0.840 | 0.932 | 0.029 | 0.548 | 0.778 | 0.862 | 0.084 |
| 1800 | 1.22 | 0.295 | 0.332 | 0.849 | 0.940 | 0.046 | 0.558 | 0.769 | 0.867 | 0.114 |
| 2100 | 1.42 | 0.283 | 0.332 | 0.861 | 0.943 | 0.043 | 0.565 | 0.780 | 0.870 | 0.110 |
| 2400 | 1.62 | 0.274 | 0.337 | 0.857 | 0.946 | 0.060 | 0.579 | 0.785 | 0.879 | 0.125 |
| 2700 | 1.83 | 0.263 | 0.315 | 0.864 | 0.948 | 0.039 | 0.535 | 0.787 | 0.876 | 0.100 |
| 2956 | 2.00 | 0.255 | 0.314 | 0.864 | 0.948 | 0.040 | 0.542 | 0.786 | 0.876 | 0.104 |
I pesi pubblicati sono quelli dello step 2400.
Metriche finali (modello pubblicato)
Validazione (sorgenti di training)
| sorgente | n | accuracy | F1 | ROC-AUC | Brier | ECE |
|---|---|---|---|---|---|---|
| absa | 507 | 0.939 | 0.939 | 0.983 | 0.053 | 0.049 |
| ade | 481 | 0.917 | 0.917 | 0.971 | 0.074 | 0.063 |
| amazon_reviews | 488 | 0.891 | 0.884 | 0.957 | 0.087 | 0.070 |
| app_reviews | 497 | 0.797 | 0.789 | 0.879 | 0.150 | 0.103 |
| banking77 | 510 | 0.927 | 0.928 | 0.974 | 0.057 | 0.036 |
| complaints | 510 | 0.949 | 0.948 | 0.991 | 0.042 | 0.039 |
| dbpedia | 510 | 0.994 | 0.994 | 0.999 | 0.006 | 0.004 |
| dpr | 396 | 0.869 | 0.869 | 0.918 | 0.107 | 0.084 |
| entity_matching | 342 | 0.889 | 0.889 | 0.965 | 0.089 | 0.079 |
| fewnerd | 510 | 0.925 | 0.925 | 0.974 | 0.060 | 0.045 |
| massive | 510 | 0.939 | 0.940 | 0.981 | 0.051 | 0.039 |
| mintaka | 126 | 0.897 | 0.857 | 0.957 | 0.074 | 0.065 |
| mnli | 510 | 0.869 | 0.871 | 0.925 | 0.107 | 0.050 |
| paws | 256 | 0.758 | 0.754 | 0.850 | 0.168 | 0.112 |
| piqa | 340 | 0.526 | 0.519 | 0.524 | 0.267 | 0.090 |
| product_catalog | 507 | 0.842 | 0.843 | 0.926 | 0.117 | 0.079 |
| qasc | 255 | 0.949 | 0.919 | 0.985 | 0.042 | 0.034 |
| qqp | 279 | 0.885 | 0.843 | 0.966 | 0.076 | 0.037 |
| race | 431 | 0.675 | 0.598 | 0.762 | 0.220 | 0.144 |
| samsum | 470 | 1.000 | 1.000 | 1.000 | 0.000 | 0.000 |
| sciq | 255 | 0.902 | 0.857 | 0.976 | 0.067 | 0.047 |
| snli | 510 | 0.892 | 0.894 | 0.950 | 0.085 | 0.055 |
| squad | 502 | 0.896 | 0.903 | 0.958 | 0.083 | 0.074 |
| tweet_irony | 453 | 0.587 | 0.507 | 0.670 | 0.231 | 0.124 |
| tweet_offensive | 510 | 0.786 | 0.786 | 0.854 | 0.165 | 0.101 |
| tweet_sentiment | 510 | 0.792 | 0.784 | 0.891 | 0.144 | 0.086 |
| tweet_stance | 435 | 0.857 | 0.841 | 0.934 | 0.110 | 0.073 |
| winogrande | 510 | 0.792 | 0.795 | 0.865 | 0.160 | 0.111 |
| yahoo_answers | 510 | 0.876 | 0.871 | 0.956 | 0.095 | 0.073 |
| yelp_polarity | 510 | 0.965 | 0.965 | 0.995 | 0.032 | 0.030 |
| ALL | 13140 | 0.863 | 0.857 | 0.946 | 0.099 | 0.060 |
Held-out (task mai visti in training)
| sorgente | n | accuracy | F1 | ROC-AUC | Brier | ECE |
|---|---|---|---|---|---|---|
| ag_news | 12000 | 0.832 | 0.826 | 0.919 | 0.135 | 0.109 |
| emotion | 12000 | 0.739 | 0.713 | 0.814 | 0.207 | 0.163 |
| rotten_tomatoes | 6396 | 0.835 | 0.834 | 0.911 | 0.130 | 0.091 |
| ALL | 30396 | 0.796 | 0.785 | 0.879 | 0.162 | 0.125 |
- Downloads last month
- -
Model tree for stefra/glance-roberta-v4
Base model
FacebookAI/roberta-large