/ Модель

Характеристики

Лицензия
Apache 2.0
Библиотека
pytorch
Опубликована
7 окт 2026

millid-tiny-v1.5

Классификация текстаТекст → label7 профессий

Компактная модель Baobab Tech определяет язык и письменность коротких или длинных фрагментов текста, поддерживая 1 641 метку.

116скачиваний за 30 дней1лайквеса обновлены14 окт 2026

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

MillID tiny v1.5 — компактная модель Baobab Tech для определения языка текста. Она относит фрагмент от содержимого ячейки таблицы до абзаца к одной из 1 641 меток языка и письменности: 1 550 языков в 56 письменностях и 37 меток для письменности, язык которой определить не удалось. Модель содержит 2,9 млн параметров; в её архитектуре используются эмбеддинги, свёрточный начальный блок и блоки Transformer. Репозиторий включает форматы safetensors и ONNX, а модель рассчитана в том числе на запуск на CPU и в браузере.

MillID предназначена для маршрутизации документов к подходящим OCR-, переводческим и языковым системам, сортировки корпусов по языкам, анализа языкового состава коллекций и локального распознавания языка на устройстве. Для каждого фрагмента выдаётся одна метка, поэтому смешанный текст может быть классифицирован неточно; для длинного документа README упоминает сегментированное определение языка.

Качество зависит от языка и объёма данных: близкие языки и некоторые малоресурсные языки распознаются хуже, а текст без языка или текст, представленный нестандартной кодировкой письма, может получить ошибочную метку. Обучающие данные частично размечены GlotLID, поэтому модель могла усвоить ошибки разметки; жанровый перекос данных также способен влиять на результат. Лицензия — Apache 2.0.

Сценарии применения

  • определение языка текста для выбора OCR или переводчика
  • сортировка веб- и PDF-корпусов по языкам
  • оценка языкового состава коллекции документов
  • локальное распознавание языка на телефоне или в браузере
  • выявление языка коротких фрагментов, включая текст ячеек таблиц

Ограничения

Точность ниже для близких и некоторых малоресурсных языков; смешанный текст получает только одну метку, а для текста без языка отдельного класса нет. Данные обучения частично размечены другой моделью и могут содержать её ошибки и жанровые перекосы.

Для каких профессий подходит7

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Также подходит для

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

MillID tiny v1.5

MillID (MultiLingual Language IDentifier) is an open language identification model built by Baobab Tech. It names the language of a passage of text, from a table cell to a paragraph, among 1,641 language-script labels: 1,550 languages written in 56 scripts, and 37 labels for text in a script whose language it cannot name (und_<Script>). MillID tiny v1.5 has 2.9M parameters and an ONNX file of 11 MB.

Small enough to run on a CPU, a phone or in a web page (491 passages a second on four Arm cores, 48 a second on one laptop thread), it identifies language where the text is, with no server and no GPU.

MillID offers:

  • Language and script: labels are ISO 639-3 plus ISO 15924 script, so Serbian in Cyrillic (srp_Cyrl) and in Latin (srp_Latn) are told apart. Many of the languages are low-resource, with a few hundred passages each to learn from.
  • No tokenizer: it reads UTF-8 bytes, each with its Unicode script and the character n-grams ending there, so any script is input it can read and nothing is an unknown token.
  • Short text: a quarter of its training passages were cut to 20 to 80 characters, the length of a heading or a table cell, where language identification is hardest.
  • Whole documents: identify_document reads text of any length in windows and returns the document's languages and the segments of each.
  • No server, no PyTorch: one ONNX file and a small encoder, in Python (NumPy) or JavaScript (Node and browsers); the two are tested to give the same answers.
  • Three sizes, one label set: tiny v1.5, medium v1 and large v1.5 share their labels, so changing size changes no code.

Model overview

ParametersTotal2.9M
Embeddings935K
Convolution stem38K
Transformer blocks1.3M
Language head625K
ArchitectureBlocks3
Model dimension192
Attention heads3
Bytes per token1
N-gram buckets4,096
NormalisationRMSNorm, pre-norm
PositionsRoPE
Feed-forwardSwiGLU
PoolingMasked mean
Input and outputInputUTF-8 bytes, NFKC
Passage lengthUp to 255 bytes
Labels1,641
RuntimeONNX (11 MB)

Benchmark results

