Instructions to use biraj-bhusal/rakshak-severity-v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use biraj-bhusal/rakshak-severity-v2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="biraj-bhusal/rakshak-severity-v2")# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("biraj-bhusal/rakshak-severity-v2") model = AutoModelForSequenceClassification.from_pretrained("biraj-bhusal/rakshak-severity-v2", device_map="auto") - PEFT
How to use biraj-bhusal/rakshak-severity-v2 with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
π‘οΈ 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
- rakshak-xlmr-large-v2 β multi-label toxicity classifier whose output feeds into this model
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