BanglaHateNet

A Dual-Encoder Fusion Framework for Multi-Task Hate Speech Detection in Bangla

Submitted By

Sheikh Mohammad Rajking — C221011
Avishek Das — C221025
Alfaz Mahmud Rizve — C221004

Supervised By

Prof. Dr. Md. Monirul Islam
Professor, Dept. of CSE
International Islamic University Chittagong

IIUC · Department of Computer Science & Engineering
Presentation Map

Outline

  1. Background & Motivation — why Bangla hate speech is hard
  2. Research Problem — the gaps we target
  3. Objectives & Contributions
  4. Research Gap from literature
  5. Proposed Framework — BanglaHateNet
  6. Dual-Encoder Representation
  7. OCR-Assisted Inference
  8. Probability-Level Late Fusion
  1. Fusion Weight Optimization
  2. Multi-Task Heads & Training Objective
  3. Dataset Construction — 186,206 samples
  4. Dataset Statistics & Data Split
  5. Experimental Setup
  6. Results — baseline, fused, per-class & ablation
  7. Comparison with State-of-the-Art
  8. Limitations, Future Work & Conclusion
BanglaHateNet
1 / 23
Chapter 1 · Introduction

Background & Motivation

Automated hate-speech moderation in a low-resource language
  • Social media growth has driven an exponential rise in hate speech and harmful content online.
  • English-language moderation is mature — Bangla remains under-served despite ~300M speakers.
  • Bangla text is uniquely difficult: informal orthography, regional dialects, heavy slang, and code-mixing with English.
  • Romanized Bangla ("Banglish") is pervasive on social platforms.
  • Hate content increasingly hides inside images and memes, invisible to text-only models.

Why this matters

Most existing Bangla systems reduce hate speech to a single binary decision — hate vs. non-hate. Real moderation needs to know the type, target, and severity of the content to act appropriately. This gap motivates a fine-grained, multi-task approach.

Low-resource NLP Code-mixed text Fine-grained moderation
BanglaHateNet
2 / 23
Chapter 1.2

Research Problem

  • Scarce annotated data — limited labeled Bangla corpora restrict generalization.
  • Single-task framing — most models only do binary classification, missing type/target/severity.
  • No effective code-mixed handling — multilingual inputs are common but poorly modeled.
  • Single-encoder limitation — one encoder cannot capture both multilingual and Indic-specific cues.
  • Class imbalance & ambiguity — degrades fine-grained predictions.
  • No image support — text-only pipelines miss hate speech embedded in memes/screenshots.

→ Motivated by these gaps, we propose an OCR-assisted, dual-encoder, multi-task learning framework capable of handling multilingual, code-mixed, and image-based textual hate speech in real social-media conditions.

BanglaHateNet
3 / 23
Chapter 1.3

Research Objectives

  1. Build a multi-task learning model for simultaneous binary, hate-type, target, and severity classification.
  2. Leverage complementary multilingual representations via two parallel transformer encoders — XLM-RoBERTa and MuRIL.
  3. Efficiently manage code-mixed and noisy Bangla social-media text.
  4. Incorporate a late-stage probability-level fusion mechanism combining both encoders.
  5. Extend the model with an OCR-assisted inference unit for image-based hate speech.
  6. Empirically evaluate the model with standard metrics, primarily weighted / macro F1.
BanglaHateNet
4 / 23
Chapter 1.4

Key Contributions

Dataset

A merged, hand-annotated corpus of 186,206 samples from 9 public Bangla sources, unified under one multitask label schema.

Methodology

BanglaHateNet: a dual-encoder MTL framework fusing XLM-RoBERTa & MuRIL via validation-optimized late fusion.

OCR-Assisted Inference

EasyOCR + Tesseract fallback pipeline enabling image-based hate-speech detection with zero retraining.

Performance

Fused model reaches 0.7447 weighted F1 / 0.7396 accuracy across all four tasks on a 27,932-sample test set.

BanglaHateNet
5 / 23
Chapter 2.7 · Literature Review

Research Gap

