Download runtime/HANDOFF.md from iapp/OpenThai2.0-NLP-Core-Lite: direct link, hf CLI and curl.
- Browser
- Download file 34.2 kB
-
https://huggingface.co/iapp/OpenThai2.0-NLP-Core-Lite/resolve/main/runtime/HANDOFF.md
- Command line
-
hf download hf://iapp/OpenThai2.0-NLP-Core-Lite/runtime/HANDOFF.md
-
curl -L -o HANDOFF.md https://huggingface.co/iapp/OpenThai2.0-NLP-Core-Lite/resolve/main/runtime/HANDOFF.md
Hand-off: the OpenThai2.0-NLP-Core-Lite runtime, for iApp's Python package
Status, 2026-12-02: 0.2.2 for PyPI. iapp-ai 2.1.0 (PyPI, 2026-12-01) ships 0.2.1 with the pin >=0.2,<0.3.
The model update below keeps every function and argument, so it comes as 0.2.2, inside that pin: the team uploads
the wheel, and iapp-ai needs no release and no code change (PYPI.md). It was built as 0.3.0 first and renumbered
the same day. 2026-12-01 (late): a model update, now the wheel 0.2.2. Two heads were
trained again on the frozen network, by development data, and scored once on the test sets (the fifth opening): the
head of sentences and clauses also learnt the training articles of ALT (news, CC BY 4.0), and the entity head has a
word table of its own (1M more weights). Sentences are now ahead of the best other segmenter, entities level with the
best other tagger, and clauses 0.6 points lower on average (the table below). Words, POS tags and both kinds of tree
give exactly the same outputs as before. The model files are 30.6 MB, the thresholds −0.75 (sentence) and +0.25
(clause), and the entity head reads one more input, so the 0.2.1 runtime cannot run these files: use 0.2.2.
Before, 2026-12-01: wheel 0.2.1, the release build (the code and model of 0.2.0, with a README for PyPI).
2026-11-30: wheel 0.2.0, after your review of 0.1.0. The private Hugging Face repository
iapp/OpenThai2.0-NLP-Core-Lite holds the model of 2026-11-29 (v3p3dn-b128, with named entities) at its root, the
wheel openthai2_0_nlp_core_lite-0.2.0-py3-none-any.whl beside it, and this guide with the tests in runtime/. The
model files are those of 0.1.0. Nothing is public or released. 2026-12-01: NLP Core goes into iapp-ai[nlp]
as a package of its own, not mixed with the released word segmenter; PYPI.md has the plan. The product
name is OpenThai2.0-NLP-Core-Lite ("NLP Core" in running text; Yacht, 2026-11-24), in the family's pattern
OpenThai<version>-<line>-<variant> like OpenThai2.0-ASR-Streaming. It names no architecture, so the inside can
change without a new name.
One model gives Thai words in three units, sentences, clauses, POS (UD and an ORCHID-based tag set), UD dependency trees, Penn constituency trees and named entities (the 16 types of ThaiNER). It runs on a CPU with NumPy and ONNX Runtime, int8, no GPU and no torch.
What changed after your review (0.2.0)
Thank you for the two reports (Windows: R1, B1-B12 and the proposal for iapp_ai.nlp; macOS: bugs 1-5). Yacht asked
for one more thing at the same time: one call that runs the whole pipeline end to end and returns every result, or
only the tasks asked for, with the parameters and functions your review named.
| Your item | In 0.2.0 |
|---|---|
| Yacht: one call for everything | analyze(text, tasks=None) returns one Document: sentences with their words (Word(id, text, upos, xpos, head, deprel, start, end), your proposal's fields) and trees, clauses (Span), named entities (Entity), all with character offsets; tasks=["pos", "ner"] (or "pos,ner") runs only those networks; doc.to_dict(), doc.to_conllu(); analyze_batch, NLPCore.pipe for streams |
| R1 (blocks release) | the segmenter's dictionary, character table and cut rules are inside the wheel (_wordseg.py, assets/wordseg/, byte-identical to 0.1.2, checked at every build); the wheel needs only NumPy and ONNX Runtime and can go on PyPI or iApp's index. The segmenter's network is no longer loaded |
| B1 | a clause never crosses a sentence boundary. Dev cost: on the clause dev set, 3 more boundaries where the sentence splitter cut inside a gold sentence, F1 80.11 -> 79.94 |
| B2 | brackets of the text are written -LRB- and -RRB- in constituency_parse and word_trees; every tree reads back with a bracket reader |
| B3, B4 | a sentence has at most 300 words (NLPCore(max_sentence_words=...)): a longer one is cut where the model's boundary score is highest. The longest sentence of the dev sets has 201 words, and sent_tokenize gives the same output on all 1,479 dev texts. Your 4,315-word list now parses in 15 pieces, every head an int |
| B5 | a lone surrogate is read as U+FFFD by the model; offsets and outputs are pieces of your text |
| B6, macOS 2-4 | one check everywhere: TypeError for a text that is not a str; ValueError that names the allowed values for unit, tagset, labels, tasks, threads (1 or more), n; unit=None is "short"; the batch functions take any iterable |
| B7 | every task reads the words of the whole text, cut once. On TUD dev from raw text: words F1 89.80 -> 90.04, UPOS 82.18 -> 82.31, LAS 64.18 -> 64.55. The tags in dependency rows and tree leaves are now those of pos_tag |
| B8 | not changed; documented in pos_tag (with unit="minimal" the pieces keep both cuts) |
| B9 | Latin words with accents stay whole in every unit, in tokenize_nbest and in word_trees |
| B10 | a zero-width space, a byte-order mark inside the text and the C0 controls (NUL) separate words like whitespace. The C1 controls stay as they are: OPUS-100 dev has them in mojibake, and changing them changed sentences |
| B11, macOS 5 | an option its task does not use is an error (exit 2); the input splits at line feeds only |
| B12 | HANDOFF.md lists labels; the manifest is read as UTF-8; word_trees guards the empty case |
| your proposal | Word, Entity (unpacks as the old tuple), Span; pos_tag also takes a list of words; batch methods on the class (sent_tokenize_batch, clause_tokenize_batch, pos_tag_batch, ner_batch, dependency_parse_batch, constituency_parse_batch); sentence positions as separate functions (sent_spans, clause_spans; Yacht still decides between these and a flag); to_conllu; Python 3.10-3.14, NumPy 1.26 and ONNX Runtime 1.16 as minimums |
Outputs of 0.1.0 are unchanged for a text of one sentence without the characters above. Speed is unchanged: every
function within 2% of 0.1.0 on the 362 TUD dev sentences, one line per call, one thread; analyze with every task
reads 7,600 characters per second there.
What we ask you to propose
Yacht asked for this wheel to follow OpenThai2.0-LATTE-WordSeg-Lite "both functions and etc", as a guideline, so
that you can propose to Yacht how NLP Core enters iapp-ai. The wheel is that guideline. Its names are ours, not a
decision.
| In the word segmenter's wheel | In this wheel |
|---|---|
distribution openthai2.0-latte-wordseg-lite |
openthai2.0-nlp-core-lite |
import openthai_latte_wordseg_lite |
openthai_nlp_core_lite |
command openthai-latte-wordseg-lite |
openthai-nlp-core-lite, with --task for the other outputs |
tokenize, tokenize_batch, tokenize_nbest |
the same three, with the same arguments and rules |
Segmenter(unit, threads, batch_chars, user_words) |
NLPCore(model_dir, threads, user_words, max_sentence_words) |
| module functions on one shared object, loaded once | the same |
the model inside the wheel, in assets/ |
the same |
| nothing more | analyze (every task, one Document), and word_tokenize, sent_tokenize, clause_tokenize, pos_tag, dependency_parse, constituency_parse, word_trees, ner, ner_batch |
Your proposal answered most of the questions below; 0.2.0 takes its types and conventions. Still to propose:
Names inProposed by us, 2026-12-01, in FUNCTIONS.md: NLP Core in its own moduleiapp_ai.nlpiapp_ai.nlp.corewith the functions of this package, and the classiapp_ai.nlp.NLPCore, which also takesextra_words. The segmenter's names stay as they are (item 2). Tell us before you change a name.Decided by Yacht, 2026-12-01, replacing the decision of 2026-11-23: NLP Core is a package of its own, not mixed with the released segmenter.word_tokenizeword_tokenize,tokenize,word_tokenize_nbest,Tokenizerandiapp-tokenizestay as iniapp-ai2.0.0, with the same output. NLP Core is not an engine of them; it comes under its own names (item 1).How the model shipsDecided by Yacht, 2026-12-01: your option A. The model is its own wheel on PyPI,openthai2.0-nlp-core-lite, which thenlpextra pulls in.PYPI.mdhas the steps.- Defaults.
iapp-airejoins numbers such as 4.1 and reads Thai digits as Arabic digits before the segmenter. Say whether the other tasks get the same text. - Bulk calls. 64 lines per call are 11 to 23% faster. Say which functions get a list call.
- The platforms and Python versions you support, with the test result on each.
Contents
| Where | What it is |
|---|---|
openthai2_0_nlp_core_lite-0.2.2-py3-none-any.whl (repository root) |
the package: __init__.py (the module functions), _runtime.py (NLPCore, the Document types, the engine), _wordseg.py (the segmenter's tables and cut rules), __main__.py (the command line) and assets/ (10 model files, 29.6 MB, int8, with manifest.json; assets/wordseg/ the dictionary and character table) |
runtime/tests/ |
test_basic.py (31 tests, one for each item of your review among them) and golden.json, the stored output of every function and of analyze on 9 texts |
runtime/example.py |
the whole pipeline in one call, then every function, on one text |
runtime/bench.py |
the speed measurement below, through the batch functions |
runtime/README.md |
how to install the wheel and run the tests |
runtime/PYPI.md |
the plan for PyPI through iapp-ai[nlp] (2026-12-01) |
_runtime.py grew from the file you tested as latte_main.py: NLPCore is the class LatteMain, with the API
of 0.2.0 on the same engine. It is generated from the research code, so please report a problem instead of editing
it.
Dependencies: numpy (1.26 or later) and onnxruntime (1.16 or later), Python 3.10 or later. The word segmenter's
character ids, dictionary and cut rules (from _runtime.py of OpenThai2.0-LATTE-WordSeg-Lite 0.1.2, the file
iapp-ai ships as iapp_ai.nlp.tokenizer.latte) are inside the wheel. The words themselves come from this model's
own character network.
API
from openthai_nlp_core_lite import analyze # one shared model, loaded once
doc = analyze(text) # every task: a Document
doc = analyze(text, tasks=["pos", "ner"]) # only those tasks ("sentences", "clauses", "words", "pos", "ner",
# "dependency" or "dep", "constituency" or "con"; or "pos,ner")
doc.sentences # [Sentence(text, start, end, words=[Word(id, text, upos, xpos, head, deprel, start, end)], tree)]
doc.words # every word in order; doc.clauses: [Span(text, start, end)]; doc.entities: [Entity(text, label, start, end)]
doc.trees # one Penn tree per sentence
doc.to_dict() # for JSON: only the fields of the tasks that ran
doc.to_conllu() # CoNLL-U, SpaceAfter=No where no whitespace follows
from openthai_nlp_core_lite import (tokenize, tokenize_batch, tokenize_nbest, word_tokenize, sent_tokenize,
sent_spans, clause_tokenize, clause_spans, pos_tag, ner, ner_batch,
dependency_parse, constituency_parse, word_trees, analyze_batch, to_conllu)
tokenize(text, keep_whitespace=True, unit=None) # the word segmenter's three functions, same arguments and rules:
tokenize_batch(texts); tokenize_nbest(text, n=10) # joining the tokens gives back the text
word_tokenize(text, unit=None) # "long", "short" (None) or "minimal"; no whitespace
sent_tokenize(text); sent_spans(text) # sentences, as str or as Span with offsets
clause_tokenize(text); clause_spans(text) # clauses (EDUs), never across a sentence boundary
pos_tag(text_or_words, unit=None, tagset="ud") # [(word, tag)]; "ud" (17 UPOS) or "orchid" (37 tags)
dependency_parse(text) # per sentence: [Word(id, text, upos, xpos, head, deprel, start, end)]
constituency_parse(text, inside_words=False, labels="tag") # per sentence: a Penn tree; labels with inside_words
word_trees(text, labels="tag") # per long word: its inside, down to the minimal pieces
ner(text); ner_batch(texts) # [Entity(text, label, start, end)]; unpacks as (text, label, start, end)
from openthai_nlp_core_lite import NLPCore
nlp = NLPCore(model_dir=None, threads=1, user_words=(), max_sentence_words=300)
nlp(text, tasks=None) # = nlp.analyze; nlp.pipe(lines, tasks, batch_size=256) for streams
nlp.sent_tokenize_batch(texts); nlp.clause_tokenize_batch(texts); nlp.pos_tag_batch(texts, tagset="ud")
nlp.dependency_parse_batch(texts); nlp.constituency_parse_batch(texts, inside_words=False, labels="tag")
openthai-nlp-core-lite --task all < input.txt > output.jsonl # one JSON object (the Document) per input line
openthai-nlp-core-lite --task pos,ner < input.txt # some tasks, JSON
openthai-nlp-core-lite --format conllu < input.txt # dependency trees in CoNLL-U
openthai-nlp-core-lite --task ner "..." # one task as text, as in 0.1.0
- Only what a call needs runs.
word_tokenizeruns the character network alone;pos_tagnever loads the parse heads;analyze(text, ["pos", "ner"])runs those two heads. A process with words and POS peaks at 113 MB, one with every function, NER included, at 143 MB (maximum resident memory on the 362 TUD dev sentences, one thread, 2026-11-29). - Every task reads the same words: the model cuts the whole text once (B7). POS tags and entities are read on the
whole text, as
pos_tagandneralways did; the parsers read one sentence at a time on those words, as they were trained. - Sentences start where the model's sentence score is at least −0.75, clauses where the clause score is at least
+0.25, and at every sentence start (B1). (Until 0.2.1: −1.00 and 0.0, the choice for the earlier head.) Both thresholds were picked on dev sets at one thread and are stored in the
manifest. A line break always ends a sentence. A sentence has at most
max_sentence_wordswords (300): a longer one is cut where the boundary score (the larger of the sentence and clause scores) is highest in its middle half. - Before the model reads a text: a zero-width space, a byte-order mark inside the text and the C0 controls become spaces, a lone surrogate becomes U+FFFD. The text keeps its length, so offsets and returned words are pieces of your text.
- POS on long and minimal words: the tags are computed on short words, the unit the heads were trained on. A long
word takes the tags of its first short word; on long words that join several gold words this gives 94.5% UPOS,
against 89.1% when the model reads the long words directly. A minimal piece gets its own tags (see the inside
of words below); where minimal and short words disagree, both cuts are kept, so these pieces can be finer than
word_tokenize(unit="minimal")(B8). On a list of words,pos_tagtags each word as it is (a word of whitespace only getsSPACE). - Penn trees carry phrase labels and ORCHID-based word tags (those of
pos_tag(tagset="orchid")). They have no function tags (-SBJ, -TMP) and no empty elements, which the gold trees have. Parsing reads short words only. Brackets of the text are written-LRB-and-RRB-. - The inside of words (
word_trees, andconstituency_parse(inside_words=True)): a long word is a node over its short words, and a short word a node over its minimal pieces, each piece with its own tags. The head is the first piece, but the second after พระ, พวก, ได้. Names (PROPN), numbers and words of Latin letters or digits stay flat.labels="tag"gives(VINT (VINT เดิน) (NCMN ทาง)),labels="phrase"gives(VP (VINT เดิน) (NP (NCMN ทาง))). - Named entities: the 16 types of ThaiNER (PERSON, ORGANIZATION, LOCATION, DATE, TIME, MONEY, PERCENT, LAW, ...),
tagged on the model's short words and decoded as valid BIO, with character offsets into the text. For example
กรมอุตุนิยมวิทยาประกาศเตือนฝนตกหนักในจังหวัดเชียงใหม่ตั้งแต่วันที่ 3 ธันวาคม 2569gives[Entity('กรมอุตุนิยมวิทยา', 'ORGANIZATION', 0, 16), Entity('จังหวัดเชียงใหม่', 'LOCATION', 37, 53), Entity('3 ธันวาคม 2569', 'DATE', 67, 81)]. The head learnt from our own silver data only: our corpus text labelled by Qwen3.8-27B (Apache-2.0) and by a teacher trained on those labels, no ThaiNER text (Yacht approved its release use, 2026-11-29).
Word segmentation: NLP Core next to the shipped segmenter
Yacht's decision (2026-12-01): NLP Core is a package of its own, not mixed with OpenThai2.0-LATTE-WordSeg-Lite. In
iapp-ai, the functions of the released segmenter keep their output, and NLP Core gives its words through its own
functions. This replaces the decision of 2026-11-23, under which word_tokenize would have taken this model's
words. The facts below still hold.
- For the code:
tokenize,tokenize_batchandtokenize_nbesthave the segmenter's arguments and rules (every whitespace character a token unlesskeep_whitespace=False, runs of Latin letters or digits never split, the same characters where a word may not start,user_wordsas hints, the n-best lattice of dictionary words and of the three units). A caller of the segmenter's wheel can switch by changing the import. - What is the same as the released segmenter: the LATTE method (characters with the dictionary-lattice bits into a small BiLSTM, distilled from teachers), its dictionary and character table, its cut rules, its three units and its interface.
- What is not: the network's weights are new, trained from scratch together with sentences, clauses, POS and
parsing. On 493 dev paragraphs, 1.68% of its short tokens are not tokens of release 0.1.2 (1.78% the other way
round), 1.76% of its long words (1.72%) and 0.50% of its minimal pieces (0.36%). Its word F1 ties 0.1.2 in all
three units on the seven test sets of OpenThai2.0-WordSeg-Benchmark 1.0 (2026-11-29):
short85.7 against 85.6, +0.04 [−0.09, +0.19]. The LATTE-WordSeg-Lite paper's and model card's numbers belong to the released segmenter. - So, in marketing: the new model is OpenThai2.0-NLP-Core-Lite, with no architecture name in its name, tagline or
card (Yacht, 2026-11-24: "we may update the architecture"; this replaces the earlier plan of presenting it as
LATTE-WordSeg-Lite inside the new model). Accurate: "NLP Core's words tie LATTE-WordSeg-Lite on the test sets of
OpenThai2.0-WordSeg-Benchmark" (word F1 85.7 against 85.6, unit
short). Not accurate: "the same model", "identical output", or the paper's numbers for this model. - The released segmenter stays the small option for words only: 1.17M parameters, a 3.0 MB graph and a 0.8 MB dictionary, against 28 MB here.
Quality
On held-out test sets, opened once for this model on 2026-11-29. Our earlier models were scored on the same sets
before, each after its settings were fixed on dev: three times on the sentence and POS sets, twice on the clause,
dependency and Penn sets, once on the word sets, and LATTE-WordSeg-Lite on the word sets. ThaiNER test was opened
for the first time. Before 2026-11-18 we also looked at test scores of earlier models during development. Nothing of
this model was chosen on them, and its training text was filtered against every test set. Each comparison is a
paired bootstrap with its 95% interval. Full tables: the research repository, docs/competitors.md.
On 2026-12-01 each compared system was given what this model gets (most were run again; the Stanza 1.15 runs without
the splitter date from 2026-11-17): SaT-12l-sm with its threshold chosen on the same development sets, Stanza and
attaparse with their sentence splitter off (this model reads each line as one sentence), and phayathaibert-thainer,
like thainer-v2, on the first piece of each newmm word. The table gives those runs. The same day, after them, the
fifth opening scored the two heads trained again (sentences and clauses, named entities); their rows are below.
| Task | This model | SOTA system, with the difference and its 95% interval |
|---|---|---|
| Sentences, mean F1 of 12 sets (4 sets, each spaced, without spaces, as ASR text) | 78.6 | SaT-12l-sm, its threshold chosen on the same development sets, 77.5: +1.14 [+0.33, +1.96], it leads. Spaced text −0.46 [−1.41, +0.46], a tie; without spaces +2.00 [+0.47, +3.55]; ASR text +1.87 [+0.30, +3.46]. At its default threshold SaT scores 74.6. The earlier head: 78.1 |
Words, word F1, mean of the 7 test sets of OpenThai2.0-WordSeg-Benchmark 1.0, unit short |
85.7 | SEFR CUT best 84.5: +1.17 [+0.84, +1.54]. LATTE-WordSeg-Lite 0.1.2 85.6: +0.04 [−0.09, +0.19], a tie |
| Clauses, boundary F1 (TUD, PUD, TDT) | 73.1, 71.8, 67.5 | our clause teacher (XLM-R large): −2.35 [−4.33, −0.45] (it leads), +2.62, a tie. The earlier head: 74.9, 71.3, 68.0. Outside tools learnt other ideas of a clause and score far lower: HoogBERTa-SENTENCE-lst20 26.9, 35.5, 27.7; a unit at every space 31.6, 27.1, 31.4; PyThaiNLP 5.0.5 clause_tokenize never splits; TLTK 1.11 segment() 29.6, 26.3, 29.5 |
| POS, UPOS accuracy at gold words (TUD, PUD, TDT) | 92.0, 77.8, 79.3 | the strongest per set: Stanza 1.15 accurate +0.68 [+0.17, +1.20] (TUD); Stanza 1.11 accurate (WangchanBERTa) 78.4: −0.60 [−0.91, −0.29], it leads (PUD); Stanza 1.15 default 80.0: −0.76 [−1.45, −0.04], it leads (TDT) |
| Dependencies, LAS at gold words (TUD, PUD, TDT) | 78.8, 60.0, 52.7 | Stanza 1.15 accurate: +2.45, +2.36, +0.53 [−0.55, +1.62] (a tie on TDT) |
| Dependencies, LAS F1 from raw text (TUD, PUD, TDT) | 67.2, 45.8, 45.4 | Stanza 1.15 accurate, its sentence splitter off: +1.66, +3.55, +3.85 |
| Penn trees, bracket F1 (TUD test), gold words / raw text | 80.2 / 79.4 | Stanza 1.15 accurate, converted, its sentence splitter off: +0.67 / +0.81, both ties |
| Named entities, entity F1 from raw text (ThaiNER v2.2 test, 1,472 texts) | 84.7 | phayathaibert-thainer (the engine phayathaibert of PyThaiNLP) on newmm words, its best from raw text, 85.7: −0.99 [−2.25, +0.28], a tie; on the 1,385 texts that share no text with ThaiNER train −0.62 [−1.89, +0.64], a tie. thainer-v2 in the same call 82.8: +1.84 [+0.55, +3.12] (+2.00 on those texts). The earlier head: 84.1 (−1.60 against phayathaibert-thainer). This model is 19 times as fast as phayathaibert-thainer |
- On the paper's version of the TUD test set (TUDP, gold words), the systems trained on the paper's training split lead: in POS, Stanza 1.11 accurate by 1.35 [0.74, 1.96] and the TUD paper's tagger by 0.75 [0.16, 1.37]; in dependencies, the TUD paper's best parser (Stanza with PhayaThaiBERT, its stored predictions) by 1.16 LAS [0.17, 2.17] and 1.44 UAS [0.50, 2.41].
- Systems that the release cards mark as trained on PUD itself (PyThaiNLP's PUD tagger, several of Yasuoka's models and PyThaiNLP's transformer parsers) lead on PUD by up to 20 UPOS and 33 LAS points; they are left out of the comparison.
- Named entities: phayathaibert-thainer, thainer-v2 and Porameht's WangchanBERTa model learnt from ThaiNER train, whose text overlaps 87 test texts; this model learnt from no ThaiNER text. Called as PyThaiNLP calls them, from raw text, they score 20.3, 61.3 and 61.5 (phayathaibert-thainer tags the pieces of the uncut text, the other two every piece of the newmm words). The PyThaiNLP CRF, trained on ThaiNER v1.3, which holds all but 23 of the test texts, scores 74.2. On ThaiNER's own gold words, the setting of its card, thainer-v2 scores 85.2: against this model from raw text −1.12 [−2.30, +0.08], a tie. phayathaibert-thainer scores 88.2 there.
- Every number here is recomputed from the stored outputs by the benchmarks: OpenThai2.0-WordSeg-Benchmark 1.0 (published) for words, and OpenThai2.0-NLP-Core-Benchmark 1.1 for sentences, clauses, POS, dependencies, Penn trees and named entities (built locally; the private repository on Hugging Face still holds 1.0).
- No other system parses Thai constituents, so the dependency trees of Stanza were converted by the converter that made the gold trees. The gold Penn trees are converted from TUD's dependency trees, not drawn by hand; by a review of 50 trees, about 6 in 50 have a structural error from the converter and 21 in 50 one from TUD's own annotation.
- Words: SEFR CUT and DeepCut lead on BEST (97.6 and 97.5 against 86.8). They learnt from BEST 2009, whose
NonCommercial licence keeps it out of this model's training data. On the four sets that allow commercial use this
model leads SEFR CUT
bestby +4.26 [+3.71, +4.90].
Speed
Characters per second (whitespace not counted), one thread on one idle core of an Intel Xeon Platinum 8468, measured
on 2026-11-27 with v3p3c-b128, the same network as this model, and this runtime, in one session with the SOTA
systems of the tasks (the speed table of the paper). The ner row was measured on 2026-11-29 with this model, in a session where
pos_tag ran at 20,300 and 23,300.
The median of five runs. Words and sentences read 493 dev paragraphs (203,775 characters), the other calls the 362
TUD dev sentences (30,001 characters). "64 lines per call" went through the runtime's list calls (tokenize_batch,
and HeadsRuntime.analyze_batch / tag_units for the others), which 0.2.0 exposes as the batch functions above. The
0.2.0 functions run within 2% of these numbers (one line per call, TUD dev, 2026-11-30); analyze with every task
reads 7,600 characters per second.
| Call | One line per call | 64 lines per call |
|---|---|---|
tokenize (words; the character network only) |
54,300 | 61,800 |
sent_tokenize |
25,000 | 30,700 |
clause_tokenize |
20,200 | 23,000 |
pos_tag |
19,800 | 22,000 |
dependency_parse (sentences first) |
8,870 | 10,000 |
constituency_parse (sentences first) |
8,690 | 10,000 |
ner (ner_batch for 64 lines per call) |
17,800 | 20,500 |
The same session, one line per call: LATTE-WordSeg-Lite 82,600 (words), SaT-12l-sm 1,740 (sentences), HoogBERTa 820 (clauses), Stanza 1.15 accurate 286 (tags) and 150 (parses), the PhayaThaiBERT tagger 819 (on PyThaiNLP words, as it is scored). Batches of 64 lines are 11 to 23% faster here (14 to 45% on your laptop), so the wheel now has a batch function for every task.
Checks
- The runtime (then
latte_main.py) against the research runtime, with this model (2026-11-29): identical outputs on 422 dev texts (362 sentences, 60 paragraphs) for every function: the words of the three units,tokenize, sentences, clauses, both tag sets on short, long and minimal words, both parsers, the inside of words andner. - Wheel 0.2.2 (built as 0.3.0 on 2026-12-01, late): 31 tests pass from a clean install (Python 3.12), the 5 iapp-ai tests pass in
iapp-ai 2.0.0 with the module and the hook of FUNCTIONS.md added (36 in all), and
twine check --strictpasses. This runtime and the research runtime give the same output for every function on 422 dev texts. Nothing uploaded. - Wheel 0.2.1 (2026-12-01): the same 31 tests pass from a clean install (Python 3.12), and the 36 tests of the
iapp-ai kit pass in iapp-ai 2.0.0 with NLP Core added;
twine check --strictpasses. python -m pytest testswith wheel 0.2.0 installed in a clean environment (no word segmenter package): 31 tests, all passed on Python 3.10 (NumPy 1.26.4, ONNX Runtime 1.16.3), 3.12 and 3.13 (NumPy 2.5.5, ONNX Runtime 1.32), Linux x86-64, 2026-11-30. They check every function andanalyzeagainstgolden.json, the model files against their sha256, texts without words, one case per item of your review, batches, CoNLL-U, the module functions and the command line. Python 3.14, Windows and macOS: not run here.- The dev checks of 0.2.0 against 0.1.0 (one text per call, one thread): the nine sentence dev sets, 1,479 texts, the same sentences; the clause dev set, 3 of 233 texts changed by B1; TUD dev from raw text, better words, tags and trees by B7 (the numbers in the table above).
- The research package behind the model files passed the head identity check (
check_heads.py, 2026-11-29): its sentences, clauses, POS and dependencies are those of the model as trained, and adding the NER head changed no other head. On 2026-12-01 the package with the two heads trained again passed it against the earlier package: POS, dependencies, Penn trees and the 37 tags identical on the 722 dev texts; this runtime gives the research runtime's output for every function on 422 dev texts (all_identical). ner_batchon ThaiNER dev gives the research runtime's entities for 1,473 of the 1,475 texts in the same order; the other two sit in the batch after a blank text, whichner_batchskips, so their batch holds other texts.
Known limits
- An emoji with a skin-tone or other modifier is split into its parts (from the word segmenter's rules).
- Long words still split some compounds, for example ผู้ว่า | ราชการ.
- The tags of minimal pieces were measured against a blind annotation of 200 words by a model, not a linguist: 75.4% UPOS. Pieces with no meaning of their own are often tagged ADV.
- POS uses TUD's conventions. TUD tags many state words VERB where a dictionary has ADJ.
- A paragraph without sentence boundaries is cut into sentences of at most 300 words at the model's strongest boundaries, which are not always where a reader would cut.
- Another
threadssetting changes the int8 results in the last digits, which can flip a borderline decision: on the clause dev set, 2-3 of 753 boundaries changed between one and two threads.golden.jsonand the tests use one thread, the default. - The int8 results of a text can also change with the other texts of the same call, because the runtime quantizes each call's values together. On ThaiNER dev, 41 of 1,475 texts get other entities one text per call than in calls of 64 (entity F1 85.10 against 85.36; the head of 0.2.1: 37 texts, 84.18 against 83.94). The test score above was made with 64 texts per call.
- Rare entity types are weak. On ThaiNER test: PERSON 94.0, ORGANIZATION 85.6, LOCATION 81.7, DATE 87.0, MONEY 94.4, but FACILITY 46.4 and URL 51.7.
Open decisions before a release
Product nameDecided by Yacht, 2026-11-24: OpenThai2.0-NLP-Core-Lite. Still open: the module and class names, and where the functions sit iniapp_ai.nlp. The names of the wheel (openthai_nlp_core_lite,NLPCore) follow the segmenter's wheel and are a guideline for your proposal.Decided by Yacht, 2026-12-01: the shipped segmenter keepsword_tokenize: the shipped word segmenter or this model?word_tokenize, and NLP Core is a package of its own (this replaces the decision of 2026-11-23). See "Word segmentation: NLP Core next to the shipped segmenter" above.- The NOTICE and licences of the model weights. Traced 2026-11-23, again 2026-11-26 and 2026-11-29 (research
repository,
docs/licence-audit.md; not a lawyer's opinion). The first main model, v3p3-b128, was not cleared for commercial release: the MSR Paraphrase part of scb-mt-en-th-2020 is under Microsoft's non-commercial licence, derivatives included. Its retrain v3p3c-b128 (2026-11-25) left that out, and the rows machine-translated by Google Translate. This hand-off carries v3p3dn-b128 (2026-11-29,pipelines/clean_dn.sh): v3p3c-b128's data with every source filtered against the test and dev sets (an audit on 2026-11-27 found test sentences in the training text of v3p3c-b128), and with POS and dependency labels from teachers trained on UD Thai-TUD alone, so no text of UD English-EWT (LDC, non-commercial) reached it. It ties v3p3c-b128 on every task on test. Its NER head learnt from our corpus text and Blognone news (CC BY 3.0), labelled by Qwen3.8-27B (Apache-2.0) and by a teacher trained on those labels; Yacht approved their release use on 2026-11-29. By the audit, every source allows commercial use; several are ShareAlike, so the weights go out as CC BY-SA 4.0 with attribution, as LATTE-WordSeg-Lite did. NOTICE draft:release/OpenThai2.0-NLP-Core-Lite/NOTICE. Decided by Yacht, 2026-12-01: commercial use as the card states it, without waiting for a legal review. - The label style of the inside of words (
tag, the default, orphrase). Speed on a quiet machineMeasured on 2026-11-27 (Speed, above). Still open: whetheriapp_ai.nlpoffers a list call for bulk work (64 lines per call are 11 to 23% faster, parsing included).R10.2.0 takes the segmenter's tables into the wheel (our proposal; the other way, publishing the segmenter's wheel on PyPI, is open to Yacht).- Sentence positions: separate functions (
sent_spans,clause_spans, in 0.2.0) or aspans=Trueflag. Yacht decides. The licence of the runtime codeDecided by Yacht, 2026-12-01: as for the word segmenter. Apache-2.0 for the code, CC BY-SA 4.0 for the weights, the Unicode licence for part of the bundled dictionary. The Hugging Face repositories stay private for now; before one goes public,runtime/leaves it.
Rebuild
In the research repository: python tools/build_handoff.py assembles the runtime file from the sources, copies
the model files from runs/main and checks their sha256, and tools/handoff_golden.py writes golden.json.
python tools/stage_model_hf.py stages the repository files, and python tools/build_package.py writes the
package and builds the wheel from them.
docs/heads.md explains a head update (retraining one head on the frozen trunk), which changes only that head's
files.