--- license: apache-2.0 language: [afr, crs, dik, dov, eng, gaz, her, kam, kik, kin, kua, kwn, lin, lua, lub, lug, luo, mas, mfe, naq, nbl, ndc, nde, ndo, nso, nya, nyn, plt, rcf, run, seh, sgc, sid, sna, som, sot, ssw, swh, teo, tsn, tso, ven, xho, zul] library_name: transformers pipeline_tag: fill-mask tags: [yellowmist, dew, character-level, encoder, multilingual, on-device, fill-mask] --- ![YellowMIST-Encoder-15M-ESA](banner.png) # YellowMIST-Encoder-15M-ESA **YellowMIST Encoder** is a family of tiny character-level encoders to fine-tune for on-device text tasks: code-switching detection, word segmentation, autocorrect, restoring tone marks, punctuation and capitals, small NER. Each encoder covers one script or region group. This one covers **Central, East and Southern Africa (Latin script)**: 44 languages. - **15.0M parameters**, 60 MB in fp32 (about 15 MB once quantised to int8; that file is not exported yet) - Reads **characters** (NFC code points), so it needs no tokenizer and handles any spelling or tone marks in its script - Sees text in **both directions**, like BERT. It labels or fixes text; it does not generate it. ## Architecture [Dew](https://github.com/Olaverse-Labs/dew), preset `dew-1-enc-hybrid`: 6 layers, `GGAGGA`. That is 4 bidirectional Gated DeltaNet layers (a fixed-size memory read forwards and backwards) and 2 attention layers, with a dense SwiGLU feed-forward block in each layer. Hidden size 320. Context of 512 characters in training; it runs on longer text. The first token of a text is its language tag (`<|lang:xxx_Xxxx|>`). This is Dew's small dense hybrid. Dew also has Mixture-of-Experts ("Nap") presets; those are research presets for larger models and are not used in any YellowMIST model. The Gated DeltaNet layer is from Yang, Kautz and Hatamizadeh, [Gated Delta Networks: Improving Mamba2 with Delta Rule](https://arxiv.org/abs/2412.06464) (2024); training uses the [flash-linear-attention](https://github.com/fla-org/flash-linear-attention) kernels on GPU. Why this layout: in a 3-seed pilot on the West Africa data, it beat a same-size transformer encoder on every test, by more than the seed-to-seed spread: | Model (15M, same data and steps, 3 seeds) | masked chars | mark restoration | punctuation F1 | capitals F1 | |---|---|---|---|---| | **Dew `dew-1-enc-hybrid` (this architecture)** | **65.89 ± 0.13** | **82.89 ± 0.04** | **36.67 ± 0.35** | **59.07 ± 0.59** | | Transformer encoder | 64.43 ± 0.19 | 82.44 ± 0.02 | 34.33 ± 1.10 | 57.07 ± 1.44 | The pilot used shorter training, on the West Africa data only, so its numbers are not comparable with the Results below. ## Training - Objective: masked characters. Spans of 3 characters are hidden at 15% of positions, and the model fills them in. - Data: web and chat text from the YellowMIST corpus, licence-screened. 4.76B unique characters in this group. - Trained on 8.0B characters (122,070 steps of 128 × 512). Small languages repeat at most 4 times; English is capped at a quarter of the training text. ## Results Held-out documents (never trained on). - **Masked characters filled in correctly: 72.2%** - Short fine-tune probes: mark restoration 95.5% words right (mean over 3 languages), punctuation F1 40.4, capitals F1 63.9 | Language | masked chars % | mark restoration % | punctuation F1 | capitals F1 | unique chars | |---|---|---|---|---|---| | `afr_Latn` | 73.6 | – | 43.5 | 78.4 | 378M | | `swh_Latn` | 80.9 | – | 39.4 | 66.1 | 341M | | `som_Latn` | 83.5 | – | 42.1 | 75.4 | 296M | | `plt_Latn` | 80.5 | – | 25.5 | 70.6 | 279M | | `kin_Latn` | 84.0 | – | 32.4 | 76.5 | 287M | | `xho_Latn` | 78.8 | – | 42.2 | 68.1 | 297M | | `zul_Latn` | 77.5 | – | 41.5 | 62.6 | 294M | | `nya_Latn` | 79.3 | – | 35.2 | 73.8 | 295M | | `sna_Latn` | 80.7 | – | 43.9 | 74.9 | 293M | | `sot_Latn` | 80.0 | – | 41.9 | 73.0 | 292M | | `gaz_Latn` | 77.1 | – | 51.7 | 81.4 | 202M | | `lug_Latn` | 78.9 | – | 34.1 | 66.7 | 64M | | `run_Latn` | 83.6 | – | 46.3 | 83.3 | 157M | | `crs_Latn` | 71.4 | – | 38.4 | 68.1 | 5M | | `lin_Latn` | 72.9 | – | 35.1 | 41.6 | 35M | | `tso_Latn` | 74.4 | – | 49.1 | 74.7 | 13M | | `nde_Latn` | 76.7 | – | 45.4 | 77.5 | 4M | | `mfe_Latn` | 65.6 | – | 37.1 | 52.2 | 14M | | `tsn_Latn` | 75.1 | – | 47.3 | 55.6 | 15M | | `ndo_Latn` | – | – | – | – | 8M | | `lub_Latn` | – | – | – | – | <1M | | `rcf_Latn` | 46.2 | 92.8 | 22.9 | 42.7 | 2M | | `ven_Latn` | 71.4 | 94.9 | 56.6 | 46.3 | 3M | | `nso_Latn` | 70.5 | 98.7 | 42.6 | 29.6 | 10M | | `dov_Latn` | 58.6 | – | – | – | <1M | | `ssw_Latn` | 72.2 | – | 59.1 | 52.0 | 4M | | `nbl_Latn` | 71.3 | – | 53.7 | 50.6 | 2M | | `luo_Latn` | 50.7 | – | 12.1 | 33.5 | 2M | | `kik_Latn` | – | – | – | – | 6M | | `mas_Latn` | – | – | – | – | <1M | | `her_Latn` | – | – | – | – | <1M | | `kwn_Latn` | – | – | – | – | <1M | | `kua_Latn` | – | – | – | – | <1M | | `sid_Latn` | – | – | – | – | <1M | | `nyn_Latn` | 58.4 | – | – | – | <1M | | `sgc_Latn` | – | – | – | – | <1M | | `lua_Latn` | – | – | – | – | <1M | | `dik_Latn` | 53.1 | – | 39.4 | 55.7 | 1M | | `teo_Latn` | – | – | – | – | <1M | | `naq_Latn` | – | – | – | – | <1M | | `kam_Latn` | – | – | – | – | <1M | | `ndc_Latn` | 57.0 | – | – | – | <1M | | `seh_Latn` | – | – | – | – | <1M | | `eng_Latn` | 82.2 | – | 45.4 | 81.6 | 1,160M | Mark restoration only runs for languages written with diacritics or tone marks. A `–` means no probe, or a language with under 1M characters of text, whose test set is too small to give a stable score. The group means above include every probed language. ## Use ### With the yellowmist library (recommended) This is a base model to fine-tune. The finished tasks built on it (punctuation, language of every word, word boundaries) ship in the `yellowmist` library: `pip install yellowmist`, see the [documentation](https://olaverse-labs.github.io/yellowmist/). ```python from yellowmist import train # pip install "yellowmist[train]" enc = train.Encoder.load("ESA") # this model train.continue_pretraining(enc, {"swh_Latn": paragraphs}, steps=2000) # keep pretraining on your text model = train.finetune_punct(enc, {"swh_Latn": paragraphs}) # or finetune_switch(...) model.save("my-model") # weights + ONNX, ready for ym.register / model= ``` The [fine-tuning notebook](https://github.com/Olaverse-Labs/yellowmist/blob/main/notebooks/finetune_yellowmist.ipynb) ([open in Colab](https://colab.research.google.com/github/Olaverse-Labs/yellowmist/blob/main/notebooks/finetune_yellowmist.ipynb)) walks through every step, including adding new languages and sharing your model on the Hub. ### Without the library (transformers) ```python import json, unicodedata, torch import dew # pip install "dew-lm[hf]": registers the Dew architecture from huggingface_hub import hf_hub_download from transformers import AutoModelForMaskedLM model = AutoModelForMaskedLM.from_pretrained("olaverse/YellowMIST-Encoder-15M-ESA").eval() vocab = json.load(open(hf_hub_download("olaverse/YellowMIST-Encoder-15M-ESA", "vocab.json")))["vocab"] ids = {t: i for i, t in enumerate(vocab)} text = unicodedata.normalize("NFC", "Your text here") x = torch.tensor([[ids["<|lang:swh_Latn|>"]] + [ids.get(c, 1) for c in text]]) # 1 = with torch.no_grad(): hidden = model.model(x)[0] # [1, 1 + characters, hidden], one vector per character ``` To fine-tune by hand, put a small head on `hidden` (one label per character or word) and train the whole model with a low learning rate (3e-4 worked for our tasks). **More:** [documentation](https://olaverse-labs.github.io/yellowmist/) · [GitHub](https://github.com/Olaverse-Labs/yellowmist) · [playground](https://huggingface.co/spaces/olaverse/yellowmist-playground) · [fine-tuning notebook](https://github.com/Olaverse-Labs/yellowmist/blob/main/notebooks/finetune_yellowmist.ipynb) ## Limits - This is a base model, not a finished tool: fine-tune it for a task. - Masked-character accuracy measures how well the model knows the languages, not any one task. Compare it within a group, not across scripts. ## Licence Apache-2.0. ## Citation ```bibtex @misc{yellowmist-encoder-15m-esa, title = {YellowMIST-Encoder-15M-ESA: a tiny character-level encoder for on-device text tasks}, author = {Olaverse}, year = {2026}, url = {https://huggingface.co/olaverse/YellowMIST-Encoder-15M-ESA} } ```