Tachiwin

English · Español

Tachiwin Audio Language ID

Spoken language identification for the indigenous languages of Mexico.

This model identifies the language spoken in a short audio file, drawn from a repertoire of over a hundred variants of the indigenous languages of Mexico. It returns a ranked list of language codes with calibrated probabilities; the label space contains 128 classes, mostly ISO 639-3 codes alongside a few catalogue-specific additions. It performs no transcription — it identifies the language so that the appropriate model can be loaded downstream. The ECAPA-TDNN architecture is aimed at an in-device distributable model: 21M parameters (85 MB) that run on CPU, offline and without a proprietary service. It is released openly, with its training configuration and per-language statistics, so the communities whose languages it describes can inspect, replicate and correct it.

Website · https://tachiwin.org  |  Demo · https://huggingface.co/spaces/tachiwin/classifier  |  Dataset · https://huggingface.co/datasets/tachiwin/tachiwin_multilingual_audio

Usage

pip install speechbrain soundfile safetensors huggingface_hub
from huggingface_hub import snapshot_download
import sys; p = snapshot_download("tachiwin/Tachiwin-Audio-ID"); sys.path.insert(0, p)
from inference import TachiwinLID
lid = TachiwinLID("tachiwin/Tachiwin-Audio-ID")
print(lid.predict("audio.wav", top_k=5))
{'code': 'yaq', 'prob': 0.9981, 'language': 'Yaqui', 'superlanguage': 'Yaqui', 'family': 'Yuto-Nahua'}
python inference.py tachiwin/Tachiwin-Audio-ID audio.wav

TachiwinLID(repo_or_path, device=None, token=None) accepts a Hub repo id or a local folder and uses CUDA when available, otherwise CPU. predict(audio, top_k=5, sr=None) accepts a file path or a 1-D float array; pass sr= when the array is not 16 kHz. Audio is resampled to 16 kHz, short clips are padded to 0.5 s, and anything longer than 10 s is cut into 6 s windows with a 3 s hop, averaging the log-probabilities.

Model details and architecture

speechbrain/lang-id-voxlingua107-ecapa re-trained on indigenous languages: Kaldi fbank features, per-utterance mean/var normalisation, a 256-d ECAPA-TDNN embedding, and a cosine classifier head. Training used AAM-softmax (scale 30, margin 0.2); at inference the head is a frozen L2-normalised matrix and the logits are divided by a temperature fitted on the validation split.

The model emits a single softmax over the 128 codes. superlanguage and family are metadata looked up from the predicted code in labels.json — there are no separate heads for them, and no separate probabilities.

Base model speechbrain/lang-id-voxlingua107-ecapa
Backbone ECAPA-TDNN, 256-d embedding
Head Cosine, AAM-softmax in training (scale 30, margin 0.2)
Features Kaldi fbank + per-utterance mean/var normalisation
Calibration Temperature scaling, T = 1.5311099290847778
Sample rate 16 kHz
Windowing window_sec 6.0 / hop_sec 3.0 / eval_max_sec 10.0
Size ~21M parameters (85 MB safetensors, fp32)
Best checkpoint step 12168 of 15210
License Apache-2.0

config.json holds every inference-time constant and inference.py reads it, so re-basing the backbone or swapping the head needs no code change. labels.json maps index → code (that order is the head order) and code → language, superlanguage and family; lang_stats.json holds per-language support and recall; metrics.json the aggregate evaluation; train_config.json the full training run. The weights live in model.safetensors (emb.* backbone + head.weight, 128 × 256).

Stats

Independent verification on the test split — 8,109 clips from 111 variants — run through the public inference.py against the Hub copy at commit 8085758ff8 (17 automated checks passed, 4 warnings, 2 skipped). Intervals are Wilson for top-3, family and superlanguage accuracy, and bootstrap percentile (n = 1000) for accuracy and the macro metrics; clips are treated as independent.

Metric Test, verified [95 % CI] Validation
Top-1 accuracy 0.906 [0.899, 0.912] 0.9031
Top-3 accuracy 0.973 [0.970, 0.977] 0.9707
Macro F1 0.784 [0.761, 0.803] 0.7745
Macro recall 0.804 [0.784, 0.826] 0.8005
Family accuracy 0.966 [0.962, 0.970] 0.9622
Superlanguage accuracy 0.948 [0.943, 0.953] 0.9443
NLL (calibrated) 0.358 0.4365
ECE (calibrated) 0.020 0.0515

Reproduced values differ from metrics.json by at most 0.002. Family and superlanguage accuracies marginalise the class distribution over the label metadata: they answer "did it land in the right family", not a separate task. Per-variant support and recall are in lang_stats.json.

