Improving Code-Mixed Hate Detection by Native Sample Mixing: A Case Study for Hindi-English Code-Mixed Scenario

Debajyoti Mazumder, Aakash Kumar, Jasabanta Patro

This paper, authored by researchers at the Indian Institute of Science Education and Research (IISER) Bhopal, explores a practical solution to a persistent problem in Natural Language Processing (NLP): detecting hate speech in "code-mixed" text.

TL;DR

The researchers demonstrate that "native sample mixing"—adding monolingual Hindi and English hate speech examples to training data—significantly boosts the performance of Multilingual Language Models (MLMs) in detecting Hindi-English code-mixed hate speech. Remarkably, models trained only on monolingual data can detect code-mixed hate nearly as well as those trained on specialized code-mixed datasets, offering a lifeline for low-resource language scenarios.

What Problem Does This Paper Address?

Code-mixing—the practice of switching between two or more languages within a single conversation or sentence—is incredibly common on social media, particularly in multilingual societies like India. However, detecting hate speech in these contexts is a nightmare for AI.

The primary challenge isn't just the linguistic complexity; it’s the data bottleneck. While there are massive, well-annotated datasets for hate speech in English or Hindi individually, large-scale annotated "code-mixed" datasets are rare and expensive to create. The authors investigate whether we can "borrow" the knowledge from abundant monolingual (native) datasets to improve detection in mixed-language environments.

Methods

The authors conducted a series of rigorous empirical experiments using two main types of models:

  1. Statistical Classifiers: Traditional models like SVM, Random Forest, and Naive Bayes using word n-grams (unigrams, bigrams, trigrams).
  2. Multilingual Language Models (MLMs): Modern transformer-based models including mBERT, XLM, XLM-R, and region-specific models like IndicBERT and MuRIL.

The "Native Sample Mixing" Approach: The core novelty lies in how they manipulated the training sets. They created three experimental setups:

  • Exp 1: Adding native samples to an existing code-mixed training set to see if performance improves.
  • Exp 2: Testing the impact of adding native samples in different quantities and label ratios.
  • Exp 3: Training models exclusively on native (monolingual) samples and testing them on code-mixed data.

They also experimented with "Transformer stacking"—adding four extra transformer layers on top of the MLMs—to see if increased parameter space helped the models store more complex task-specific information.

Datasets

The study utilized three primary open-source datasets:

  • English-Hindi CM: A code-mixed dataset of ~4.5k tweets (Bohra et al., 2018).
  • Hindi Monolingual: Native Hindi hate speech samples from the HASOC-2019 collection.
  • English Monolingual: Native English hate speech samples from the HASOC-2019 collection.

To quantify the complexity of their test set, they used the Code-Mixing Index (CMI) and Burstiness, finding that their data had a high degree of mixing (39% of words from the non-dominant language).

Key Insights and Ideas

  • The "Aha" Moment for MLMs: While statistical models actually performed worse when native samples were added (likely because the n-gram distributions became too diluted), MLMs thrived. Adding native samples improved MLM performance by up to 0.11 in F1-score.
  • Zero-Shot-ish Success: One of the most surprising findings was that MLMs trained only on native samples achieved an F1-score of 0.60, which is very close to the 0.63 achieved when training with actual code-mixed data. This suggests that MLMs are highly effective at transferring "hate context" across language boundaries.
  • Attention Shift: By visualizing attention scores, the authors found that adding native samples "taught" the models to focus more intensely on specific hate-emitting words (like "murder" or "rape") even when those words appeared in a mixed-language sentence.
  • Cultural Overlap: Hindi native samples were generally more effective than English ones at improving detection. The authors hypothesize this is because the Hindi datasets and the Hindi-English code-mixed datasets often share the same cultural and social context.

Key Results

  • Top Performers: MuRIL and XLM-R consistently outperformed other models. MuRIL, being pre-trained specifically on Indian languages, showed the most stability.
  • Diminishing Returns on Complexity: Adding extra transformer layers (the "stacked" approach) provided minimal to no improvement over standard fine-tuning. This indicates that the base MLMs already possess the necessary architecture to handle the task.
  • Robustness: MLMs proved relatively robust to label unbalancing when native samples were added in different ratios.

Limitations and Future Work

Despite the success, the authors highlight a significant hurdle: Sarcasm and Subjectivity. When hate is expressed through irony or subtle cultural cues rather than explicit keywords, "naively" mixing native samples doesn't help much. The models still struggle to distinguish between a "criticism" and "hate" in subjective contexts.

Future directions include: * Testing the hypothesis on other language pairs (e.g., Sinhala-English). * Incorporating multi-task learning to specifically handle sarcasm and hate intensity. * Developing datasets that annotate the intensity of hate in code-mixed environments.

Summary updated

BibTeX
@article{mazumder2025improving,
  author = {Debajyoti Mazumder and Aakash Kumar and Jasabanta Patro},
  title = {{Improving Code-Mixed Hate Detection by Native Sample Mixing: A Case Study for Hindi-English Code-Mixed Scenario}},
  journal = {ACM Trans. Asian Low Resour. Lang. Inf. Process.},
  year = {2025},
  doi = {10.1145/3726866},
}
Figure