MillID was evaluated on two test sets: test, passages from documents never seen in training, split from the training data by document; and UDHR-LID (udhr), the Universal Declaration of Human Rights labelled by its translators. It is compared with GlotLID and Meta's fastText language identifier (NLLB, 218 labels), each restricted to MillID's labels, its best answer among them: the like-for-like comparison.

Overall results

SetLanguagesMetricMillIDGlotLIDfastText
test1,621Macro F10.95540.97550.0659
Top-10.95870.97830.2515
test-common213Macro F10.95130.98460.9173
Top-10.93960.97490.9352
udhr358Macro F10.87640.88730.3499
Top-10.84920.86140.4629
udhr-common170Macro F10.95130.96590.9329
Top-10.91230.93380.9195
udhr-all429Macro F10.71490.72450.2797
Top-10.72740.73780.3964
  • test: every language, 1,621 of them. test-common: the languages all three systems know, the head-to-head on equal terms, since fastText cannot answer most of MillID's.
  • udhr: the Declaration in the languages MillID knows. udhr-common: in the languages all three know. udhr-all: in every language it has, MillID's unknown ones counted wrong.
  • GlotLID's labels came from training on data that includes UDHR, and it labelled the FinePDFs and FineWeb-2 passages in test, so its scores are optimistic on both.

The three MillID models

Macro F1 on test and udhr; this model in bold. All three, language by language, are on the leaderboard.

ModelParametersONNXTest F1UDHR F1Runs on
MillID tiny v1.52.9M11 MB0.95540.8764CPU, web page
MillID medium v1115M455 MB0.95760.8780GPU
MillID large v1.5193M764 MB0.96460.8812GPU

By passage length

Top-1 accuracy on passages of 20 to 80 characters (short), up to 300 (sentence) and up to 1,000 (paragraph):

SetSystemShortSentenceParagraph
validationMillID0.93120.97880.9850
testMillID0.93330.97970.9833
testGlotLID0.96740.98580.9912
testfastText0.27640.25060.1959
test-commonMillID0.91250.96850.9725
test-commonGlotLID0.96090.98850.9949
test-commonfastText0.91250.95810.9655

MillID on each set

SetTop-1Top-3Top-5Macro PMacro RMacro F1Median F1
validation0.95780.98890.99330.95390.95910.95510.9822
test0.95870.98900.99320.95500.95880.95540.9825
test-common0.93960.98570.99090.97090.93530.95130.9726
udhr0.84920.91170.92570.91480.87360.87640.9907
udhr-common0.91230.96060.96550.97940.93930.95131.0000
udhr-all0.72740.78090.79280.73400.72900.71490.9649

Per language: test

F1 language by language, GlotLID and fastText restricted to MillID's labels: against GlotLID, MillID is better on 103 languages, worse on 869 and within 0.01 on 649; against fastText, MillID is better on 1616 languages, worse on 0 and within 0.01 on 5. Every language, with precision, recall and the unrestricted scores, is in reports/test/leaderboard.csv.

The 20 languages with the most passages:

LabelLanguagePassagesMillIDGlotLIDfastText
fra_LatnFrench16520.9290.9280.808
eng_LatnEnglish14440.9170.8590.648
spa_LatnSpanish11360.9300.9510.574
tam_TamlTamil7540.9970.9930.965
arb_ArabArabic (Modern Standard)7450.8140.7850.512
por_LatnPortuguese6570.9470.9490.755
kan_KndaKannada6010.9690.9930.922
zul_LatnZulu5940.8460.8960.539
swh_LatnSwahili5920.8480.9160.346
mar_DevaMarathi5890.9650.9900.926
tso_LatnTsonga5810.9650.9560.425
hun_LatnHungarian5760.9870.9990.232
afr_LatnAfrikaans5690.9670.9850.860
tel_TeluTelugu5550.9910.9940.951
rus_CyrlRussian5280.9320.9490.462
nbl_LatnSouth Ndebele5280.9030.9490.000
ory_OryaOdia (individual language)5110.9880.9940.976
sot_LatnSouthern Sotho4910.9660.9780.660
nso_LatnNorthern Sotho4790.9560.9690.914
kua_LatnKuanyama4760.9620.9860.000

Where MillID gains most over GlotLID:

