Aakash1005/sdg-classifier
sdg-classifier
A 16-class text classifier that assigns a passage to one UN Sustainable Development Goal. Fine-tuned from distilbert-base-uncased on the OSDG Community Dataset.
Built primarily as an investigation into the benchmark itself. Read the limitations section before using the per-class scores to compare against other models — one class in this dataset is separable by writing style rather than topic, which inflates aggregate metrics.
Intended use
- First-pass SDG tagging of policy text, dataset descriptions, and report excerpts, for human review
- A reproducible baseline for OSDG-CD experiments
Out of scope
- Any use where the output is acted on without review
- SDG 17 (Partnerships), which is absent from the training data
- Detecting that a text is not SDG-related — there is no negative class, so the model will assign a goal to any input, including unrelated text
- Short inputs. Training excerpts average ~100 words; performance on titles or single phrases is untested
Results
Test set: 8,605 held-out examples. Training set filtered to agreement ≥ 0.5.
Per-class (6 epochs):
Limitations
SDG 16's score is partly an artefact. At 0.984 F1 it is far above every other class, on arguably the framework's most abstract goal. A TF-IDF + logistic regression model trained on only the first eight words of each excerpt reaches 0.739 F1 on SDG 16 against a macro average of 0.327 — eight words carry no topical content, so the class is identifiable from stylistic register alone. Sampled SDG 16 excerpts are overwhelmingly academic law and political-science abstracts ("This article provides a theoretically informed analysis…"). The signal is distributed through the text, not confined to the opening: removing the lead sentence cost SDG 16 only 0.016 F1 while costing other classes 0.05–0.10.
SDG 16 is 12.3% of the test set, so this inflates the aggregate numbers above. Per-class scores on this benchmark are not comparable across goals.
SDG 8 is unreliable. Precision 0.399 — when this model predicts SDG 8, it is wrong roughly 6 times in 10. SDG 1, 8, and 10 form a confusion cluster (1→10 at 0.16, 8→10 at 0.12, 10→8 at 0.11) reflecting genuine conceptual overlap between poverty, decent work, and inequality. Treat SDG 8 predictions as low confidence.
Single-label on a multi-label problem. Real passages often address several goals at once. This model returns one.
No confidence intervals. Single seed, single run.
Training
Usage
from transformers import pipeline
clf = pipeline("text-classification", model="USERNAME/sdg-classifier")
clf("Rural households gained access to piped drinking water and sanitation.")
# [{'label': 'SDG 6', 'score': 0.59}]Citation
Dataset: OSDG, UNDP IICPSD SDG AI Lab, & PPMI. OSDG Community Dataset (OSDG-CD). Zenodo. https://doi.org/10.5281/zenodo.5550238 (CC BY 4.0)
