Hari-Krishnan-N/Caste-Migration-Hate-Speech

Advanced hate speech detection in Tamil-English code-mixed social media content using hybrid deep learning architectures.

Jupyter Notebook

0

1 commits

updated Jul 30, 2025

See the code

README

๐Ÿ† Wise@LT-EDI 2025: Multi-scale Ensemble Learning for Tamil-English Code-Mixed Hate Speech Detection

Python PyTorch Transformers scikit-learn

XGBoost LightGBM CatBoost NLTK

LT-EDI 2025 F1 Score Task Language

๐ŸŽฏ Advanced hate speech detection in Tamil-English code-mixed social media content using hybrid deep learning architectures

๐Ÿ“‹ Table of Contents


๐ŸŽฏ Overview

This repository contains our award-winning submission to the LT-EDI 2025 shared task on caste and migration-based hate speech detection in code-mixed Tamil social media content. Our innovative multi-scale hybrid architecture combines classical TF-IDF features with state-of-the-art transformer embeddings, achieving 3rd place with an impressive F1-score of 0.818.

๐Ÿ”ฅ Key Highlights

  • ๐Ÿฅ‰ 3rd Place in LT-EDI 2025 Competition
  • ๐Ÿ“Š F1-Score: 0.818 on Tamil-English code-mixed hate speech detection
  • ๐Ÿค– 5 Transformer Models: Google BERT, XLM-RoBERTa (Base & Large), IndicBERT, Seanbenhur BERT
  • ๐Ÿ“ Multi-scale Features: 512, 1024, and 2048 dimensional representations
  • ๐ŸŽฏ Hierarchical Ensemble: 3-level majority voting strategy
  • ๐Ÿ”ฌ Hybrid Approach: Classical TF-IDF + Modern transformers
System Architecture

๐Ÿ—๏ธ Multi-scale Hybrid Architecture Overview


๐Ÿ† Competition Results

Our solution achieved outstanding performance in the LT-EDI 2025 shared task:

๐Ÿ… Rank๐Ÿ‘ฅ Team Name๐Ÿ“Š F1-Score๐Ÿ“ˆ Performance
๐Ÿฅ‡ 1stCUET_N3170.88105Leading
๐Ÿฅˆ 2ndCUET's_white_walkers0.86289Strong
๐Ÿฅ‰ 3rdWise (Ours)0.81827Excellent
4thCUET_blitz_aces0.81682Good
5thhinterwelt0.80916Good

๐Ÿ‘ฅ Team

๐ŸŽ“ Amrita School of Artificial Intelligence
Coimbatore, Amrita Vishwa Vidyapeetham, India

๐Ÿ‘ค Team Member๐ŸŽฏ Role๐Ÿ”— Profile
Ganesh Sundhar SLead ResearcherDeep Learning & NLP
Durai Singh KML EngineerFeature Engineering & Ensemble
Gnanasabesan GData ScientistPreprocessing & Analysis
Hari Krishnan NAI ResearcherModel Architecture
Dhanush MCSoftware EngineerPipeline & Optimization

๐Ÿ“Š Dataset

๐Ÿ—ƒ๏ธ LT-EDI 2025 Tamil-English Code-Mixed Hate Speech Dataset

๐Ÿ“ˆ Dataset Statistics

๐Ÿ“Š Split๐Ÿ”ข Count๐Ÿ“ Description
๐Ÿš‚ Training5,512Comments for model training
๐Ÿ” Development787Comments for validation
๐Ÿงช Test1,576Comments for final evaluation
๐Ÿ“ฆ Total7,875Complete dataset

๐Ÿท๏ธ Label Distribution

๐Ÿท๏ธ Label๐Ÿ“ Description๐ŸŽฏ Target
0Non-hate speechSafe content
1Hate speechCaste/migration-based hate

๐Ÿ“ Sample Data

๐Ÿ”ธ Non-hate: "Good morning anna, how are you doing today?"
๐Ÿ”น Hate: "[Contains offensive content targeting specific communities]"

Note: The dataset contains Tamil-English code-mixed social media comments with varying degrees of code-switching and transliteration.


๐Ÿ”ฌ Methodology

Our approach implements a sophisticated multi-stage pipeline that combines classical and modern NLP techniques.

๐Ÿ› ๏ธ Stage 1: Data Preprocessing

๐Ÿ” Click to expand preprocessing details

๐Ÿšซ Without Transliteration Pipeline

Input Text โ†’ Replace newlines โ†’ Convert emojis โ†’ Remove URLs โ†’ 
Normalize spaces โ†’ Convert to lowercase โ†’ Output

๐Ÿ”„ With Transliteration Pipeline

Input Text โ†’ Basic cleaning โ†’ Tamil Unicode to English โ†’ 
Remove repeated chars โ†’ Remove non-ASCII โ†’ Output