By language family

Family Variants Test clips Top-1 Family acc.
Otomangue 66 3250 0.868 0.965
Mayense 12 1944 0.972 0.976
Yuto-Nahua 21 1587 0.923 0.979
Mixe-Zoqueano 6 535 0.834 0.968
Purépecha 1 288 0.920 0.920
(no family metadata) 10 272 0.901 0.901
Totonaco-Tepehua 5 173 0.942 0.983
Seri 1 23 0.870 0.870
Yumano-Cochimí 4 21 0.905 0.905
Tequistlatecano 1 14 0.714 0.714
Álgica 1 2 0.500 0.500

The (no family metadata) row groups the 10 variants whose family field is still empty in labels.json. Otomangue holds 40 % of the test clips and the lowest top-1 accuracy of the large families; Mayense and Yuto-Nahua are the strongest.

Best and worst performing variants

Recall over the 111 evaluated variants: 1.0 for 23 of them, between 0.9 and 1.0 for 31, between 0.5 and 0.9 for 46, below 0.5 for 8 and 0 for 3. The median variant has 24 test clips and 195 training clips, and the rank correlation between training size and recall is only 0.174 (Spearman), so support alone does not explain the ranking.

Highest recall among the variants with at least 20 test clips:

Code Variant Training clips Test clips Recall [95 % CI]
jac Jakalteko 729 91 1.00 [0.96, 1.00]
mix Mixtepec Mixtec 718 90 1.00 [0.96, 1.00]
mzi Ixcatlán Mazatec 724 90 1.00 [0.96, 1.00]
zar Rincón Zapotec 715 89 1.00 [0.96, 1.00]
toj Tojolabal 644 80 1.00 [0.95, 1.00]
var Huarijío 641 80 1.00 [0.95, 1.00]
stp Southeastern Tepehuan 471 59 1.00 [0.94, 1.00]
ctu Chol 990 124 0.99 [0.96, 1.00]

Lowest recall among the variants with at least 5 test clips:

Code Variant Training clips Test clips Recall [95 % CI] Most confused with
top Papantla Totonac 57 7 0.00 [0.00, 0.35] tos Highland Totonac
nhx Isthmus-Mecayapan Nahuatl 45 6 0.17 [0.03, 0.56] azz Highland Puebla Nahuatl
tac Western Tarahumara 41 5 0.20 [0.04, 0.62] tar Central Tarahumara
tpl Tlacoapa Me’phaa 120 15 0.27 [0.11, 0.52] tcf Malinaltepec Me’phaa
nhm Morelos Nahuatl 41 5 0.40 [0.12, 0.77] mxt Jamiltepec Mixtec
xtn Northern Tlaxiaco Mixtec 38 5 0.40 [0.12, 0.77] ixc Ixcatec
zoc Copainalá Zoque 195 24 0.42 [0.24, 0.61] zoh Chimalapa Zoque
trc Copala Triqui 59 7 0.43 [0.16, 0.75] trs Chicahuaxtla Triqui

Confusions

64.1 % of all errors stay inside the correct family. The most frequent pairs:

True Predicted as Count Same family
mxp Tlahuitoltepec Mixe mco Coatlán Mixe 26 yes
ctp Western Highland Chatino cya Nopala Chatino 25 yes
maz Central Mazahua mmc Michoacán Mazahua 23 yes
mfy Mayo tar Central Tarahumara 21 yes
mxt Jamiltepec Mixtec mig San Miguel el Grande Mixtec 15 yes
tsz Purepecha pua Western Highland Purepecha 15 no
zaa Sierra de Juárez Zapotec zar Rincón Zapotec 14 no
zoc Copainalá Zoque zoh Chimalapa Zoque 14 yes
tar Central Tarahumara mfy Mayo 13 yes
ctp Western Highland Chatino chd Highland Oaxaca Chontal 13 no

Confidence and clip length

Accuracy when answering only above a confidence threshold, and by clip duration:

Min. confidence Coverage Clips Accuracy
0.00 100.0 % 8109 0.906
0.30 97.6 % 7915 0.922
0.50 94.3 % 7650 0.938
0.70 89.6 % 7269 0.956
0.90 81.5 % 6609 0.974
Clip length Clips Accuracy [95 % CI]
2-4 s 5689 0.901 [0.893, 0.908]
4-7 s 1625 0.911 [0.897, 0.924]
7-10 s 428 0.909 [0.878, 0.933]
≥10 s 367 0.954 [0.927, 0.971]

Optimism diagnostics

