An intent classifier for voice-assistant style requests in 7 Indian languages: Hindi, Bengali, Tamil, Telugu,
Kannada, Malayalam and Urdu. Give it a short request ("set an alarm for seven tomorrow morning") and it returns one of
the 60 MASSIVE intents (alarm_set). It is
InDIM-small (32M) fine-tuned on MASSIVE, and runs in a few
milliseconds on a CPU.
from cbx_intent import IntentClassifier # cbx_intent.py is in this repository
clf = IntentClassifier(".") # folder with the model files; CPU or GPU
clf.classify("कल सुबह सात बजे का अलार्म लगा दो")
# {"label": "alarm_set", "scores": {...}, "truncated": False}
classify takes one text or a list. python example.py runs seven examples, one per language;
python onnx_example.py runs the same model with ONNX Runtime (onnx/model.onnx, fp32, same decisions as PyTorch
on 1,000 of 1,000 test texts).
Example output:
alarm_set 1.00 कल सुबह सात बजे का अलार्म लगा दो
weather_query 1.00 আজ কলকাতার আবহাওয়া কেমন থাকবে
email_sendemail 1.00 அம்மாவுக்கு ஒரு மின்னஞ்சல் அனுப்பு
music_query 1.00 ఈ పాట ఎవరు పాడారు
iot_hue_lightoff 0.99 ಲೈಟ್ ಆಫ್ ಮಾಡು
news_query 1.00 ഇന്നത്തെ വാർത്തകൾ വായിക്കൂ
calendar_query 1.00 میرے کیلنڈر میں کل کی میٹنگ دکھاؤ
60 intents from MASSIVE, grouped by scenario: alarm_*, audio_volume_*, calendar_*, cooking_*, datetime_*,
email_*, general_*, iot_*, lists_*, music_*, news_query, play_*, qa_*, recommendation_*, social_*,
takeaway_*, transport_*, weather_query. The full list is in cbx_config.json.
MASSIVE test set, 20,818 requests (2,974 per language), one model for all 7 languages. Every model was fine-tuned with the same recipe and data (plain fine-tuning, learning rate picked on validation); mean of 3 training runs ± SD unless marked.
| Model | Parameters | Accuracy | Macro F1 | bn | hi | kn | ml | ta | te | ur |
|---|---|---|---|---|---|---|---|---|---|---|
| InDIM-small (this model's base) | 32M | 85.2 ± 0.1 | 82.3 | 85.9 | 86.1 | 85.1 | 85.2 | 84.3 | 84.5 | 85.4 |
| mmBERT-small | 140M | 84.2 ± 0.0 | 81.2 | 84.3 | 85.3 | 83.7 | 84.5 | 83.2 | 83.8 | 84.4 |
| mmBERT-base | 307M | 85.0 ± 0.2 | 82.1 | 84.7 | 86.9 | 84.1 | 85.2 | 84.2 | 84.7 | 85.6 |
| IndicBERT v2 | 278M | 86.4 ± 0.1 | 83.5 | 87.0 | 87.7 | 85.9 | 86.7 | 85.4 | 86.3 | 85.9 |
CPU latency (Intel i7-10700, 8 threads, one request at a time, PyTorch fp32): 5.6 ms for a 12-token request, 12.9 ms for a long (about 60-word) input. For comparison, the mmBERT-small and mmBERT-base classifiers took about 2.5× and 5× as long as InDIM-small on the same machine (4 threads, one sentence).
Precision: fp16 gives the same accuracy as fp32. Dynamic int8 (PyTorch, per-channel) loses 0.3 points of accuracy; ONNX int8 changed 3% of decisions in our test, so only the fp32 ONNX file is provided.
"truncated": True).Intended use: routing short user requests in Indian languages to the right handler, for example in a voice or chat assistant, where errors can be corrected by the user or a fallback. Not intended for decisions about individual people without a person reviewing each case. The model makes mistakes. It 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.
InDIM-small (32M) fine-tuned on the MASSIVE training split of the same 7 languages (plain fine-tuning, cross-entropy, 10 epochs with early stopping on validation, learning rate 4e-4).
If you use this model, please cite InDIM-small (32M).
Apache-2.0 (see LICENSE). Training and test data: MASSIVE (FitzGerald et al., 2022), CC BY 4.0; see NOTICE.
Questions: hello@cobuildx.ai.
onnx/model.onnx 126 MBmodel.safetensors 126 MBCobuildX-AI/InDIM-small