๐Ÿ“‹ Preprocessing Steps:

  • โœ… Replace newlines with spaces
  • โœ… Convert emojis to descriptive text
  • โœ… Remove URLs and mentions
  • โœ… Normalize whitespaces
  • โœ… Convert to lowercase
  • โœ… Tamil Unicode transliteration (conditional)
  • โœ… Remove repeated characters
  • โœ… Filter non-ASCII characters

๐ŸŽฏ Stage 2: Feature Extraction

๐Ÿ“Š TF-IDF Features

graph LR
    A[Raw Text] --> B[TF-IDF Vectorizer]
    B --> C[~22,000 dimensions]
    C --> D[Truncated SVD]
    D --> E[512/1024/2048 dims]
    E --> F[MLP Compression]
    F --> G[32/64/128 dims]

๐Ÿค– Transformer Embeddings

๐Ÿค– Model๐Ÿ“š Type๐Ÿ”ค Input๐Ÿ“ Dimensions
Google BERTbert-large-uncasedTransliterated768 โ†’ 960
XLM-RoBERTa Basexlm-roberta-baseOriginal768 โ†’ 960
XLM-RoBERTa Largexlm-roberta-largeOriginal1024 โ†’ 960
IndicBERTIndicBERTv2-MLMOriginal768 โ†’ 960
Seanbenhur BERTtanglish-offensiveTransliterated768 โ†’ 960

๐Ÿ—๏ธ Stage 3: Multi-level Ensemble Architecture

graph TD
    A[TF-IDF Features] --> D[Feature Fusion]
    B[BERT Embeddings] --> D
    C[RoBERTa Embeddings] --> D
    D --> E[ML Classifiers]
    E --> F[Level 1: Top-3 Voting]
    F --> G[Level 2: Cross-Model Voting]
    G --> H[Level 3: Multi-Scale Voting]
    H --> I[Final Prediction]

๐ŸŽฒ Machine Learning Classifiers

๐ŸŒณ Tree-Based Models:

  • Random Forest, XGBoost, LightGBM, CatBoost, Gradient Boosting

๐Ÿ“ Linear Models:

  • Logistic Regression, Ridge Classifier, SGD Classifier

๐Ÿ”ฎ Other Models:

  • SVM (Linear, RBF, Nu-SVM), KNN, AdaBoost, Neural Networks

๐Ÿ—ณ๏ธ Hierarchical Voting Strategy

  1. Level 1: Top-3 classifiers per feature set
  2. Level 2: Cross-model consensus per dimension
  3. Level 3: Multi-scale final decision

๐Ÿ—๏ธ Architecture

Detailed Architecture

๐Ÿ”ง Comprehensive System Architecture


๐Ÿ“ˆ Results

๐ŸŽฏ Performance by Dimension and Model

๐Ÿ“Š Dimension: 512

๐Ÿค– Transformer๐Ÿ† Best Model๐Ÿ“ˆ F1-Score๐ŸŽฏ Performance
Google BERTRandom Forest0.803๐ŸŸข Good
IndicBERTRandom Forest0.817๐ŸŸก Very Good
SeanBenhur BERTXGBoost0.814๐ŸŸก Very Good
XLM-R BaseRandom Forest0.807๐ŸŸข Good
XLM-R LargeExtra Trees0.806๐ŸŸข Good

๐Ÿ“Š Dimension: 1024

๐Ÿค– Transformer๐Ÿ† Best Model๐Ÿ“ˆ F1-Score๐ŸŽฏ Performance
Google BERTSVM0.818๐ŸŸก Very Good
IndicBERTRandom Forest0.829๐ŸŸ  Excellent
SeanBenhur BERTRandom Forest0.822๐ŸŸก Very Good
XLM-R BaseNu-SVM0.825๐ŸŸก Very Good
XLM-R LargeRandom Forest0.830๐ŸŸ  Excellent

๐Ÿ“Š Dimension: 2048 โญ

๐Ÿค– Transformer๐Ÿ† Best Model๐Ÿ“ˆ F1-Score๐ŸŽฏ Performance
Google BERTGradient Boosting0.839๐Ÿ”ฅ Outstanding
IndicBERTRidge Regression0.824๐ŸŸก Very Good
SeanBenhur BERTNu-SVM0.826๐ŸŸก Very Good
XLM-R BaseRandom Forest0.835๐ŸŸ  Excellent
XLM-R LargeRandom Forest0.833๐ŸŸ  Excellent

๐Ÿ† Final Competition Standings

๐ŸŽŠ LT-EDI 2025 Leaderboard