Chance is 0.78 % and the most frequent language alone reaches 11.06 %; the model reaches 90.6 %. A classifier that sees only recording conditions — metadata, long-term spectrum and level, nothing linguistic — reaches 44.6 % top-1 (macro-F1 0.376) on the same clips, so part of the label is predictable from how a clip was recorded. 60 test clips have a byte-identical copy in the training split, and 290 duplicate groups carry conflicting labels. These diagnostics can flag shortcuts but cannot certify the split: speaker overlap is not measurable without speaker or session identifiers.

Training

Fine-tuned on tachiwin/tachiwin_multilingual_audio at revision b9670f5a76199a1b65f0006b12fa1121879274f8: 128 classes, 11 families, 49 superlanguages, ≈92 hours of audio, 64,896 clips for training and 8,109 held out for testing (per-class breakdown in lang_stats.json). The split is random per language, 10 % validation and 10 % test. Class imbalance is severe — some variants have hours of audio and others a few dozen clips — which is why the sampler is smoothed and the metrics are macro-averaged.

Setting Value
Seed 42
Epochs / batch 15 / 64
Learning rate 1e-4 backbone, 2e-3 head, 500-step warmup
Head initialisation Class prototypes, 16 crops per class; backbone frozen 600 steps, ramped over 200
AAM-softmax Margin 0.2, ramped over 2000 steps
Training crops 1.0–5.0 s, minimum 0.5 s
Augmentation speed 0.3, band-limit 0.1, noise 0.5, SpecAugment 0.5
Calibration Temperature fitted on validation after training

Limitations

  • Recording conditions are partly predictive. A classifier that sees only metadata, long-term spectrum and level reaches 44.6 % top-1 on these clips against 0.78 % chance, so accuracy on new microphones and rooms will not match the figures above.
  • Closed set, no "other" class. The model always returns one of its 128 labels. Spanish, English, music, noise or an unsupported variant will still get a confident-looking answer; read it as the closest variant in scope.
  • Speaker leakage. The split is random per language and the dataset has no speaker or session identifier, so the same person or session can appear in both train and test; 60 test clips have a byte-identical copy in the training split and 290 duplicate groups carry conflicting labels. The metrics are therefore likely optimistic.
  • Low-support languages are unreliable. 15 of the 111 evaluated variants have fewer than 5 test clips, and their per-variant recall should not be quoted; check n_train, hours_train and test_recall in lang_stats.json before trusting a specific class. One variant with adequate support, Totonaco de la Costa (top) — the language the project started with — is never recognised in the test split (0 of 7).
  • Partial coverage. 128 of roughly 364 catalogued variants; unsupported variants get mapped onto a neighbour.
  • Two macrolanguage placeholders. nah (Náhuatl) and, historically, hue (Huave) were used by the dataset as coarse buckets for variants that could not be resolved, so predicting them gives macrolanguage granularity rather than variant granularity.
  • Some codes are transborder. The class list includes languages spoken on both sides of Mexico's borders — Kickapoo (kic), Pápago (ood) and Mayan languages also spoken in Guatemala (Chuj, Kaqchikel, K'iche', Mam, Jakalteko).
  • Long recordings are averaged. Beyond 10 s the answer is an average over 6 s windows, so a recording with two languages returns a blend rather than a split.
  • Metadata gaps. labels.json still ships empty family/superlanguage strings for 10 codes (chq, hue, mir, nah, ots, pua, stp, zad, zar, zpd). Inference is unaffected; those are display fields.

Citation

@misc{tachiwin_audio_language_id,
  title        = {Tachiwin Audio Language ID: spoken language identification for the indigenous languages of Mexico},
  author       = {{Tachiwin}},
  howpublished = {\url{https://huggingface.co/tachiwin/Tachiwin-Audio-ID}},
  year         = {2026},
  note         = {Update the URL, version and date when a new version is released}
}

Tachiwin

Tachiwin is an indigenous, Mexican, community-led, non-profit and open-source initiative that develops Artificial Intelligence technologies for the 68 indigenous languages of Mexico and their 364 variants, guided by technological sovereignty, ethics, collaboration and open knowledge and putting technology at the service of the communities that speak them. This identifier is one of those technologies: it began with Totonac / Tutunakú (top) and today covers a repertoire of over a hundred variants of indigenous languages spoken in Mexico.

In memory of our founder, Fidencio Hernández Hernández (1990–2025). Wix klakgapastakgan kin xkuti.

Downloads last month
-
Safetensors
Model size
21.1M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for tachiwin/Tachiwin-Audio-ID

Finetuned
(7)
this model
Quantizations
1 model

Dataset used to train tachiwin/Tachiwin-Audio-ID

Space using tachiwin/Tachiwin-Audio-ID 1

Evaluation results