LabelLanguagePassagesMillIDGlotLIDfastText
lbj_TibtLadakhi660.9430.0000.000
ain_LatnAinu10.6670.0000.000
ajp_ArabSouth Levantine Arabic280.9460.5810.000
und_Laoound200.9230.6210.000
und_Thaaund290.8810.6510.000
sgh_CyrlShughni90.8570.6670.000
und_Georund320.8770.6940.000
tuk_ArabTurkmen1350.9050.7610.000
und_Syrcund430.9660.8220.000
gmh_LatnMiddle High German1770.9220.7860.000
orv_CyrlOld Russian2390.9310.8000.000
und_Kanaund1360.9820.8620.000
und_Yiiiund381.0000.8840.000
neb_LatnToura (Côte d'Ivoire)110.9570.8420.000
dag_LatnDagbani1490.7670.6600.000

Where MillID loses most to GlotLID:

LabelLanguagePassagesMillIDGlotLIDfastText
mus_LatnMuscogee20.3331.0000.000
ttj_LatnTooro280.4850.9460.000
mbd_LatnDibabawon Manobo140.5961.0000.000
knc_ArabCentral Kanuri680.4620.8250.007
biu_LatnBiete70.6671.0000.000
dks_LatnSoutheastern Dinka30.6671.0000.000
esi_LatnNorth Alaskan Inupiatun90.4550.7830.000
hrv_LatnCroatian1680.6220.9440.178
plw_LatnBrooke's Point Palawano80.7271.0000.000
bos_LatnBosnian1980.6490.9020.181
xbr_LatnKambera80.7501.0000.000
nyf_LatnGiryama100.6450.8700.000
ldi_LatnLaari620.7770.9920.000
hak_HaniHakka Chinese290.6210.8240.000
ccp_LatnChakma30.8001.0000.000

Per language: udhr

F1 language by language, GlotLID and fastText restricted to MillID's labels: against GlotLID, MillID is better on 52 languages, worse on 105 and within 0.01 on 201; against fastText, MillID is better on 303 languages, worse on 15 and within 0.01 on 40. Every language, with precision, recall and the unrestricted scores, is in reports/udhr/leaderboard.csv.

The 20 languages with the most passages:

LabelLanguagePassagesMillIDGlotLIDfastText
roh_LatnRomansh3990.9940.9990.946
oci_LatnOccitan3980.2770.3760.435
cmn_HaniChinese (Mandarin)3190.8920.8680.468
krl_LatnKarelian1830.0000.0110.000
qug_LatnChimborazo Highland Quichua1820.0110.0000.000
acu_LatnAchuar-Shiwiar1800.8280.8540.000
hus_LatnHuastec1750.9770.9860.000
hau_LatnHausa1550.9901.0000.876
auc_LatnWaorani1540.0000.0000.000
kwi_LatnAwa-Cuaiquer1450.8800.8770.000
jpn_JpanJapanese1401.0001.0000.944
snn_LatnSiona1360.6300.5140.000
ktu_LatnKituba (Democratic Republic of Congo)1180.7650.6800.000
lat_LatnLatin1180.9960.9920.000
hat_LatnHaitian Creole1170.9920.9790.699
nya_LatnNyanja1160.9911.0000.806
kmb_LatnKimbundu1160.9701.0000.877
rmn_LatnBalkan Romani1160.6780.8570.000
twi_LatnTwi1160.9830.9960.396
chr_CherCherokee1150.6700.6630.000

Where MillID gains most over GlotLID:

LabelLanguagePassagesMillIDGlotLIDfastText
mic_LatnMi'kmaw590.9920.4270.000
tet_LatnTetum580.6380.1670.000
fuf_LatnPular580.9060.4830.000
sag_LatnSango590.9920.5780.189
skr_ArabSaraiki630.8670.5000.000
qvh_LatnHuamalíes-Dos de Mayo Huánuco Quechua580.4680.1540.000
zgh_TfngStandard Moroccan Tamazight600.7500.4620.000
lld_LatnLadin590.9090.7310.000
tah_LatnTahitian570.9730.8120.966
yue_HaniCantonese490.7340.5800.111
ote_LatnMezquital Otomi590.1540.0000.000
pnb_ArabWestern Panjabi610.8820.7390.000
mxv_LatnMetlatónoc Mixtec580.1290.0000.000
lij_LatnLigurian580.9830.8590.487
bum_LatnBulu580.2150.0980.000

Where MillID loses most to GlotLID:

LabelLanguagePassagesMillIDGlotLIDfastText
gyr_LatnGuarayu490.5370.9900.000
shp_LatnShipibo-Conibo620.4690.9120.000
dyu_LatnDyula580.0000.4340.015
tbz_LatnDitammari600.0000.3780.000
cbu_LatnCandoshi-Shapra570.5000.8740.000
idu_LatnIdoma510.6030.9380.000
ell_GrekGreek1150.6701.0001.000
qvc_LatnCajamarca Quechua580.6480.9060.000
cpu_LatnPichis Ashéninka600.7290.9740.000
qvn_LatnNorth Junín Quechua570.2190.4600.000
hin_DevaHindi590.7230.9570.975
hrv_LatnCroatian580.5000.7270.474
kbp_LatnKabiyè590.7811.0000.389
cni_LatnAsháninka520.7730.9630.000
rmn_LatnBalkan Romani1160.6780.8570.000

Precision, recall (sensitivity), F1 and specificity for every language and system, restricted and as it is, are in reports/<set>/, and the totals in reports/summary.json.

Quick start

Install the millid package, with ONNX Runtime for the CPU ([gpu] for CUDA):

pip install "millid[cpu] @ git+https://github.com/baobab-tech/millid.git"

Identify a passage, several, or a whole document:

from millid import MillID

model = MillID.from_pretrained("baobabtech/millid-tiny-v1.5")
model.predict("Lave men ou ak savon anvan ou manje.", k=3)
# [Prediction(label='hat_Latn', language='Haitian Creole', probability=...), ...]
model.predict(["one text", "another"], k=3)  # one list of answers per text
model.identify_document(long_text)           # any length: its languages and segments

From the command line:

millid predict "Lave men ou ak savon anvan ou manje." --model baobabtech/millid-tiny-v1.5 -k 3

In JavaScript, in Node or a browser, with @baobabtechai/millid from npm:

npm install @baobabtechai/millid onnxruntime-node   # onnxruntime-web in a browser app
import { MillID } from "@baobabtechai/millid";   // "@baobabtechai/millid/web" in a browser, with { ort }
const model = await MillID.fromPretrained("baobabtech/millid-tiny-v1.5");
await model.predict("Lave men ou ak savon anvan ou manje.", 3);

millid.py in this repository is the PyTorch training code, which reads model.safetensors to fine-tune or export.

Best practices

1. Pass the text as it is

The encoder applies Unicode NFKC and collapses whitespace itself. Accents, diacritics and the script are much of what it reads, so do not strip, transliterate or romanise text before passing it.

2. Read long text as a document

predict reads the first 255 bytes of a passage. For anything longer, identify_document reads consecutive windows (at most 256, spread evenly over a longer text), weighs their probabilities by length, and reports the document's languages and the runs of each.

3. Treat a low top probability as unsure

In our tests on real PDFs, a text layer whose characters were mapped to the wrong Unicode code points got a top probability below 0.5 from every MillID model, and reading the same pages from their images gave the right language. A top answer below 0.5 is worth a second look; but see the legacy fonts under Limitations, where that check does not hold.

4. Expect less from very short text

On test, top-1 accuracy is 0.9333 for passages of 20 to 80 characters against 0.9833 for paragraphs. For a heading or a table cell, look at the top three answers rather than the first alone.

5. One text alone and the same text in a batch can score differently

A batch is lower-cased as one string, so a dotted capital İ anywhere in it changes how every text in it is lower-cased (one Greek passage scored 0.976 alone and 0.985 beside Turkish text). The Python and JavaScript runtimes do this identically; send one text at a time where scores must not depend on their neighbours.

6. Choose the size for where it runs

tiny v1.5 on a CPU or in a web page; medium v1 or large v1.5 on a GPU, large v1.5 when accuracy matters most. The three share their labels, so the choice changes no code.

Model data

MillID was trained on passages cut from pages the way a page is read: short lines, sentences and paragraphs.

  • PDFs: FinePDFs, PDF text from Common Crawl, labelled by GlotLID.
  • Web pages: FineWeb-2, web text from Common Crawl, labelled by GlotLID.
  • Storybooks: GlotStoryBook (African Storybook, Pratham Books, LIDA, Little Cree Books) and Nal'ibali's stories in South African languages, labelled by their publishers.
  • News in sparse languages: GlotSparse, labelled by the sites.
  • Publishers' documents: CAWST's training material and the Save the Children Resource Centre's reports and guidance, each document labelled with the language its publisher catalogued.
  • Not trained on: the Universal Declaration of Human Rights, kept for testing; passages quoting it were removed from training.

The training data is the full MillID build. The public baobabtech/millid-dataset is that build without Save the Children's and Nal'ibali's text (1.6% of its passages), which is not ours to redistribute. Its splits are the same, so its test split is the one scored above, without those passages.

Data processing

  • Passages: Unicode NFKC, which folds the ligatures and presentation forms PDF text layers are full of; URLs, emails and dot leaders removed; a passage must be mostly letters. Exact duplicates were removed across every source, and no PDF gives more than 40 passages, article 20 or web page 10.
  • Labels checked: a publisher's label is kept unless GlotLID is confident (≥ 0.8) the passage is in another major language, typically a copyright line; a passage from FinePDFs or FineWeb-2 is kept only when GlotLID's reading of the passage agrees with its document's.
  • Text that is no language removed: passages GlotLID is confident are zxx (no linguistic content), mostly PDFs whose fonts map letters to the wrong code points, and documents catalogued in the wrong language.
  • Splits by document: no test passage shares a document with a training one.

Training

1,943,957 passages; the best validation macro F1 at step 106,000, after 0.6 hours on 1 GPU. Languages sampled in proportion to n^0.3; 25% of passages cut to a 20 to 80 character snippet; batch 512, AdamW at 0.001, cosine schedule, label smoothing 0.1.

Architecture

MillID's architecture: a passage is normalised, encoded per UTF-8 byte into byte, script, byte-in-character and hashed character n-gram ids, embedded and summed, passed through a convolutional stem, downsampling and pre-norm transformer blocks, mean-pooled, and scored against label, language and script embeddings

Drawn at the medium preset's sizes (12 blocks, d = 768); this model's are in the table above.

UTF-8 bytes (after Unicode NFKC), each embedded as byte + Unicode script + byte-in-character + hashed character 2-, 3- and 4-grams (4,096 buckets) -> depthwise convolution stem (kernel 5) -> strided convolution, 1 byte per token -> 3 pre-norm blocks (RMSNorm, attention with RoPE, 3 heads, SwiGLU; d=192) -> masked mean pooling -> language head, each language's vector the sum of its own, its language's and its script's. See ARCHITECTURE.md.

Usage and limitations

Intended usage

  • Routing documents: choosing the OCR, translation or language model for a document by its language.
  • Building and filtering corpora: sorting web or PDF text by language, low-resource languages included.
  • Describing collections: which languages a set of documents holds, and how much of each.
  • On-device detection: in a browser or on a phone with tiny v1.5, where text should not leave the device.

Limitations

  • Close languages: languages that differ by a few words are its weakest (F1 on test: Croatian 0.62, Bosnian 0.65, Malay 0.77, Indonesian 0.81, Norwegian Bokmål 0.81). Their short passages are often genuinely ambiguous.
  • Text that is no language: there is no "no language" class. Nepali typed in the legacy Preeti font, whose text layer is Latin letters standing for Devanagari, was labelled as another language by MillID models, some with a top probability up to 0.74.
  • One label per passage: a passage that mixes languages gets one; identify_document gives the segments of a longer text.
  • Labels learned from GlotLID: the FinePDFs and FineWeb-2 passages were labelled by GlotLID, so MillID learned its labels, mistakes included; udhr, labelled by translators, is the independent test.
  • Genre: for many low-resource languages the training text is mostly religious web text or children's stories, and a model can learn the genre along with the language.

Ethical considerations and risks

  • Errors fall on the smallest languages: filtering or routing text by language can drop or mishandle the text of speakers of low-resource and closely related languages, where MillID is least accurate. Check the per-language scores of the languages that matter before filtering with it.
  • A language is not an identity: do not use a language label to infer a person's nationality, ethnicity or origin.
  • Labels can be contested: whether two varieties are one language or two is political as well as linguistic. MillID's labels follow ISO 639-3 and its training data, not a judgement on that question.

Benefits

MillID tiny v1.5 is within 0.020 macro F1 of GlotLID, a 1.7 GB fastText model, on the 1,621 languages of test, and within 0.011 on udhr. At 11 MB, it loads in a web page or ships inside an app. All three sizes are open under Apache-2.0, with the code that trained and evaluated them and the dataset, less the text that is not ours to share.

Licence

The weights and the code are Apache-2.0. The training data carries its own licence row by row (see the dataset card), including text licensed for non-commercial use only (CC BY-NC, CC BY-NC-SA).

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · pytorch · text-classification

Можно запустить

Подбираем GPU…

Ревизия весов
7762984

0 моделей