๐Ÿ… Rank๐Ÿ‘ฅ Team Name๐Ÿ“Š F1-Score๐Ÿ“ˆ Gap๐ŸŽฏ Status
๐Ÿฅ‡ 1stCUET_N3170.88105-๐Ÿ”ฅ Winner
๐Ÿฅˆ 2ndCUET's_white_walkers0.86289-0.018๐Ÿš€ Runner-up
๐Ÿฅ‰ 3rdWise (Ours)0.81827-0.044โœจ Bronze
4thCUET_blitz_aces0.81682-0.001๐Ÿ“ˆ Close
5thhinterwelt0.80916-0.009๐Ÿ’ช Strong

๐ŸŽฏ Achievement: Our team secured 3rd place out of numerous international participants, demonstrating the effectiveness of our multi-scale ensemble approach!


๐Ÿ“Š Training Performance Graphs

๐Ÿ“ˆ Model Training Visualization Across Different Dimensions

๐Ÿ“Š Dimension: 512

๐Ÿ” Click to view 512-dimensional training graphs
๐Ÿค– Model๐Ÿ“ˆ Training Graph
Google BERTGoogle BERT - 512
IndicBERTIndicBERT - 512
Seanbenhur BERTSeanbenhur BERT - 512
XLM-RoBERTa BaseXLM-RoBERTa Base - 512
XLM-RoBERTa LargeXLM-RoBERTa Large - 512

๐Ÿ“Š Dimension: 1024

๐Ÿ” Click to view 1024-dimensional training graphs
๐Ÿค– Model๐Ÿ“ˆ Training Graph
Google BERTGoogle BERT - 1024
IndicBERTIndicBERT - 1024
Seanbenhur BERTSeanbenhur BERT - 1024
XLM-RoBERTa BaseXLM-RoBERTa Base - 1024
XLM-RoBERTa LargeXLM-RoBERTa Large - 1024

๐Ÿ“Š Dimension: 2048 โญ

๐Ÿ” Click to view 2048-dimensional training graphs
๐Ÿค– Model๐Ÿ“ˆ Training Graph
Google BERTGoogle BERT - 2048
IndicBERTIndicBERT - 2048
Seanbenhur BERTSeanbenhur BERT - 2048
XLM-RoBERTa BaseXLM-RoBERTa Base - 2048
XLM-RoBERTa LargeXLM-RoBERTa Large - 2048

๐Ÿš€ Quick Start

๐Ÿ“‹ Prerequisites

# Python 3.8+ required
python --version  # Should be >= 3.8

โšก Installation

# Clone the repository
git clone https://github.com/your-username/CasteMigrationHateSpeech.git
cd CasteMigrationHateSpeech

# Install dependencies
pip install -r requirements.txt

# Install additional dependencies
pip install torch torchvision transformers
pip install xgboost lightgbm catboost

๐Ÿ”ง Running the Pipeline

1๏ธโƒฃ Data Preprocessing

# Navigate to preprocessors
cd "DL Feature set 1024/Processors"

# Run preprocessing notebooks
jupyter notebook with_transliteration_processor.ipynb
jupyter notebook no_transliteration_processor.ipynb

2๏ธโƒฃ Feature Generation

# Generate TF-IDF features
jupyter notebook tf_idf_vectorizer.ipynb

# Apply vectorizer
jupyter notebook apply_vectorizer.ipynb

3๏ธโƒฃ Model Training

# Navigate to trainers
cd "../Trainers"

# Train transformer models
python training_bert.py  # Configure model in script

4๏ธโƒฃ Ensemble Classification

# Navigate to ML heads
cd "../../ML Classification Heads"

# Run ensemble classification
jupyter notebook code.ipynb

๐Ÿ“ Repository Structure

