CoolFace
Modelpublic

albertmartinez/xlm-roberta-large-sdg-openalex-multilabel-2026-09

sourceHugging Facemitupdated 23d agoView on Hugging Face
0likes91downloads
Model Card

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 dataset text column; ~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

ParameterValue
Base modelFacebookAI/xlm-roberta-large
Epochs (max)3.0
Batch size / device (train)32
Batch size / device (eval)32
Gradient accumulation2
Learning rate2e-05
Weight decay0.01
Warmup ratio0.1
Max sequence length512
Seed42
BF16True
TF32True
LossBCEWithLogitsLoss + pos_weight
MetricF1 macro

Training results

Final metrics (best checkpoint)

MetricValue
Eval F1 macro0.9453
Eval loss0.0009
Train loss0.0048
Train runtime6h 47m 6s
Train samples/sec127.957

Eval per epoch

EpochEval F1 macroEval loss
10.87970.0014
20.90690.0012
30.94530.0009

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.

python
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"])

Framework versions

PackageVersion
transformers4.57.6
torch2.6.0+cu124
datasets5.0.1
accelerate1.14.0
tokenizers0.22.2