What existing Bangla hate-speech literature still misses
  1. Most work formulates hate speech as binary classification; practical moderation needs type + target + severity together.
  2. BLP-2025 introduced multitask models, but none pair XLM-RoBERTa with MuRIL as complementary dual encoders.
  3. Existing ensembles use fixed / heuristic fusion weights — validation-guided weight optimization is unexplored.
  4. Severe class imbalance persists for minority categories (e.g. sexism, religious hate, dialectal toxicity).
  5. Systems are built for plain text only — OCR-assisted extraction has not been integrated with dual-encoder MTL frameworks.
BanglaHateNet
6 / 23
Chapter 3.1 · Methodology

Proposed Framework Overview

The problem is formulated as a joint multi-task classification over 4 interdependent subtasks:

Task Description Classes
Binary Hate vs. Non-hate 2
Hate Type Category of hate speech 5
Target Target entity / group 5
Severity Intensity of hate 4
  • Multitask learning — shared semantics across tasks
  • Dual-encoder representation — XLM-R + MuRIL
  • Late fusion at the probability level
  • OCR-assisted input acquisition for images
End-to-End Workflow
Bangla / Code-mixed Text
or Image Input
XLM-RoBERTa
Encoder
MuRIL
Encoder
↓   ↓
4× Task Heads (each encoder)
Probability-Level Late Fusion (w = 0.5)
Final Predictions — Binary · Type · Target · Severity
BanglaHateNet
7 / 23
Chapter 3.2

Dual-Encoder Text Representation

Component XLM-RoBERTa MuRIL
Layers 12 12
Hidden Dim 768 768
Pretraining Data Multilingual corpora Indic language corpora
Coverage Multilingual Indic (incl. Bengali)
Fine-tuning Fully fine-tuned Fully fine-tuned

h_cls = Encoder(x)[CLS]  →  h̃ = Dropout(h_cls)

  • XLM-RoBERTa captures cross-lingual patterns and multilingual semantics.
  • MuRIL learns Indic-specific lexical and structural cues in Bengali.
  • No shared parameters or embeddings — fully independent representation learning.
  • Independence promotes representation diversity and avoids correlated errors.
  • Max sequence length: 128 tokens, separate tokenizers per encoder (SentencePiece / Indic-specific).
BanglaHateNet
8 / 23
Chapter 3.1.4 & 6.5

OCR-Assisted Inference

Detecting hate speech embedded in images — no retraining required
Image Input
(meme/screenshot)
EasyOCR
(primary)
↓ confidence < 0.60?
Tesseract OCR
(fallback)
Text Normalization
& Cleaning
BanglaHateNet (Dual-Encoder + MTL)
XLM-RoBERTa
Encoder
MuRIL
Encoder
Late
Fusion
(Probability
Level)
Multi-task Predictions
1. Binary
(Hate / Non-Hate)
2. Hate Type
(5 classes)
3. Target
(5 classes)
4. Severity
(4 levels)

Demonstration example: text extracted at OCR confidence 0.599, normalized, then classified —

Task Prediction Prob.
Binary Hate 0.998
Hate Type Personal 0.967
Target Gender 0.645
Severity Low 0.954

Classifier architecture is unchanged — OCR is purely a preprocessing step.

BanglaHateNet
9 / 23
Chapter 3.3

Probability-Level Late Fusion

Pfinal = w · Pxlmr + (1 − w) · Pmuril

w ∈ [0, 1] — contribution weight of XLM-RoBERTa

  • Applied after softmax — not feature concatenation or gated fusion.
  • Each encoder trained fully independently in Stage 1.
  • Fusion weight optimized in Stage 2 via validation-set grid search.

Why late fusion?

  • Preserves each encoder's independently learned strengths.
  • Reduces model-specific bias in the final decision.
  • Improves generalization vs. any single encoder.
  • Interpretable — decomposable into per-encoder contributions.
  • Robust — errors are less likely to be correlated between encoders.
BanglaHateNet
10 / 23
Chapter 3.3.2 · Table 3.3

Fusion Weight Optimization

Grid search over w ∈ {0.1 … 0.9} on the validation set
.7386
0.1
.7407
0.2
.7424
0.3
.7437
0.4
.7452
0.5
.7432
0.6
.7396
0.7
.7327
0.8
.7259
0.9