๐Ÿ—‚๏ธ Click to view detailed directory structure
๐Ÿ† CasteMigrationHateSpeech-main/
โ”‚
โ”œโ”€โ”€ ๐Ÿ“Š DL Feature set 512/          # 512-dimensional experiments
โ”‚   โ”œโ”€โ”€ ๐Ÿค– Models/                  # Transformer model definitions
โ”‚   โ”‚   โ”œโ”€โ”€ google_bert.py
โ”‚   โ”‚   โ”œโ”€โ”€ indic_model.py
โ”‚   โ”‚   โ”œโ”€โ”€ tanglish_model.py
โ”‚   โ”‚   โ”œโ”€โ”€ xlm_roberta_base.py
โ”‚   โ”‚   โ””โ”€โ”€ xlm_roberta_large.py
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ No trans data/           # Non-transliterated features
โ”‚   โ”‚   โ”œโ”€โ”€ test_features_no_trans.csv
โ”‚   โ”‚   โ”œโ”€โ”€ test_processed_no_trans.csv
โ”‚   โ”‚   โ””โ”€โ”€ tfidf_vectorizer_2.pkl
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ ๐Ÿ“Š Original Data/           # Raw dataset
โ”‚   โ”‚   โ””โ”€โ”€ test.csv
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ ๐Ÿ”ง Processors/              # Data preprocessing scripts
โ”‚   โ”‚   โ”œโ”€โ”€ apply_vectorizer.ipynb
โ”‚   โ”‚   โ”œโ”€โ”€ no_transliteration_processor.ipynb
โ”‚   โ”‚   โ”œโ”€โ”€ tf_idf_vectorizer.ipynb
โ”‚   โ”‚   โ””โ”€โ”€ with_transliteration_processor.ipynb
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ˆ Train Data/              # Training results & visualizations
โ”‚   โ”‚   โ”œโ”€โ”€ Graphs/                 # Training performance plots
โ”‚   โ”‚   โ”œโ”€โ”€ Logs/                   # Training logs
โ”‚   โ”‚   โ””โ”€โ”€ Results/                # Model outputs
โ”‚   โ”‚
โ”‚   โ””โ”€โ”€ ๐Ÿ‹๏ธ Trainers/                # Training infrastructure
โ”‚       โ”œโ”€โ”€ classification_features_generator.ipynb
โ”‚       โ”œโ”€โ”€ dataset.py
โ”‚       โ”œโ”€โ”€ logger.py
โ”‚       โ”œโ”€โ”€ trainer.py
โ”‚       โ””โ”€โ”€ training_bert.py
โ”‚
โ”œโ”€โ”€ ๐Ÿ“Š DL Feature set 1024/         # 1024-dimensional experiments
โ”‚   โ””โ”€โ”€ [Same structure as 512]
โ”‚
โ”œโ”€โ”€ ๐Ÿ“Š DL Feature set 2048/         # 2048-dimensional experiments  
โ”‚   โ””โ”€โ”€ [Same structure as 512]
โ”‚
โ”œโ”€โ”€ ๐Ÿ”„ Trans data/                  # Transliterated features
โ”‚   โ”œโ”€โ”€ test_features.csv
โ”‚   โ”œโ”€โ”€ test_processed.csv
โ”‚   โ””โ”€โ”€ tfidf_vectorizer_1.pkl
โ”‚
โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ Images/                       # Documentation assets
โ”‚   โ””โ”€โ”€ overview.png
โ”‚
โ”œโ”€โ”€ ๐ŸŽฏ ML Classification Heads/     # Ensemble classification
โ”‚   โ”œโ”€โ”€ size 512/                   # 512-dim ensemble results
โ”‚   โ”œโ”€โ”€ size 1024/                  # 1024-dim ensemble results
โ”‚   โ”œโ”€โ”€ size 2048/                  # 2048-dim ensemble results
โ”‚   โ”œโ”€โ”€ code.ipynb                  # Main ensemble script
โ”‚   โ”œโ”€โ”€ final_1024.csv             # Final predictions
โ”‚   โ”œโ”€โ”€ final_2048.csv
โ”‚   โ”œโ”€โ”€ final_512.csv
โ”‚   โ””โ”€โ”€ best_submission.csv         # Competition submission
โ”‚
โ””โ”€โ”€ ๐Ÿ“– README.md                    # This file

๐Ÿ”ง Dependencies

๐Ÿ› ๏ธ Technology Stack

๐Ÿ“ฆ Core Dependencies

๐Ÿท๏ธ Package๐Ÿ”ข Version๐Ÿ“ Purpose
Python3.8+Programming language
PyTorch2.0+Deep learning framework
Transformers4.0+Pre-trained models
scikit-learn1.0+Machine learning

๐Ÿ“Š ML Libraries

๐Ÿท๏ธ Package๐Ÿ“ Purpose
xgboostGradient boosting
lightgbmLight gradient boosting
catboostCategorical boosting
pandasData manipulation
numpyNumerical computing
nltkNatural language processing
emojiEmoji handling

๐Ÿ“ฅ Installation Command

pip install torch>=2.0 transformers>=4.0 scikit-learn>=1.0 \
    xgboost lightgbm catboost pandas numpy nltk emoji \
    matplotlib seaborn tqdm jupyter

๐Ÿ’ก Key Findings

๐ŸŽฏ Technical Insights

๐Ÿ’ก Finding๐Ÿ“Š Impact๐Ÿ” Details
๐Ÿ”ข Multi-scale representations+3.6% F1Different dimensions (512/1024/2048) capture varying feature granularity
๐Ÿค Hybrid features+2.8% F1TF-IDF + transformers = statistical + contextual information
๐Ÿ”ง Model-specific preprocessing+1.9% F1Transliteration vs. original text per model type
๐Ÿ—ณ๏ธ Ensemble diversity+4.2% F1Hierarchical voting across features, models, and scales

๐Ÿ“ˆ Performance Patterns

๐Ÿ”ฅ Best Performing: 2048-dimensional features
๐ŸŽฏ Most Consistent: Random Forest classifiers  
๐Ÿš€ Biggest Surprise: Gradient Boosting on Google BERT
๐Ÿ“Š Sweet Spot: 1024-dimensional IndicBERT

