bolo-tiny / README.md
kungfupanda12's picture
Bolo model v1
321799c verified
|
Raw History Blame Contribute Delete
3.16 kB
---
license: apache-2.0
language:
- hi
- en
pipeline_tag: token-classification
library_name: pytorch
tags:
- hinglish
- code-switching
- intent-classification
- slot-filling
- spoken-language-understanding
- on-device
- onnx
---
# Bolo Tiny: a 0.8 MB Hinglish command model
Bolo Tiny is the command-understanding model in [Bolo](https://github.com/Optimus2007/bolo), an offline Hinglish
voice-command assistant. It reads a command in Roman, Devanagari or mixed script and returns the intent plus slots
(folder, app, contact, level, and so on). There are 20 command types plus "none".
```
"bhai rust learning folder mein terminal kholo" -> {intent: open_terminal, folder: "rust learning"}
```
- **Built from scratch:** 0.69M parameters. A 2-layer transformer over *PhonoHash* features: hashed character n-grams
of the text, its transliteration, a phonetic key and a consonant skeleton. Spelling variants like *kholo / khol do /
खोलो* therefore land close together.
- **Size and speed:** 0.8 MB as int8 ONNX, about 1 ms on one CPU thread.
## Files
| File | What it is |
|---|---|
| `model.safetensors` (also `model.pt`, a plain state dict) + `config.json` + `threshold.json` | `phono_views_aug_asr-s0`, the default in Bolo. Trained on synthetic template text plus transcripts of TTS clips made by the speech model, so it has seen realistic speech-recognition errors |
| `onnx/bolo_tiny.int8.onnx`, `onnx/bolo_tiny.onnx` | ONNX export of the earlier text-only model `phono_views_aug-s0` (88.3% exact match, same as PyTorch) |
Loading uses the `bolo` package (`bolo.models.tiny`) from the GitHub repo, because the PhonoHash featuriser is part of
it:
```python
from bolo.pipeline import Bolo
bolo = Bolo.load(nlu_path="path/to/this/folder")
bolo.understand("volume 40 pe kar do") # {'intent': 'set_volume', 'slots': {'level': 40}, ...}
```
## Results
| | Synthetic test exact match | False actions | Size | Latency |
|---|---|---|---|---|
| Hand-written rules | 84.9 | 18.7% | – | 0.01 ms |
| **Bolo Tiny** (3 seeds) | **87.4** | **5.2%** | **0.8 MB** | about 1 ms |
| MuRIL-base fine-tuned | 91.6 | 3.6% | 950 MB | 15.6 ms |
With grounding (checking that the folder or app exists on the machine), Bolo Tiny gets 95.8% vs MuRIL's 96.4%, at
about 1/1000 of the size. Real-speech results are on the [Bolo Sun](https://huggingface.co/kungfupanda12/bolo-sun) card;
they come from one speaker so far.
**Ablations, including what failed:**
- PhonoHash: +5.0
- data augmentation: +6.4
- multi-script views: +2.5
- a cross-script consistency loss: **−1.4**
- distillation from MuRIL: **−4.0**
Full details are in [WHAT_WE_TRIED.md](https://github.com/Optimus2007/bolo/blob/main/docs/WHAT_WE_TRIED.md). Every seed
and ablation checkpoint is on the [GitHub release](https://github.com/Optimus2007/bolo/releases/tag/weights-v1).
**Known weaknesses:**
- Confident mistakes on near-miss phrasings ("naya folder banao").
- "kuch bhi random baat" is read as calling a contact named "random".
- All training text is synthetic.
## License
Apache-2.0. Training text came from our own templates; no LLM-generated data is included in this model.