The pipeline
What happens inside one predict call, in six steps.
- Split into wordsKhmer has no spaces between words, so the text is split with khmer-nltk. Zero-width characters (U+200B/C/D) are removed only from what the model reads; every word keeps its start and end in your original text.
- Read each word from its meaningful pieceThe model cuts words into subword pieces, and a third of Khmer words begin with a blank "▁" piece. Each word's label is read from its first piece with real letters. Case study.
- Overlapping windowsWindows of up to 128 pieces overlap by about half; each word is read from the window where it has the most context on its weaker side. Case study.
- Seven-model averageSeven models, trained the same way with different random seeds, each give word probabilities, which are averaged. A fixed bias then slightly favours ORG (×1.2) and disfavours O (×0.9) and LOC (×0.85).
- Best valid sequenceViterbi decoding picks the best tag sequence in which no name continues before it has started, instead of choosing each word's tag alone.
- Display rulesShort honorifics such as លោក join a name, ceremonial titles stay outside it, place designators (ខេត្ត, ស្រុក) are completed, nationality phrases are not places, and punctuation and spaces are trimmed from the edges.
Settings of the released model
| Setting | Value |
|---|---|
| Base model | seanghay/albert-khmer-small (Khmer ALBERT) |
| Parameters per model | 9.31M (7.3M trained; word embeddings frozen) |
| Models in the ensemble | 7 (seeds 42 to 48, all kept, none chosen after scoring) |
| Training | 5 epochs, learning rate 3e-5 (AdamW), batch 8 with accumulation 2 |
| Window size | 128 subwords, about half overlap |
| Label position | first content subword |
| Decoding | constrained IOB2 Viterbi |
| Label bias | O ×0.9, ORG ×1.2, LOC ×0.85 |
The model folder on the Hub holds the seven members and this file, which tells the package how to combine them:
{
"members": [
"members/m0-s42",
"members/m1-s43",
"members/m2-s44",
"members/m3-s45",
"members/m4-s46",
"members/m5-s47",
"members/m6-s48"
],
"decoding": "viterbi",
"context_windows": "overlap",
"note": "Neam ensemble: member softmax probabilities are averaged, then decoded."
}Why each step is there
Every step was added to fix a measured problem. Eight decisions tells that story, with the gain each one brought.