Hari-Krishnan-N/Caste-Migration-Hate-Speech

Advanced hate speech detection in Tamil-English code-mixed social media content using hybrid deep learning architectures.

Jupyter Notebook

0

1 commits

updated Jul 30, 2025

See the code

README

๐Ÿ† Wise@LT-EDI 2025: Multi-scale Ensemble Learning for Tamil-English Code-Mixed Hate Speech Detection

Python PyTorch Transformers scikit-learn

XGBoost LightGBM CatBoost NLTK

LT-EDI 2025 F1 Score Task Language

๐ŸŽฏ Advanced hate speech detection in Tamil-English code-mixed social media content using hybrid deep learning architectures

๐Ÿ“‹ Table of Contents


๐ŸŽฏ Overview

This repository contains our award-winning submission to the LT-EDI 2025 shared task on caste and migration-based hate speech detection in code-mixed Tamil social media content. Our innovative multi-scale hybrid architecture combines classical TF-IDF features with state-of-the-art transformer embeddings, achieving 3rd place with an impressive F1-score of 0.818.

๐Ÿ”ฅ Key Highlights

  • ๐Ÿฅ‰ 3rd Place in LT-EDI 2025 Competition
  • ๐Ÿ“Š F1-Score: 0.818 on Tamil-English code-mixed hate speech detection
  • ๐Ÿค– 5 Transformer Models: Google BERT, XLM-RoBERTa (Base & Large), IndicBERT, Seanbenhur BERT
  • ๐Ÿ“ Multi-scale Features: 512, 1024, and 2048 dimensional representations
  • ๐ŸŽฏ Hierarchical Ensemble: 3-level majority voting strategy
  • ๐Ÿ”ฌ Hybrid Approach: Classical TF-IDF + Modern transformers
System Architecture

๐Ÿ—๏ธ Multi-scale Hybrid Architecture Overview


๐Ÿ† Competition Results

Our solution achieved outstanding performance in the LT-EDI 2025 shared task:

๐Ÿ… Rank๐Ÿ‘ฅ Team Name๐Ÿ“Š F1-Score๐Ÿ“ˆ Performance
๐Ÿฅ‡ 1stCUET_N3170.88105Leading
๐Ÿฅˆ 2ndCUET's_white_walkers0.86289Strong
๐Ÿฅ‰ 3rdWise (Ours)0.81827Excellent
4thCUET_blitz_aces0.81682Good
5thhinterwelt0.80916Good

๐Ÿ‘ฅ Team

๐ŸŽ“ Amrita School of Artificial Intelligence
Coimbatore, Amrita Vishwa Vidyapeetham, India

๐Ÿ‘ค Team Member๐ŸŽฏ Role๐Ÿ”— Profile
Ganesh Sundhar SLead ResearcherDeep Learning & NLP
Durai Singh KML EngineerFeature Engineering & Ensemble
Gnanasabesan GData ScientistPreprocessing & Analysis
Hari Krishnan NAI ResearcherModel Architecture
Dhanush MCSoftware EngineerPipeline & Optimization

๐Ÿ“Š Dataset

๐Ÿ—ƒ๏ธ LT-EDI 2025 Tamil-English Code-Mixed Hate Speech Dataset

๐Ÿ“ˆ Dataset Statistics

๐Ÿ“Š Split๐Ÿ”ข Count๐Ÿ“ Description
๐Ÿš‚ Training5,512Comments for model training
๐Ÿ” Development787Comments for validation
๐Ÿงช Test1,576Comments for final evaluation
๐Ÿ“ฆ Total7,875Complete dataset

๐Ÿท๏ธ Label Distribution

๐Ÿท๏ธ Label๐Ÿ“ Description๐ŸŽฏ Target
0Non-hate speechSafe content
1Hate speechCaste/migration-based hate

๐Ÿ“ Sample Data

๐Ÿ”ธ Non-hate: "Good morning anna, how are you doing today?"
๐Ÿ”น Hate: "[Contains offensive content targeting specific communities]"

Note: The dataset contains Tamil-English code-mixed social media comments with varying degrees of code-switching and transliteration.


๐Ÿ”ฌ Methodology

Our approach implements a sophisticated multi-stage pipeline that combines classical and modern NLP techniques.

๐Ÿ› ๏ธ Stage 1: Data Preprocessing

๐Ÿ” Click to expand preprocessing details

๐Ÿšซ Without Transliteration Pipeline

Input Text โ†’ Replace newlines โ†’ Convert emojis โ†’ Remove URLs โ†’ 
Normalize spaces โ†’ Convert to lowercase โ†’ Output

๐Ÿ”„ With Transliteration Pipeline

Input Text โ†’ Basic cleaning โ†’ Tamil Unicode to English โ†’ 
Remove repeated chars โ†’ Remove non-ASCII โ†’ Output

