The pipeline

What happens inside one predict call, in six steps.

  1. 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.
  2. 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.
  3. 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.
  4. 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).
  5. 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.
  6. 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

SettingValue
Base modelseanghay/albert-khmer-small (Khmer ALBERT)
Parameters per model9.31M (7.3M trained; word embeddings frozen)
Models in the ensemble7 (seeds 42 to 48, all kept, none chosen after scoring)
Training5 epochs, learning rate 3e-5 (AdamW), batch 8 with accumulation 2
Window size128 subwords, about half overlap
Label positionfirst content subword
Decodingconstrained IOB2 Viterbi
Label biasO ×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:

ensemble.json
{
  "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.