Instructions to use CobuildX-AI/InDIM-small with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use CobuildX-AI/InDIM-small with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("fill-mask", model="CobuildX-AI/InDIM-small", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForMaskedLM model = AutoModelForMaskedLM.from_pretrained("CobuildX-AI/InDIM-small", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
InDIM-small (32M)
InDIM (Indic Decision Intelligence Models) are compact encoders for Indian languages. InDIM-small has 32M parameters and covers 12 Indian languages and English: Assamese, Bengali, Gujarati, Hindi, Kannada, Malayalam, Marathi, Odia, Punjabi, Tamil, Telugu, Urdu and English. It reads native script, romanized text (Hindi, Tamil, β¦ in Latin letters) and code-mixed text.
It is a base model: fine-tune it for classification, token tagging (NER, PII) or retrieval. On our fine-tuned tasks it beats mmBERT-small (140M) on 12 of 15 benchmarks at about a quarter of the size, runs about 3Γ faster on CPU and keeps its outputs under int8 quantisation.
| Parameters | 31.5M encoder (+0.3M masked-LM head) |
| Architecture | ModernBERT encoder: 12 layers, hidden 384, FFN 576, 6 heads, RoPE, global attention every third layer and 128-token local attention in the others |
| Vocabulary | 128,064-piece Unigram tokenizer for Indic + English; factorized 128-dim word embedding, tied with the output layer |
| Pretraining length | 512 tokens (longer inputs work; see the PII results below) |
| Precision | fp32 weights; fp16 inference is exact; int8 friendly (see Precision) |
Usage
The factorized embedding needs the model code in this repository (trust_remote_code=True).
from transformers import AutoTokenizer, AutoModel, AutoModelForMaskedLM, pipeline
tok = AutoTokenizer.from_pretrained("CobuildX-AI/InDIM-small", trust_remote_code=True)
mlm = AutoModelForMaskedLM.from_pretrained("CobuildX-AI/InDIM-small", trust_remote_code=True)
fill = pipeline("fill-mask", model=mlm, tokenizer=tok)
fill("ΰ€ΰ€Ύΰ€°ΰ€€ ΰ€ΰ₯ ΰ€°ΰ€Ύΰ€ΰ€§ΰ€Ύΰ€¨ΰ₯ [MASK] ΰ€Ήΰ₯ΰ₯€") # top prediction: "ΰ€¦ΰ€Ώΰ€²ΰ₯ΰ€²ΰ₯"
encoder = AutoModel.from_pretrained("CobuildX-AI/InDIM-small", trust_remote_code=True)
Fine-tuning: AutoModelForSequenceClassification and AutoModelForTokenClassification load the stock ModernBERT
heads on top (classifier_pooling "cls" or "mean"). Learning rates of 2e-4 to 8e-4 worked best for our tasks (higher
than for larger models).
ONNX: onnx/model.onnx (fp32) and onnx/model_int8.onnx (dynamic int8) take input_ids and attention_mask
[batch, length] and return the last hidden state.
Results
All fine-tuned numbers use the same recipe for every model within a task (plain fine-tuning, no distillation), a learning rate picked per model on validation, and the mean of 3 training runs unless marked. Higher is better unless marked.
Fine-tuned tasks: InDIM-small vs mmBERT-small
| Task | Test set | Metric | InDIM-small (32M) | mmBERT-small (140M) |
|---|---|---|---|---|
| Intent (60 intents, 7 languages) | MASSIVE test | accuracy | 85.2 | 84.2 |
| Sentiment | IndicSentiment (13 languages, human labels) | accuracy | 0.822 | 0.839 |
| Sentiment | Telugu / English / romanized Hindi sources, human labels | macro F1 | 0.512 | 0.508 |
| Slot filling (55 slot types) | MASSIVE test | span F1 | 0.700 | 0.680 |
| PII (27 types) | our synthetic test | span F1 | 0.992 | 0.993 |
| PII | Ylemis India-PII (independent) | typed F1 | 0.989 | 0.987 |
| PII | IndiaPII-Bench (independent) | typed F1 | 0.960 | 0.950 |
| PII | IndicPIIDetX test, 14 shared types | typed F1 | 0.950 | 0.930 |
| PII | IndicPIIDetX test, all 27 types | typed F1 | 0.906 | 0.894 |
| Profanity / abuse (5 labels) | gold set (3,980 held-out texts, LLM-labelled) | macro F1 | 0.703 | 0.725 |
| Hate | Hindi HateCheck | PR-AUC | 0.749 | 0.742 |
| Causal reasoning (trained on English only) | IndicCOPA, 18 languages | accuracy, 1 run | 0.533 | 0.530 |
| Paraphrase (trained on English only) | IndicXParaphrase, 10 languages | accuracy, 1 run | 0.571 | 0.561 |
| Named entities | Naamapadam, 11 languages | entity F1, 1 run | 0.704 | 0.671 |
- Where InDIM-small is weaker: sentiment on IndicSentiment (β0.017), profanity / insult detection (β0.022 macro F1) and transfer from English-only training (COPA and paraphrase are close to chance, 0.50, for both models). English is its weakest language.
- PII on long text: on our PII test, rows longer than 512 tokens score 0.996 against 0.991 for shorter rows, so the model works beyond its pretraining length.
- Fine-tuned models built on InDIM-small, each compared with mmBERT-small, mmBERT-base and IndicBERT v2: intent, sentiment, PII, profanity.
Without fine-tuning
Masked-word prediction (whole-word pseudo-log-likelihood, bits per character; lower is better). Held-out text, but from the same kinds of sources as InDIM-small's pretraining data, which favours InDIM-small: read it as a check of script and register coverage, not as a fair language-modelling comparison.
| Text | InDIM-small | mmBERT-small |
|---|---|---|
| All Indic (macro) | 1.571 | 2.314 |
| Native script | 1.263 | 1.737 |
| Romanized (natural) | 1.856 | 3.051 |
| Romanized (transliterated) | 1.410 | 2.907 |
| Code-mixed | 2.146 | 2.377 |
| English | 0.986 | 0.731 |
Cross-lingual retrieval (FLORES devtest, English β language, mean-pooled embeddings, accuracy@1, macro over 12 languages; "centered" subtracts each language's mean embedding):
| InDIM-small | mmBERT-small | |
|---|---|---|
| English β native script, centered | 0.502 | 0.248 |
| Native script β English, centered | 0.513 | 0.228 |
| English β romanized (transliterated), centered | 0.345 | 0.077 |
| English β native script, raw | 0.133 | 0.070 |
The raw embeddings are not aligned across languages (no sentence-level training); fine-tune for retrieval.
Efficiency
CPU latency (Intel i7-10700, batch 1, median ms, encoder only, PyTorch fp32) at 64 / 128 / 512 tokens:
| Parameters | 8 threads | 1 thread | |
|---|---|---|---|
| InDIM-small | 31.5M | 8 / 12 / 37 | 22 / 40 / 183 |
| mmBERT-small | 140.5M | 20 / 30 / 99 | 64 / 117 / 494 |
The tokenizer also uses fewer tokens for Indic text than mmBERT's (for example 25 against 36 tokens for a mixed Hindi / romanized sentence), so real texts are shorter sequences as well.
Precision
- fp16: exact. Masked-token predictions agree 99.3% with fp32 (the rest are near-ties) and no value overflows. Fine-tuned InDIM-small models give the same labels in fp16 as in fp32.
- int8 (dynamic, per-channel): the encoder's last hidden state keeps a cosine similarity of 0.999 with fp32 in PyTorch and 0.998 in ONNX Runtime; mmBERT-small keeps 0.886 / 0.037. Masked-LM loss rises by 0.11 nats. For fine-tuned classifiers, int8 changes 3β7% of decisions in our tests, so measure on your task before deploying int8.
Limitations
- 32M parameters is small: on harder tasks (sentiment, abuse detection) larger models such as mmBERT-base or IndicBERT v2 score higher. Choose InDIM-small when speed, memory or CPU cost matters.
- English is its weakest language, and transfer from English-only training data to Indian languages is weak. Fine-tune on data in the languages you need.
- Coverage is uneven: Odia and Assamese have less pretraining text than Hindi, Bengali or Tamil; romanized and code-mixed text is covered for the main languages, but natural romanized text exists for fewer languages than native script.
- It is a masked-language encoder: it does not generate text, and it does not know facts reliably.
- Biases in web text can carry over into the model and into models fine-tuned from it.
Intended use and disclaimer
Intended use: a base for fine-tuning classifiers, taggers and retrieval models for Indian-language text, especially where models must run on CPU or at low cost. Not intended for decisions about individual people (hiring, credit, moderation penalties, surveillance) without evaluation on your data and a person reviewing each case. The model is provided "as is", without warranties of any kind; Cobuild Tech Private Limited is not liable for its use. You are responsible for checking that it suits your data and for complying with the laws that apply to your use.
Citation
If you use InDIM models, please cite:
@misc{indim2026,
title = {InDIM: Compact Encoders for Indian Languages},
author = {{Sudalai Rajkumar} and {Sairaam Varadarajan}},
organization = {CobuildX AI},
year = {2026},
version = {0.1},
publisher = {Hugging Face},
howpublished = {\url{https://huggingface.co/CobuildX-AI/InDIM-small}},
doi = {10.57967/hf/11878}
}
Licence
Apache-2.0 (see LICENSE). InDIM-small was initialised from mmBERT-small (MIT); see NOTICE.
Questions: hello@cobuildx.ai.
- Downloads last month
- -