Instructions to use AneekC/lid-specialists-9plus1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- fastText
How to use AneekC/lid-specialists-9plus1 with fastText:
from huggingface_hub import hf_hub_download import fasttext model = fasttext.load_model(hf_hub_download("AneekC/lid-specialists-9plus1", "model.bin")) - Notebooks
- Google Colab
- Kaggle
Language-ID specialists for nine languages plus other
Three small models that decide inside confusion groups where a general language identifier is weakest: Malay vs Indonesian, Simplified vs Traditional Chinese, and romanized Hindi vs romanized Urdu vs English. They are stage 2 of a two-stage detector; stage 1 is GlotLID (Apache-2.0), which is not redistributed here.
Trained for a multilingual retrieval application, where misreading the question's language sends the whole answer to the wrong knowledge base.
The three models
| File | Size on disk | What it is |
|---|---|---|
lid-specialist-fasttext.ftz |
1.9 MB | fastText classifier, quantized |
lid-specialist-e5-head.onnx |
818 KB | linear head over frozen e5 embeddings |
lid-specialist-e5-finetune.onnx |
471.6 MB | multilingual-e5-small fine-tuned end to end |
The 818 KB head is not an 818 KB model. It needs
intfloat/multilingual-e5-small to produce embeddings first, so its real footprint is
about 471 MB. Only the fastText model is genuinely small.
Labels (12)
eng_Latn, ind_Latn, zsm_Latn, zho_Hans, zho_Hant, jpn_Jpan, kor_Hang,
tam_Taml, hin_Deva, hin_Latn, urd_Latn, other
Every language outside the nine supported ones is other.
Results
FLORES-200 devtest, specialist label space. Measured in this project; the generated table
lives in training/RESULTS.md in the source repository.
| Detector | Macro-F1 | Group macro-F1 | malay_indonesian | han | romanized_hindi | other F1 |
Sentences/s |
|---|---|---|---|---|---|---|---|
| GlotLID (full) | 0.939 | 0.894 | 0.924 | 0.816 | 0.992 | 0.997 | 1538 |
| GlotLID (compressed) | 0.943 | 0.900 | 0.938 | 0.815 | 0.992 | 0.997 | 1257 |
lid.176 |
0.632 | 0.451 | 0.261 | 0.806 | 0.120 | 0.922 | 19045 |
| specialist-fasttext | 0.882 | 0.864 | 0.857 | 0.828 | 0.949 | 0.992 | 14577 |
| two-stage + fasttext | 0.941 | 0.896 | 0.923 | 0.822 | 0.993 | 0.997 | 1119 |
| specialist-e5-head | 0.653 | 0.656 | 0.410 | 0.810 | 0.841 | 0.923 | 22 |
| two-stage + e5-head | 0.936 | 0.887 | 0.900 | 0.823 | 0.992 | 0.997 | 288 |
| specialist-e5-finetune | 0.925 | 0.897 | 0.911 | 0.833 | 0.995 | 0.994 | 26 |
| two-stage + e5-finetune | 0.942 | 0.899 | 0.923 | 0.827 | 0.994 | 0.997 | 328 |
Read this honestly: the specialists are not better than GlotLID on their own. Used
alone, specialist-e5-head scores 0.653 against GlotLID's 0.939. The gain is in the
two-stage arrangement, and it is small — 0.942 against 0.939 overall, with the group
macro-F1 moving 0.894 to 0.899. What the specialists buy is the confusion groups: the
han column goes 0.816 to 0.827, and romanized_hindi 0.992 to 0.994.
The strongest practical result is speed. specialist-fasttext reaches 0.882 macro-F1 at
14,577 sentences/s in 1.9 MB, against GlotLID's 0.939 at 1,538 sentences/s in 1.69 GB.
By input shape
Macro-F1 per slice, plus latency.
| Detector | FLORES sentence | 1-3 words | paragraph | code-mixed | Dakshina sentence | Dakshina words | p50 ms | p95 ms |
|---|---|---|---|---|---|---|---|---|
| GlotLID (full) | 0.974 | 0.762 | 0.983 | 0.550 | 0.938 | 0.142 | 0.64 | 0.89 |
lid.176 |
0.817 | 0.740 | 0.889 | 0.361 | 0.001 | 0.003 | 0.06 | 0.13 |
| specialist-fasttext | 0.963 | 0.837 | 0.997 | 0.683 | 0.848 | 0.579 | 0.05 | 0.14 |
| specialist-e5-finetune | 0.964 | 0.856 | 0.962 | 0.739 | 0.934 | 0.675 | 82.00 | 138.28 |
Short and code-mixed input is where the specialists earn their place: on single words from
Dakshina, GlotLID scores 0.142 and lid.176 scores 0.003, while the fine-tuned model
reaches 0.675.
Training data
Not redistributed. The full record is training/data/DATACARD.md in the source repository.
| Source | Licence | Used for |
|---|---|---|
OpenLID, revision 67b9a87a9f52, 7 of 44 shards |
other: varies by source dataset | natural lines for the nine labels and other |
| Dakshina v1.0 | CC BY-SA 4.0 | romanized Hindi and Urdu (test files held out) |
| FLORES-200 | CC BY-SA 4.0 | contamination check only |
360,000 training rows and 24,000 validation rows, capped at 100,000 lines per label. Cleaning normalizes (NFKC), strips invisible characters, collapses whitespace, and drops lines under two characters and exact duplicates. Synthetic rows: OpenCC Simplified/ Traditional conversions, 1-3 word crops from 10% of natural lines, and code-mixed rows equal to 2% of natural lines.
Contamination: 7,543 training lines were removed for matching a FLORES-200 dev/devtest sentence or a Dakshina test item. The final check found 0 rows overlapping any held-out line across every split.
Training setup
lid-specialist-e5-finetune: learning rate 3e-05, batch size 32, max length 128, 2 epochs
maximum, 6% warmup, weight decay 0.01, dropout 0.1, seed 20260915. About 36 minutes on an
RTX 5060 Laptop GPU (torch 2.14.0+cu130, bf16). ONNX export agrees with the PyTorch model
to 3.8e-06 maximum absolute difference.
Inputs use the e5 convention: prefix query: , max length 128.
Limitations
- OpenCC conversions do not read like natively written Simplified or Traditional Chinese.
- 1-3 word crops are cut from sentences, not collected from real queries.
- Code-mixed rows are two whole sentences joined, labelled by the longer part. Real code-mixing happens inside a sentence.
- The contamination check matches whole lines after normalization, so a held-out sentence embedded inside a longer line is not caught.
- For
hin_Latn,urd_Latn,zho_Hansandzho_Hantthe test split is a hash split from the same sources as training, not source-disjoint. Those scores are likely optimistic against text from new sources. - Romanized Hindi and Urdu come from one source (Dakshina: Wikipedia sentences romanized by annotators), so they do not represent romanization as people type it.
- Anything outside the nine languages is only ever
other. This is not a general-purpose language identifier; use GlotLID for that.
Licences
Weights are MIT, matching the source repository's code. They are derived from
intfloat/multilingual-e5-small (MIT) and trained on the data above; OpenLID's licence is
listed as "other" and varies by source corpus, and the underlying data is not redistributed
here.
Citation
Comparison figures in the source repository's results come from:
- Kargaran et al. 2023, GlotLID: Language Identification for Low-Resource Languages (arXiv:2310.16248)
- Burchell et al. 2023, An Open Dataset and Model for Language Identification (arXiv:2305.13820)
Those figures come from the papers' own model versions and label mappings. They are context, not a reproduction.
- Downloads last month
- -
Model tree for AneekC/lid-specialists-9plus1
Base model
intfloat/multilingual-e5-small