πŸ›‘οΈ rakshak-severity-v2

Severity classifier for Nepali social media content, fine-tuned from XLM-RoBERTa Large using LoRA/PEFT. Part of the RakshakAI content moderation system.

πŸ“„ Paper: RakshakAI: Multi-Label Toxicity Detection for Low-Resource Nepali Social Media Content

What it does

Given a piece of Nepali text along with detected toxicity labels from rakshak-xlmr-large-v2, this model predicts one of three severity classes:

Class Original Score Meaning
normal 1–2 Clean or mildly offensive
moderate 3 Clearly harmful
severe 4–5 Incites action or extreme violence

How it differs from a standard classifier

Rather than predicting severity from text alone, the input is enriched by appending detected toxicity labels from the multi-label classifier to the original text β€” for example: yo jaat ko manchhe haru lai nepal bata nikala [DETECTED: hate_speech, casteism]

This allows the model to leverage category information when estimating severity, making predictions more accurate and context-aware.

Performance

Class Precision Recall F1
Normal (1–2) 0.94 0.87 0.90
Moderate (3) 0.25 0.27 0.26
Severe (4–5) 0.86 0.91 0.88

The model performs strongly on normal and severe classes but struggles with moderate severity due to class imbalance β€” only 9.3% of training samples carry a moderate label. This is a known limitation we plan to address with more data collection.

How to use

from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch

model_id = "biraj-bhusal/rakshak-severity-v2"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForSequenceClassification.from_pretrained(model_id)

id2label = {0: "normal", 1: "moderate", 2: "severe"}

# Append detected labels from rakshak-xlmr-large-v2 to the text
text = "your nepali text here [DETECTED: hate_speech, casteism]"
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=128)

with torch.no_grad():
    logits = model(**inputs).logits
    prediction = torch.argmax(logits, dim=-1).item()

print(id2label[prediction])

Training Details

  • Base model: xlm-roberta-large
  • Fine-tuning method: LoRA (PEFT) β€” rank r=16, Ξ±=32, dropout=0.1
  • Training data: 4,716 augmented samples
  • Loss: Class-weighted cross-entropy to address class imbalance
  • Precision: fp16 mixed precision
  • Hardware: Dual NVIDIA T4 GPUs on Kaggle

Training Data

Limitations

  • Moderate severity class performs poorly (F1=0.26) due to underrepresentation in training data
  • Depends on output from rakshak-xlmr-large-v2 for best results
  • Single annotator labeling may introduce individual bias
  • May not generalize well to content outside Facebook and YouTube domains

Related Models

Citation

@misc{bhusal2025rakshak,
  author = {Bhusal, Biraj},
  title = {RakshakAI: Multi-Label Toxicity Detection for Low-Resource Nepali Social Media Content},
  year = {2025},
  publisher = {Zenodo},
  url = {https://zenodo.org/records/20850923}
}

Content Warning

This model is trained on toxic social media content. The author does not endorse any views expressed in the training data.

Developed by: Biraj Bhusal

Downloads last month
21
Safetensors
Model size
0.6B params
Tensor type
F32
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Space using biraj-bhusal/rakshak-severity-v2 1