albertmartinez/xlm-roberta-large-sdg-openalex-multilabel-2026-09
091
Xlm Roberta Large Sdg Openalex Multilabel 2026 09
Model description
Multilingual sequence classification model fine-tuned from XLM-RoBERTa-large to predict UN Sustainable Development Goal (SDG) labels (sdg1 … sdg17) from scientific text (OpenAlex-derived corpus).
- Task: multi-label text classification
- Classes: 17 SDG labels (sdg1–sdg17, incl. SDG 17)
- Fine-tuned from:
FacebookAI/xlm-roberta-large - Selection metric: F1 macro (best checkpoint)
Intended uses & limitations
Intended uses
- Tagging research abstracts and publications with one or more SDG labels
- Large-scale bibliometric SDG analytics on OpenAlex-style corpora
- Multilingual SDG pipelines that require SDG 17 (Partnerships)
Out-of-scope uses
- Legal or compliance decisions without human review
- High-stakes allocation of funds based solely on model predictions
- Fine-grained policy classification outside the SDG taxonomy
Limitations
- Trained on sdg-openalex; performance may drop on non-academic or very short text
- Input format:
<TITLE>…</TITLE>and optionally<ABSTRACT>…</ABSTRACT>(same as the datasettextcolumn; ~29% of training samples are title-only) - Strong class imbalance across SDGs; rare goals may underperform
- Dataset majoritàriament single-label per fila (~0.0014% train amb >1 SDG); el model prediu multi-label via sigmoid per classe
- Evaluation used the dataset test split as validation during training
- Threshold 0.5 per defecte a l'exemple d'ús; cal ajustar segons el cas d'ús
Training and evaluation data
Dataset
- Hub: albertmartinez/sdg-openalex
- Config:
v1 - Train split: 1,041,829 examples
- Test split: 260,458 examples (used for evaluation each epoch)
- Input column:
text - Label column:
labels(sdg1…sdg17)
Preprocessing
- Tokenizer: XLM-RoBERTa (
max_seq_length=512) - Pos weights applied to BCEWithLogitsLoss (inverse frequency, normalized)
- Train shuffle: enabled
Training procedure
Framework
Fine-tuning with Hugging Face Transformers Trainer, using the official `run_classification.py` script (project fork with class-weight / pos_weight support).
Training
- Optimizer: AdamW (Trainer default)
- Precision: bf16 on NVIDIA GPU
- Best checkpoint selected by eval F1 macro (
load_best_model_at_end=True) - Early stopping patience: 1 (eval F1 macro)
Training hyperparameters
Training results
Final metrics (best checkpoint)
Eval per epoch
Per-class evaluation
Per-class metrics via confusion matrix no disponibles en multi-label; veure F1 macro global al bloc d'avaluació.
Confusion matrix
Per-class metrics via confusion matrix no disponibles en multi-label; veure F1 macro global al bloc d'avaluació.
Usage
El model s'ha entrenat amb el format del dataset sdg-openalex: <TITLE>…</TITLE><ABSTRACT>…</ABSTRACT>. Si només tens títol, <TITLE>…</TITLE> n'hi ha prou.
from transformers import pipeline
model_id = "albertmartinez/xlm-roberta-large-sdg-openalex-multilabel-2026-09"
def format_input(title: str, abstract: str | None = None) -> str:
"""Format d'entrada del dataset sdg-openalex."""
text = "<TITLE>" + title.strip() + "</TITLE>"
if abstract and abstract.strip():
text += "<ABSTRACT>" + abstract.strip() + "</ABSTRACT>"
return text
classifier = pipeline(
"text-classification",
model=model_id,
top_k=None, # totes les etiquetes (multi-label, sigmoid automàtic)
)
text = format_input(
"Partnerships for sustainable development goals and international cooperation.",
"This study examines cross-sector collaboration for SDG implementation.",
)
results = classifier(text)[0]
threshold = 0.5
for item in results:
if item["score"] >= threshold:
print(item["label"], item["score"])