Run this model with HF Jobs

Run olaverse/YellowMIST-Encoder-15M-AMR on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/olaverse/YellowMIST-Encoder-15M-AMR. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/olaverse/YellowMIST-Encoder-15M-AMR on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
File size: 8,505 Bytes
1f9d7c0
 
8ac46d0
 
1f9d7c0
 
 
 
 
304c480
 
1f9d7c0
 
 
 
 
 
 
 
 
 
 
 
 
f3f1983
1f9d7c0
 
 
f3f1983
 
 
 
 
1f9d7c0
 
 
 
 
f3f1983
1f9d7c0
 
f3f1983
 
1f9d7c0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b55880c
 
 
 
 
1f9d7c0
b55880c
 
 
 
 
 
1f9d7c0
b55880c
 
1f9d7c0
b55880c
1f9d7c0
b55880c
 
 
 
 
 
 
 
 
 
 
 
 
 
1f9d7c0
 
b55880c
 
 
 
1f9d7c0
 
 
 
 
 
 
 
 
 
8ac46d0
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
---
license: apache-2.0
language: [agu, arn, atj, avk, ayr, cak, cni, ctu, dak, djk, emp, eng, gcf, gcr, gub, guc, gug, guh, gui, gym, hat, ikt, jam,
  jbo, kal, lfn, nah, nav, pap, qub, quc, qup, quy, quz, srm, srn, tlh, tok, tzh, tzo, yua, zap]
library_name: transformers
pipeline_tag: fill-mask
tags: [yellowmist, dew, character-level, encoder, multilingual, on-device, fill-mask]
---

![YellowMIST-Encoder-15M-AMR](banner.png)

# YellowMIST-Encoder-15M-AMR

**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 **the Americas (Latin script)**:
42 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. 2.05B unique characters in this group.
- Trained on 4.0B characters (61,035 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: 68.1%**
- Short fine-tune probes: mark restoration 95.6% words right (mean over 7 languages), punctuation F1 41.1, capitals F1 65.3

| Language | masked chars % | mark restoration % | punctuation F1 | capitals F1 | unique chars |
|---|---|---|---|---|---|
| `hat_Latn` | 81.0 | 97.8 | 38.9 | 61.7 | 296M |
| `pap_Latn` | 84.0 | 99.9 | 46.6 | 75.1 | 289M |
| `kal_Latn` | 80.4 | – | 49.7 | 76.8 | 127M |
| `gug_Latn` | 78.7 | 91.6 | 31.6 | 45.9 | 79M |
| `yua_Latn` | 77.3 | 98.4 | 36.9 | 73.8 | 20M |
| `tlh_Latn` | 66.9 | – | 31.8 | 92.6 | 9M |
| `ayr_Latn` | 65.8 | 96.1 | 29.8 | 60.8 | 9M |
| `lfn_Latn` | 76.5 | – | 74.5 | 79.5 | 6M |
| `quc_Latn` | – | – | – | – | 2M |
| `gcf_Latn` | 62.0 | 93.2 | 25.7 | 50.1 | 3M |
| `zap_Latn` | – | – | – | – | <1M |
| `arn_Latn` | 61.5 | 92.5 | 34.1 | 69.2 | 2M |
| `qub_Latn` | – | – | – | – | <1M |
| `gym_Latn` | – | – | – | – | <1M |
| `avk_Latn` | 42.5 | – | 94.1 | 95.0 | 2M |
| `emp_Latn` | – | – | – | – | <1M |
| `quy_Latn` | 70.2 | – | 36.5 | 54.6 | 16M |
| `dak_Latn` | – | – | – | – | 6M |
| `nah_Latn` | 60.2 | – | 23.0 | 48.5 | 2M |
| `jam_Latn` | – | – | – | – | 2M |
| `nav_Latn` | – | – | – | – | <1M |
| `jbo_Latn` | 65.3 | – | 63.4 | 0.0 | 3M |
| `quz_Latn` | 68.7 | – | 36.7 | 65.7 | 2M |
| `tok_Latn` | 80.3 | – | 69.3 | 75.8 | 5M |
| `tzo_Latn` | – | – | – | – | 1M |
| `cak_Latn` | – | – | – | – | <1M |
| `djk_Latn` | – | – | – | – | <1M |
| `ctu_Latn` | – | – | – | – | <1M |
| `gui_Latn` | – | – | – | – | <1M |
| `srn_Latn` | 50.8 | – | – | – | <1M |
| `srm_Latn` | – | – | – | – | <1M |
| `cni_Latn` | – | – | – | – | <1M |
| `tzh_Latn` | 61.1 | – | 24.4 | 51.4 | 2M |
| `guh_Latn` | – | – | – | – | <1M |
| `agu_Latn` | – | – | – | – | <1M |
| `ikt_Latn` | – | – | – | – | <1M |
| `gub_Latn` | – | – | – | – | <1M |
| `guc_Latn` | 53.3 | – | – | – | <1M |
| `qup_Latn` | 74.5 | – | – | – | <1M |
| `atj_Latn` | 54.6 | – | – | – | <1M |
| `gcr_Latn` | – | – | – | – | <1M |
| `eng_Latn` | 83.1 | – | 51.6 | 83.0 | 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("AMR")                  # this model
train.continue_pretraining(enc, {"eng_Latn": paragraphs}, steps=2000)   # keep pretraining on your text
model = train.finetune_punct(enc, {"eng_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-AMR").eval()
vocab = json.load(open(hf_hub_download("olaverse/YellowMIST-Encoder-15M-AMR", "vocab.json")))["vocab"]
ids = {t: i for i, t in enumerate(vocab)}

text = unicodedata.normalize("NFC", "Your text here")
x = torch.tensor([[ids["<|lang:eng_Latn|>"]] + [ids.get(c, 1) for c in text]])   # 1 = <unk>
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-amr,
  title  = {YellowMIST-Encoder-15M-AMR: a tiny character-level encoder for on-device text tasks},
  author = {Olaverse},
  year   = {2026},
  url    = {https://huggingface.co/olaverse/YellowMIST-Encoder-15M-AMR}
}
```