wxlmr (x-axis) → Average Weighted F1 on validation set

Optimal configuration: wxlmr = 0.5, wmuril = 0.5 — both encoders contribute equally, confirming complementary, roughly symmetric information.

BanglaHateNet
11 / 23
Chapter 3.4 – 3.5

Multi-Task Heads & Training Objective

Task Classes λ Weight
Binary 2 1.5
Hate Type 5 1.0
Target 5 1.0
Severity 4 1.0

L_total = λ_bin·L_bin + λ_type·L_type
     + λ_target·L_target + λ_sev·L_sev

  • Each head: CLS representation → Dropout → Linear → task logits.
  • Heads are independent — each task learns its own decision boundary.
  • Inverse-frequency class weighting combats imbalance in every task.
  • Masked conditional loss: auxiliary labels (type / target / severity) are masked out for non-hate samples so they don't pollute training.
  • Binary task weighted 1.5× higher — prioritizing correct hate detection.
BanglaHateNet
12 / 23
Chapter 4.1 – 4.2 · Table 4.1

Dataset Construction — Sources

Dataset Task Type Approx. Size Source
Bangla Hate Speech Binary Public
BOISHOMMO (v1, v2, v3) Multi-label Public
BLP-2025 Hate Speech Multitask Shared Task
BanHate Binary Public
BanTH Multi-class Public
BIDWESH Hate Detection Public (dialectal)
BengaliSent140 Sentiment 139,792 Public
Multi-labeled Toxic Comments Multi-label Public
Bengali Hate Dataset (v1, v2) Binary Public

9 heterogeneous sources merged → unified annotation scheme → normalized, deduplicated, class-balanced corpus.

BanglaHateNet
13 / 23
Chapter 4.7

Dataset Statistics

186,206
Total Samples
50.2 / 49.8
Non-hate / Hate %
14.6
Avg. Words / Sample
9
Source Datasets Merged

Hate Type (Hate Samples)

Personal 36.7% · Abusive 27.7% · Gender 19.4% · Others 16.2%

Target (Hate Samples)

Individual 37.6% · Gender 29.0% · Group 23.9% · Others 9.7%

Severity (Hate Samples)

Low 61.2% · Medium 21.8% · High 17.0% — Low is 3.6× High

BanglaHateNet
14 / 23
Chapter 4.8 – 4.10 · 5.2

Data Split & Quality Assurance

Split % Samples
Training 75% 139,654
Validation 10% 18,620
Test 15% 27,932

Stratified sampling on the binary label; seed = 42.

  • Unicode / encoding normalization — NFKC, UTF-8 standardization.
  • Removal of very short (<3 word) and noisy samples.
  • Exact + near-duplicate detection to prevent cross-split leakage.
  • Splitting performed after cleaning — no semantically similar samples across splits.
  • Unified annotation scheme reconciles differing label definitions across 9 sources.
BanglaHateNet
15 / 23
Chapter 5 · Table 5.1

Experimental Setup

Parameter Value
Backbones xlm-roberta-base, google/muril-base
Batch Size 32
Epochs 10
Max Sequence Length 128 tokens
Optimizer AdamW
Learning Rate 2 × 10⁻⁵
Weight Decay 0.01
Dropout 0.10
Warmup Ratio 0.10 (linear)
Gradient Clipping Max norm 1.0

Checkpointing

Best checkpoint saved per encoder at peak validation-averaged F1 (4 tasks). Early stopping on validation loss, patience = 3 epochs.

Hardware / Software

CUDA-enabled GPU (≥12GB recommended), PyTorch + HuggingFace Transformers 4.40.0, mixed-precision training (torch.cuda.amp).

BanglaHateNet
16 / 23
Chapter 6.1 · Table 6.1

Baseline Performance — Individual Encoders

Weighted F1 on the held-out test set (27,932 samples)
Model Binary Hate Type Target Severity Avg F1 Avg Acc
XLM-RoBERTa 0.8368 0.6658 0.6748 0.7015 0.7190 0.7113
MuRIL 0.8393 0.6921 0.6977 0.7172 0.7367 0.7276

