MIRA-IndicLID

MIRA-IndicLID is a state-of-the-art, lightweight Language Identification (LID) model specialized for the 22 Constitutional Languages of India.

This model introduces a significantly more balanced training approach, leveraging a mixture of formal, social, and synthetic data to achieve superior generalization across diverse web domains and scripts (Native, Romanized, and Code-Mixed).

Model Details

  • Architecture: FastText (Binary + Quantized)
  • Size: ~902 MB (.ftz format)
  • Supported Languages: 22 Indic Languages
  • Key Feature: High robustness on Romanized Indic content and Code-Mixed (Hinglish) text.

Supported Languages

The model supports the following 22 languages: Assamese (as), Bengali (bn), Bodo (brx), Dogri (doi), Gujarati (gu), Hindi (hi), Kannada (kn), Kashmiri (ks), Konkani (kok), Maithili (mai), Malayalam (ml), Manipuri (mni), Marathi (mr), Nepali (ne), Oriya (or), Punjabi (pa), Sanskrit (sa), Santali (sat), Sindhi (sd), Tamil (ta), Telugu (te), Urdu (ur).

Label Mapping

Language ISO Code fastText Label
Assamese as __label__as
Bengali bn __label__bn
Bodo brx __label__brx
Dogri doi __label__doi
Gujarati gu __label__gu
Hindi hi __label__hi
Kannada kn __label__kn
Kashmiri ks __label__ks
Konkani kok __label__kok
Maithili mai __label__mai
Malayalam ml __label__ml
Manipuri mni __label__mni
Marathi mr __label__mr
Nepali ne __label__ne
Oriya or __label__or
Punjabi pa __label__pa
Sanskrit sa __label__sa
Santali sat __label__sat
Sindhi sd __label__sd
Tamil ta __label__ta
Telugu te __label__te
Urdu ur __label__ur

Datasets Used

Combination of data from:

The training data includes both native scripts and Romanized (transliterated) text, with temperature-based sampling (T=0.3) to handle low-resource languages and script balancing.

Training Data & Strategy

The model was trained on a comprehensive mixture of ~2.8 billion characters (balanced sampling) from the following sources:

  • Formal Native Corpus: Clean text from IndicCorp v2 and FLORES-200.
  • Social & Noisy Web: Real-world data from IndicSentiment and custom social media crawls.
  • Large-Scale Web Crawl: Sangraha dataset, stratified by script and length.
  • Synthetic Hard Pairs: Adversarial samples generated via Groq Synthetic Data to resolve common language confusions (e.g., Hindi vs. Marathi in Devanagari).
  • Romanized & Code-Mixed: Extensive transliterated and Hinglish data to ensure script-agnostic identification.

Benchmarking Metrics (Accuracy & Macro-F1)

The following tables summarize the performance of MIRA-IndicLID compared to several state-of-the-art baselines.

Accuracy (%)

Dataset MIRA-IndicLID AI4B-IndicLID GlotLID FastText OpenLID
Test-Set 96.86 - 84.63 69.29 68.32
FLORES 98.32 99.39 99.69 100.00 99.08
Sentiment 96.75 99.30 100.00 74.88 74.88
Sangraha 87.81 89.00 82.77 68.81 68.35
IndicLID-Full-Test 97.48 96.75 95.89 90.95 89.77
Comprehensive-Native 98.02 97.39 96.66 89.78 88.11
Comprehensive-Roman 81.82 45.39 34.60 0.13 0.00
Comprehensive-Mixed 100.00 14.29 52.38 0.00 0.00
Entire-Comprehensive 88.16 65.01 58.47 34.40 33.68
Groq-Synthetic 70.69 64.23 64.92 39.20 38.16

Macro-F1 (%)

Dataset MIRA-IndicLID AI4B-IndicLID GlotLID FastText OpenLID
Test-Set 95.15 - 74.80 60.84 59.27
FLORES 99.64 99.91 99.94 100.00 99.85
Sentiment 98.76 99.84 100.00 89.91 88.78
Sangraha 74.57 76.49 76.19 65.21 64.21
IndicLID-Full-Test 97.08 92.59 94.07 76.77 75.32
Comprehensive-Native 97.60 95.69 94.87 78.55 76.68
Comprehensive-Roman 79.95 40.19 34.03 0.16 0.00
Comprehensive-Mixed 100.00 25.00 68.75 0.00 0.00
Entire-Comprehensive 90.08 64.68 68.40 45.91 46.28
Groq-Synthetic 72.50 66.12 71.56 49.86 49.16

Timing Summary (Inference Time in Seconds)

Lower is better.

Dataset MIRA-IndicLID AI4B-IndicLID GlotLID FastText OpenLID
Test-Set 31.7 - 242.5 68.4 66.2
FLORES 0.1 0.0 0.4 0.2 0.2
Sentiment 0.2 0.1 1.0 0.3 0.3
Sangraha 9.6 237.9 117.0 24.8 23.6
IndicLID-Full-Test 8.2 4.8 36.5 18.2 17.7
Comp-Native 0.2 0.1 0.8 0.5 0.5
Comp-Roman 0.3 229.6 1.0 0.5 0.4
Comp-Mixed 0.0 1.1 0.0 0.0 0.0
Entire-Comprehensive 0.3 231.9 1.7 0.7 0.6
Groq-Synthetic 0.2 32.5 2.2 0.5 0.4

AI4B-IndicLID Comparison

The results show that while AI4B-IndicLID performs exceptionally well on standard datasets like FLORES and Sentiment, MIRA-IndicLID significantly outperforms it on Romanized and Mixed script tasks (Comp-Roman, Comp-Mixed, Groq-Synthetic).

Usage

Prerequisites

Install the required libraries:

pip install fasttext huggingface_hub

Inference Code

You can use the model with the fasttext library.

import fasttext
import os

# Path to our model binary
OUR_MODEL_PATH = "mira_indic_lid.ftz"  # Update with your local path
fasttext.FastText.eprint = lambda x: None # Suppress warnings

# Load Model
model = fasttext.load_model(OUR_MODEL_PATH)

# Experiment 1: Native Script
text = " किमिदं भवति!!!  😂 🤨🤨 सर्वं विचित्रम् दृश्यu"
labels, probs = model.predict(text, k=5, threshold=0.1) 
print(f"Prediction: {labels}, Probability: {probs}")

# Experiment 2: Romanized Text
text = " angni nwngni khobor ma? 😂😂 gwsw jwng nwngkhou!! !!"
labels, probs = model.predict(text, k=5, threshold=0.0) 
print("Text:", text)

# Print label and probability pairs
for l, p in zip(labels, probs):
    print(f"{l.replace('__label__',''):5s}  {p:.4f}")

Parameters for .predict():

  1. k: (int) Number of labels to return.
  2. threshold: (float) Minimum probability to return a label.

Authors

Developed by Team Project MIRA

Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support