๐Ÿ“‹ Preprocessing Steps:

  • โœ… Replace newlines with spaces
  • โœ… Convert emojis to descriptive text
  • โœ… Remove URLs and mentions
  • โœ… Normalize whitespaces
  • โœ… Convert to lowercase
  • โœ… Tamil Unicode transliteration (conditional)
  • โœ… Remove repeated characters
  • โœ… Filter non-ASCII characters

๐ŸŽฏ Stage 2: Feature Extraction

๐Ÿ“Š TF-IDF Features

graph LR
    A[Raw Text] --> B[TF-IDF Vectorizer]
    B --> C[~22,000 dimensions]
    C --> D[Truncated SVD]
    D --> E[512/1024/2048 dims]
    E --> F[MLP Compression]
    F --> G[32/64/128 dims]

๐Ÿค– Transformer Embeddings

๐Ÿค– Model๐Ÿ“š Type๐Ÿ”ค Input๐Ÿ“ Dimensions
Google BERTbert-large-uncasedTransliterated768 โ†’ 960
XLM-RoBERTa Basexlm-roberta-baseOriginal768 โ†’ 960
XLM-RoBERTa Largexlm-roberta-largeOriginal1024 โ†’ 960
IndicBERTIndicBERTv2-MLMOriginal768 โ†’ 960
Seanbenhur BERTtanglish-offensiveTransliterated768 โ†’ 960

๐Ÿ—๏ธ Stage 3: Multi-level Ensemble Architecture

graph TD
    A[TF-IDF Features] --> D[Feature Fusion]
    B[BERT Embeddings] --> D
    C[RoBERTa Embeddings] --> D
    D --> E[ML Classifiers]
    E --> F[Level 1: Top-3 Voting]
    F --> G[Level 2: Cross-Model Voting]
    G --> H[Level 3: Multi-Scale Voting]
    H --> I[Final Prediction]

๐ŸŽฒ Machine Learning Classifiers

๐ŸŒณ Tree-Based Models:

  • Random Forest, XGBoost, LightGBM, CatBoost, Gradient Boosting

๐Ÿ“ Linear Models:

  • Logistic Regression, Ridge Classifier, SGD Classifier

๐Ÿ”ฎ Other Models:

  • SVM (Linear, RBF, Nu-SVM), KNN, AdaBoost, Neural Networks

๐Ÿ—ณ๏ธ Hierarchical Voting Strategy

  1. Level 1: Top-3 classifiers per feature set
  2. Level 2: Cross-model consensus per dimension
  3. Level 3: Multi-scale final decision

๐Ÿ—๏ธ Architecture

Detailed Architecture

๐Ÿ”ง Comprehensive System Architecture


๐Ÿ“ˆ Results

๐ŸŽฏ Performance by Dimension and Model

๐Ÿ“Š Dimension: 512

๐Ÿค– Transformer๐Ÿ† Best Model๐Ÿ“ˆ F1-Score๐ŸŽฏ Performance
Google BERTRandom Forest0.803๐ŸŸข Good
IndicBERTRandom Forest0.817๐ŸŸก Very Good
SeanBenhur BERTXGBoost0.814๐ŸŸก Very Good
XLM-R BaseRandom Forest0.807๐ŸŸข Good
XLM-R LargeExtra Trees0.806๐ŸŸข Good

๐Ÿ“Š Dimension: 1024

๐Ÿค– Transformer๐Ÿ† Best Model๐Ÿ“ˆ F1-Score๐ŸŽฏ Performance
Google BERTSVM0.818๐ŸŸก Very Good
IndicBERTRandom Forest0.829๐ŸŸ  Excellent
SeanBenhur BERTRandom Forest0.822๐ŸŸก Very Good
XLM-R BaseNu-SVM0.825๐ŸŸก Very Good
XLM-R LargeRandom Forest0.830๐ŸŸ  Excellent

๐Ÿ“Š Dimension: 2048 โญ

๐Ÿค– Transformer๐Ÿ† Best Model๐Ÿ“ˆ F1-Score๐ŸŽฏ Performance
Google BERTGradient Boosting0.839๐Ÿ”ฅ Outstanding
IndicBERTRidge Regression0.824๐ŸŸก Very Good
SeanBenhur BERTNu-SVM0.826๐ŸŸก Very Good
XLM-R BaseRandom Forest0.835๐ŸŸ  Excellent
XLM-R LargeRandom Forest0.833๐ŸŸ  Excellent

๐Ÿ† Final Competition Standings

๐ŸŽŠ LT-EDI 2025 Leaderboard

