Instructions to use CobuildX-AI/cbx-indim-intent-classifier-32M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use CobuildX-AI/cbx-indim-intent-classifier-32M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="CobuildX-AI/cbx-indim-intent-classifier-32M")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("CobuildX-AI/cbx-indim-intent-classifier-32M", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download README.md from CobuildX-AI/cbx-indim-intent-classifier-32M: direct link, hf CLI and curl.
- Browser
- Download file 5.84 kB
-
https://huggingface.co/CobuildX-AI/cbx-indim-intent-classifier-32M/resolve/main/README.md
- Command line
-
hf download hf://CobuildX-AI/cbx-indim-intent-classifier-32M/README.md
-
curl -L -o README.md https://huggingface.co/CobuildX-AI/cbx-indim-intent-classifier-32M/resolve/main/README.md
license: apache-2.0
library_name: transformers
pipeline_tag: text-classification
base_model: CobuildX-AI/InDIM-small
language:
- hi
- bn
- ta
- te
- kn
- ml
- ur
datasets:
- AmazonScience/massive
tags:
- intent-classification
- indic
- multilingual
- text-classification
- onnx
cbx-indim-intent-classifier-32M
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.
Usage
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 میرے کیلنڈر میں کل کی میٹنگ دکھاؤ
Labels
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.
Results
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 |
- This repository holds the training run with the best validation score: test accuracy 85.25, macro F1 82.83.
- InDIM-small matches mmBERT-base at a tenth of its size and is 1.0 point above mmBERT-small, in every language. IndicBERT v2 is 1.2 points higher at 9× the size.
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.
Input
- One request. The model reads at most 96 tokens; longer text is cut (
"truncated": True). - MASSIVE requests are professionally translated from English and written in native script. Romanized or code-mixed requests ("kal subah 7 baje ka alarm laga do") were not in training and will be less accurate.
Limitations
- Domain: the 60 intents are those of a voice assistant (alarms, music, smart home, calendar, …). Requests outside them still get one of the 60 labels; there is no "other" class. Check the top score and route low-confidence requests elsewhere.
- Translated data: MASSIVE text is translated from English, so it can differ from how people actually phrase requests in these languages.
- Languages: only the 7 languages above were trained and tested.
Intended use and disclaimer
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.
Training
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).
Citation
If you use this model, please cite InDIM-small (32M).
Licence
Apache-2.0 (see LICENSE). Training and test data: MASSIVE (FitzGerald et al., 2022), CC BY 4.0; see NOTICE.
Questions: hello@cobuildx.ai.