Instructions to use MoriartyPuth/neam with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MoriartyPuth/neam with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="MoriartyPuth/neam")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("MoriartyPuth/neam", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Neam (ααΆα): Khmer news NER
Neam finds people (PER), organizations (ORG) and places (LOC) in Khmer text and returns character offsets in the original input. It was trained and evaluated on Khmer news.
Use the
neampackage to run this model. It is an ensemble of three ALBERT checkpoints (members/), combined byensemble.jsonwith Viterbi decoding, overlapping context windows and Khmer-specific display rules. Loading one member with the standardtransformerspipeline gives noticeably worse results.
pip install neam
from neam import Neam
ner = Neam.from_pretrained("MoriartyPuth/neam")
result = ner.predict("ααα α αα»α αααΆααα ααΆααα½αααΆαα½αααααα½ααα»ααΆαα·ααΆααα
ααΆαααΆααΈαααααααα")
for entity in result["entities"]:
print(entity["label"], entity["text"], entity["start"], entity["end"])
Model details
- Architecture: three fine-tuned
seanghay/albert-khmer-smalltoken classifiers (seeds 44, 42, 43), with softmax probabilities averaged. Labels are IOB2 over khmer-nltk words, read from each word's first non-βsubword. - Decoding: constrained IOB2 Viterbi with calibrated label scores (O Γ 0.9, ORG Γ 1.2, LOC Γ 0.85). Each word is read in the overlapping 128-subword window that gives it the most context.
- Display rules:
- A short honorific such as ααα is joined to a following name.
- Common place designators (ααααα, αααα»α, β¦) are completed.
- A LOC directly after ααααΆαα· (a nationality phrase) is removed.
- Sentence punctuation is trimmed.
- Size: about 37 MB per member, 113 MB in total. It runs on a CPU.
Intended use and annotation policy
Neam is for tagging named entities in Khmer news text, for search, indexing or reading
aids. It follows docs/annotation_policy.md, in brief:
- PER covers names. Ceremonial titles (α―αα§αααα, αααααα , αααααααΆα) and ranks are excluded; short honorifics (ααα, αααααααΈ) are included.
- ORG covers named institutions, including their designator and any country or province in the name (for example ααΆααααααΆαα·ααΆαααααα»ααΆ and α’αααααΆαα’αααΆααΆααααΌααααααααααααΈα αα»).
- LOC covers places and facilities.
- Nationality phrases (ααααΆαα· + country), products, events and storms are not entities.
Training data
- Cleaned Khmer WikiANN and a 1,200-record Khmer fiNERweb sample (PER/ORG/LOC labels only).
- 56 Khmer news articles from Fresh News, Khmer Press, Kampuchea Thmey and Cambodia Daily, plus 82 short replay examples, labelled at character level under the policy. The labels are assistant drafts, following the project owner's policy decisions. A sample of five articles (121 labels) was reviewed by the owner, a Khmer reader, with no errors found.
- A small synthetic curriculum contrasting nationality phrases with the same country used as a place.
Publisher article text is not redistributed with this model.
Training settings: 5 epochs, learning rate 3e-5, batch size 8 with 2-step gradient accumulation, frozen embeddings, and the news data weighted Γ3.
Evaluation
Exact character-span F1: an entity counts only if both its boundaries and its type match.
| Set | Articles / entities | F1 | Precision | Recall | PER | ORG | LOC |
|---|---|---|---|---|---|---|---|
| Validation | 5 / 108 | 78.03 | 75.7 | 80.6 | 80.0 | 73.8 | 83.5 |
| Held-out (never used for training) | 10 / 199 | 84.21 | 84.0 | 84.4 | 88.2 | 68.7 | 93.4 |
The PER, ORG and LOC columns are F1. For comparison, the project's earliest model (WikiANN-centred, no news-specific methods) scores 59.5 F1 on the same held-out set.
Seed variance. Retraining the same recipe with seven different seeds gives single-model held-out F1 between 78.0 and 85.4. Three-seed ensembles average 82.0 (range 79.6β85.8). This release's ensemble is on the favourable side of that range. Expect about 82β83 F1 on similar Khmer news.
Limitations
- Domain. Evaluated only on news from three Cambodian publishers, collected in SeptemberβOctober 2026. Accuracy on social media, government documents, informal or older text is untested and likely lower.
- Organization boundaries are the main weakness (about 69 ORG F1 on held-out). Long institutional names are sometimes cut short or split into designator plus name.
- Small evaluation sets. 307 entities in total, labelled by the same process as the training data. There has been no independent second-annotator agreement study.
- Segmentation. It relies on khmer-nltk word segmentation. Unusual spellings and transliterated foreign names can be segmented in ways that hurt boundaries.
- Scores in the output are model confidences, not calibrated probabilities of correctness.
License and attribution
- This model and the
neamcode are released under Apache-2.0. - Base model:
seanghay/albert-khmer-small(Apache-2.0). - Training data:
whoisjones/fiNERweb(MIT).unimelb-nlp/wikiann. Its license is listed as unknown on the Hub; it is derived from Wikipedia.- News articles remain the property of their publishers and are not redistributed.