๐Ÿ… Rank๐Ÿ‘ฅ Team Name๐Ÿ“Š F1-Score๐Ÿ“ˆ Gap๐ŸŽฏ Status
๐Ÿฅ‡ 1stCUET_N3170.88105-๐Ÿ”ฅ Winner
๐Ÿฅˆ 2ndCUET's_white_walkers0.86289-0.018๐Ÿš€ Runner-up
๐Ÿฅ‰ 3rdWise (Ours)0.81827-0.044โœจ Bronze
4thCUET_blitz_aces0.81682-0.001๐Ÿ“ˆ Close
5thhinterwelt0.80916-0.009๐Ÿ’ช Strong

๐ŸŽฏ Achievement: Our team secured 3rd place out of numerous international participants, demonstrating the effectiveness of our multi-scale ensemble approach!


๐Ÿ“Š Training Performance Graphs

๐Ÿ“ˆ Model Training Visualization Across Different Dimensions

๐Ÿ“Š Dimension: 512

๐Ÿ” Click to view 512-dimensional training graphs
๐Ÿค– Model๐Ÿ“ˆ Training Graph
Google BERTGoogle BERT - 512
IndicBERTIndicBERT - 512
Seanbenhur BERTSeanbenhur BERT - 512
XLM-RoBERTa BaseXLM-RoBERTa Base - 512
XLM-RoBERTa LargeXLM-RoBERTa Large - 512

๐Ÿ“Š Dimension: 1024

๐Ÿ” Click to view 1024-dimensional training graphs
๐Ÿค– Model๐Ÿ“ˆ Training Graph
Google BERTGoogle BERT - 1024
IndicBERTIndicBERT - 1024
Seanbenhur BERTSeanbenhur BERT - 1024
XLM-RoBERTa BaseXLM-RoBERTa Base - 1024
XLM-RoBERTa LargeXLM-RoBERTa Large - 1024

๐Ÿ“Š Dimension: 2048 โญ

๐Ÿ” Click to view 2048-dimensional training graphs
๐Ÿค– Model๐Ÿ“ˆ Training Graph
Google BERTGoogle BERT - 2048
IndicBERTIndicBERT - 2048
Seanbenhur BERTSeanbenhur BERT - 2048
XLM-RoBERTa BaseXLM-RoBERTa Base - 2048
XLM-RoBERTa LargeXLM-RoBERTa Large - 2048

๐Ÿš€ Quick Start

๐Ÿ“‹ Prerequisites

# Python 3.8+ required
python --version  # Should be >= 3.8

โšก Installation

# Clone the repository
git clone https://github.com/your-username/CasteMigrationHateSpeech.git
cd CasteMigrationHateSpeech

# Install dependencies
pip install -r requirements.txt

# Install additional dependencies
pip install torch torchvision transformers
pip install xgboost lightgbm catboost

๐Ÿ”ง Running the Pipeline

1๏ธโƒฃ Data Preprocessing

# Navigate to preprocessors
cd "DL Feature set 1024/Processors"

# Run preprocessing notebooks
jupyter notebook with_transliteration_processor.ipynb
jupyter notebook no_transliteration_processor.ipynb

2๏ธโƒฃ Feature Generation

# Generate TF-IDF features
jupyter notebook tf_idf_vectorizer.ipynb

# Apply vectorizer
jupyter notebook apply_vectorizer.ipynb

3๏ธโƒฃ Model Training

# Navigate to trainers
cd "../Trainers"

# Train transformer models
python training_bert.py  # Configure model in script

4๏ธโƒฃ Ensemble Classification

# Navigate to ML heads
cd "../../ML Classification Heads"

# Run ensemble classification
jupyter notebook code.ipynb

๐Ÿ“ Repository Structure