MuRIL outperforms XLM-RoBERTa on all four tasks — biggest gap on Hate Type (0.6921 vs 0.6658), suggesting Indic-specific pretraining captures Bangla lexical/semantic nuance better. On Binary detection the two are close (0.8393 vs 0.8368).

BanglaHateNet
17 / 23
Chapter 6.2 · Table 6.2

Fused BanglaHateNet — Full Results

Task Classes Weighted F1 Macro F1 Accuracy
Binary 2 0.8479 0.8479 0.8480
Hate Type 5 0.6988 0.6066 0.6026
Target 5 0.7050 0.6962 0.7397
Severity 4 0.7271 0.6078 0.7191
0.7447
Average Weighted F1
0.7396
Average Accuracy
0.8479
Best Task: Binary Detection
BanglaHateNet
18 / 23
Chapter 6.2.1 – 6.2.4

Per-Class & Confusion Matrix Insights

Binary

Recall balanced: Not-Hate 0.86, Hate 0.84. False-negative rate (14%) low enough for real moderation use.

Hate Type

Best: Not-Hate (0.81). Worst: Abusive (0.48) — frequently confused with Personal (0.11) & Others (0.16) due to conceptual overlap.

Target

Best: Gender (0.72). Individual lowest (0.52) — mostly confused with Gender & Group targets.

Severity

Clear inverse correlation with class frequency: Low 0.68, Medium 0.56, High only 0.42 — 47% of High instances misclassified as Low/Medium.

BanglaHateNet
19 / 23
Chapter 6.3 · Table 6.3

Comparison with State-of-the-Art

System Model Binary
Weighted F1
Type
Weighted F1
Target
Weighted F1
Severity
Weighted F1
Ishmam & Shamim (2019) GRU + Word2Vec 0.701
Das et al. (2022) XLM-RoBERTa 0.810
Bahash-AI (2025) BanglaBERT+Augment 0.703 0.695 0.699
Retriv (2025) Soft-Voting MTL 0.728 0.727
BEKTE (2025) BanglaBERT+mBERT+XLM-R 0.734 0.731 0.735
BanglaHateNet (Ours) XLM-R + MuRIL Fusion 0.848 0.699 0.705 0.727

Best-in-class on binary detection; competitive on fine-grained tasks — without relying on a Bangla-specific pretrained backbone like BanglaBERT.

BanglaHateNet
20 / 23
Chapter 6.4 · Table 6.4

Ablation Study — Individual vs. Fused

Model Binary Hate Type Target Severity Avg F1
XLM-RoBERTa 0.8368 0.6658 0.6748 0.7015 0.7190
MuRIL 0.8393 0.6921 0.6977 0.7172 0.7367
Fused (w = 0.5) 0.8479 0.6988 0.7050 0.7271 0.7447

Binary

+0.0086 over MuRIL

Hate Type

+0.0067 — smallest gain

Target

+0.0073 over MuRIL

Severity

+0.0099 — largest gain

Late fusion improves every task over either encoder alone, confirming the encoders capture genuinely complementary signal.

BanglaHateNet
21 / 23
Chapter 7.3 & 8.2

Limitations & Future Work

Limitations

  • No BanglaBERT encoder included — a third encoder could aid fine-grained tasks.
  • Class imbalance still hurts minority classes (High severity, Abusive type).
  • Not systematically evaluated on regional dialects (Chattogram, Noakhali, Barishal).
  • Cross-lingual robustness on unseen Bangla-English/Hindi code-mixed data untested.
  • OCR accuracy depends on image quality; no true multimodal (image+text) fusion yet.

Future Work

  • Multimodal fusion of visual + OCR-extracted textual features.
  • Focal loss / synthetic augmentation for minority-class imbalance.
  • Dialectal & code-mixed corpus expansion and fine-tuning.
  • Explainability via Integrated Gradients / Layer-wise Relevance Propagation.
BanglaHateNet
22 / 23

Thank You

Questions & Discussion

C221011
Sheikh Mohammad Rajking
C221025
Avishek Das
C221004
Alfaz Mahmud Rizve

Supervised by Prof. Dr. Md. Monirul Islam, Professor, Dept. of CSE, IIUC
Department of Computer Science & Engineering  ·  IIUC, Chittagong  ·  2025