๐Ÿ—‚๏ธ Click to view detailed directory structure
๐Ÿ† CasteMigrationHateSpeech-main/
โ”‚
โ”œโ”€โ”€ ๐Ÿ“Š DL Feature set 512/          # 512-dimensional experiments
โ”‚   โ”œโ”€โ”€ ๐Ÿค– Models/                  # Transformer model definitions
โ”‚   โ”‚   โ”œโ”€โ”€ google_bert.py
โ”‚   โ”‚   โ”œโ”€โ”€ indic_model.py
โ”‚   โ”‚   โ”œโ”€โ”€ tanglish_model.py
โ”‚   โ”‚   โ”œโ”€โ”€ xlm_roberta_base.py
โ”‚   โ”‚   โ””โ”€โ”€ xlm_roberta_large.py
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ No trans data/           # Non-transliterated features
โ”‚   โ”‚   โ”œโ”€โ”€ test_features_no_trans.csv
โ”‚   โ”‚   โ”œโ”€โ”€ test_processed_no_trans.csv
โ”‚   โ”‚   โ””โ”€โ”€ tfidf_vectorizer_2.pkl
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ ๐Ÿ“Š Original Data/           # Raw dataset
โ”‚   โ”‚   โ””โ”€โ”€ test.csv
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ ๐Ÿ”ง Processors/              # Data preprocessing scripts
โ”‚   โ”‚   โ”œโ”€โ”€ apply_vectorizer.ipynb
โ”‚   โ”‚   โ”œโ”€โ”€ no_transliteration_processor.ipynb
โ”‚   โ”‚   โ”œโ”€โ”€ tf_idf_vectorizer.ipynb
โ”‚   โ”‚   โ””โ”€โ”€ with_transliteration_processor.ipynb
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ˆ Train Data/              # Training results & visualizations
โ”‚   โ”‚   โ”œโ”€โ”€ Graphs/                 # Training performance plots
โ”‚   โ”‚   โ”œโ”€โ”€ Logs/                   # Training logs
โ”‚   โ”‚   โ””โ”€โ”€ Results/                # Model outputs
โ”‚   โ”‚
โ”‚   โ””โ”€โ”€ ๐Ÿ‹๏ธ Trainers/                # Training infrastructure
โ”‚       โ”œโ”€โ”€ classification_features_generator.ipynb
โ”‚       โ”œโ”€โ”€ dataset.py
โ”‚       โ”œโ”€โ”€ logger.py
โ”‚       โ”œโ”€โ”€ trainer.py
โ”‚       โ””โ”€โ”€ training_bert.py
โ”‚
โ”œโ”€โ”€ ๐Ÿ“Š DL Feature set 1024/         # 1024-dimensional experiments
โ”‚   โ””โ”€โ”€ [Same structure as 512]
โ”‚
โ”œโ”€โ”€ ๐Ÿ“Š DL Feature set 2048/         # 2048-dimensional experiments  
โ”‚   โ””โ”€โ”€ [Same structure as 512]
โ”‚
โ”œโ”€โ”€ ๐Ÿ”„ Trans data/                  # Transliterated features
โ”‚   โ”œโ”€โ”€ test_features.csv
โ”‚   โ”œโ”€โ”€ test_processed.csv
โ”‚   โ””โ”€โ”€ tfidf_vectorizer_1.pkl
โ”‚
โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ Images/                       # Documentation assets
โ”‚   โ””โ”€โ”€ overview.png
โ”‚
โ”œโ”€โ”€ ๐ŸŽฏ ML Classification Heads/     # Ensemble classification
โ”‚   โ”œโ”€โ”€ size 512/                   # 512-dim ensemble results
โ”‚   โ”œโ”€โ”€ size 1024/                  # 1024-dim ensemble results
โ”‚   โ”œโ”€โ”€ size 2048/                  # 2048-dim ensemble results
โ”‚   โ”œโ”€โ”€ code.ipynb                  # Main ensemble script
โ”‚   โ”œโ”€โ”€ final_1024.csv             # Final predictions
โ”‚   โ”œโ”€โ”€ final_2048.csv
โ”‚   โ”œโ”€โ”€ final_512.csv
โ”‚   โ””โ”€โ”€ best_submission.csv         # Competition submission
โ”‚
โ””โ”€โ”€ ๐Ÿ“– README.md                    # This file

๐Ÿ”ง Dependencies

๐Ÿ› ๏ธ Technology Stack

๐Ÿ“ฆ Core Dependencies

๐Ÿท๏ธ Package๐Ÿ”ข Version๐Ÿ“ Purpose
Python3.8+Programming language
PyTorch2.0+Deep learning framework
Transformers4.0+Pre-trained models
scikit-learn1.0+Machine learning

๐Ÿ“Š ML Libraries

๐Ÿท๏ธ Package๐Ÿ“ Purpose
xgboostGradient boosting
lightgbmLight gradient boosting
catboostCategorical boosting
pandasData manipulation
numpyNumerical computing
nltkNatural language processing
emojiEmoji handling

๐Ÿ“ฅ Installation Command

pip install torch>=2.0 transformers>=4.0 scikit-learn>=1.0 \
    xgboost lightgbm catboost pandas numpy nltk emoji \
    matplotlib seaborn tqdm jupyter

๐Ÿ’ก Key Findings

๐ŸŽฏ Technical Insights

๐Ÿ’ก Finding๐Ÿ“Š Impact๐Ÿ” Details
๐Ÿ”ข Multi-scale representations+3.6% F1Different dimensions (512/1024/2048) capture varying feature granularity
๐Ÿค Hybrid features+2.8% F1TF-IDF + transformers = statistical + contextual information
๐Ÿ”ง Model-specific preprocessing+1.9% F1Transliteration vs. original text per model type
๐Ÿ—ณ๏ธ Ensemble diversity+4.2% F1Hierarchical voting across features, models, and scales

๐Ÿ“ˆ Performance Patterns

๐Ÿ”ฅ Best Performing: 2048-dimensional features
๐ŸŽฏ Most Consistent: Random Forest classifiers  
๐Ÿš€ Biggest Surprise: Gradient Boosting on Google BERT
๐Ÿ“Š Sweet Spot: 1024-dimensional IndicBERT