Organizations: iApp Technology, Thailand · OpenThai Laboratory, Thailand · Intelligent Informatics and Service Innovation Research Center, Thailand · Artificial Intelligence Entrepreneur Association of Thailand (AIEAT), Thailand · Sirindhorn International Institute of Technology, Thammasat University, Thailand
Large language models read Thai through subword tokens, without a word segmenter. Yet Thai treebanks, speech metrics and morphological resources are built on words, often at several granularities, and word boundaries resolve ambiguities that subword tokens leave open. LATTE (Lattice ATTentive Encoding) reads a text at several granularities at once, through a lattice of dictionary words, but it is a large GPU model. We distil it into LATTE-WordSeg-Lite, a CPU segmenter of 1.17M parameters that keeps the lattice as features. It outputs compounds, words and morphemes in one pass, and learns only from annotated data and text whose licences allow commercial use. To compare it with other tools, published Thai scores do not suffice, as they come from different files, splits and scorers. We therefore rebuild seven test sets from pinned sources and score twelve systems under one protocol. With the unit that fits each test set, LATTE-WordSeg-Lite scores above DeepCut on five sets, four of them from corpora that its teachers learnt from. Called line by line on one CPU thread, it runs 23 times as fast as DeepCut. We release the model, the benchmark scripts and all predictions.
Figures & tables
Commercial-use licence
Non-commercial licence
Average
System
TUD
PUD
WS160
VISTEC
BEST
ORCHID
khm
All
Commercial
LATTE-WordSeg-Lite
long
83.71
86.18
85.51
92.77
82.09
79.77
71.54
83.08
87.04
short
90.27
84.66
88.32
87.94
86.97
79.10
82.29
85.65
87.80
minimal
85.36
80.34
84.08
76.48
82.09
67.86
98.44
82.09
81.57
khammoon
85.52
79.90
82.87
75.68
(82.17)
67.97
98.33
81.78
80.99
Table 1: Word F1 (%) of twelve systems under one protocol (§ 4 ). The test sets are grouped by licence. The averages weigh each set equally, over all seven sets and over the four whose licence allows commercial use. The three rows of LATTE-WordSeg-Lite are the three units of one network. Its teachers learnt from the corpora of TUD, WS160, VISTEC and khm, without their test lines. Bold marks the highest score of a column, and underline the second highest. A score is in parentheses when the system has seen most of the test lines of that set in training (72 to 100%). Part of such a score may come from memorised lines (§ 4 ), and Section 5.3 measures how much.
Figure 1: The idea, on the phrase “villagers are happy with education”. A bar marks the characters of one word. The glosses are literal, and -ness and -ing stand for two prefixes that form nouns. LATTE reads the characters with every dictionary word that matches them. The phrase has 33 such words, and 14 are drawn. Some are not words of this phrase. LATTE-WordSeg-Lite keeps this input and writes three units from one small network.
Figure 2: Accuracy against speed on one CPU thread (§ 5 ), with LATTE-WordSeg-Lite at its default unit, short . khammoon segments morphemes, and six of the seven sets count words. The LATTE teacher, a GPU model, is placed at its speed on the same CPU thread.
Figure 3: How LATTE-WordSeg-Lite is made. A grey bar is a line of text, and the coloured bars under it are its words in one unit. Each corpus is annotated in one unit. The teachers label raw text with all three units, here the phrase of Figure 1 , and the student learns from these labels. Sections 3.1 to 3.4 take the four steps in turn.
Figure 4: The lattice of a string of five characters, drawn as in the LATTE paper ( Chay-intr et al., 2023 ) . A link joins a node to each node that begins where it ends, so each path from s to e is one reading. Four of its seven dictionary words are drawn.
Figure 5: What happened to the lines of each test set, with the number of lines kept. The scores of the systems named in dark red are in parentheses in Table 1 . Grey lines are in the training text of no system of the table. The right column gives the share of lines with a copy or near-copy in the training text of our models (Appendix C ).
Set
Text
Lines
Words
Unit
TUD
Wikipedia, TNC
363
7.7k
short
PUD
news, Wikipedia
1,000
22.3k
long
WS160
social media
160
3.4k
short
VISTEC
social media
10,000
677k
long
BEST †
four genres
13,072
487k
short
ORCHID †
technical papers
1,747
24.1k
long
Table 2: Test sets. TNC is the Thai National Corpus. BEST and ORCHID are de-duplicated. Unit is the unit of LATTE-WordSeg-Lite closest to the words of a set (§ 4 ). † The non-commercial sets are rebuilt by script and are not redistributed (Appendix C ).
Figure 6: One line of TUD with literal glosses (“until finally he founded a cult to worship the great god”), and the output of newmm as the system. The two cuts next to the space are given to every system, and boundary F1 therefore does not count them.
System
Chars/s
Our model is
PyThaiNLP nlpO3
5.06M
85 × slower
PyThaiNLP newmm
937K
16 × slower
LATTE-WordSeg-Lite , batched
105K
–
AttaCut-C
100K
1.7 × slower
AttaCut-SC
78K
1.3 × slower
LATTE-WordSeg-Lite , per line
60K
–
Table 3: Characters per second on one CPU thread. All but the teacher segment the same 768 lines, model loading left out (Appendix A ). The last column compares each tool with our row called the same way, batched for khammoon, SEFR CUT and the teacher.
Model
long
short
minimal
LATTE teachers
82.92
85.57
81.82
LATTE-WordSeg-Lite
83.08
85.65
82.09
Single-unit students
83.04
85.54
82.02
Corpus-trained networks
80.94
83.50
81.73
Student without lattice bits
82.78
85.45
82.08
Table 4: From the teachers to the student, as mean word F1 (%) over the seven test sets at each unit. The teachers are scored by their labels, thresholded at 0.5, which the student learnt. The other rows are networks of the size of the student, each from one run. A single-unit student has one output and learns the same labels. A corpus-trained network has one output too, and learns the corpora of its unit alone (Appendix E ).
Appendix figures & tables14 assets
Supplementary material from the paper’s appendix.
Appendix
System
Version
Model
Parameters
Learnt from
Exposed sets
LATTE-WordSeg-Lite
0.1.2
long , short , minimal
1.17M
VISTEC, TUD, Wisesight-1000, khammoon
–
khammoon
0.1.0
ONNX
1.06M
text of BEST and WangchanThaiInstruct, its own LLM labels
BEST
DeepCut
0.7.0.0
–
0.54M
BEST
BEST
SEFR CUT
1.1
best
0.54M + CRF
DeepCut + CRF trained on BEST
BEST
ws1000 (default)
0.54M + CRF
DeepCut + CRF trained on Wisesight-1000
BEST, WS160
AttaCut
1.0.6
SC , C
0.16M, 0.17M
BEST
BEST
Appendix
Table 5: The systems compared, with their version, model or engine, parameters, training data and exposed test sets. Parameters are counted from the released weights, and those of AttaCut are from its paper.
System
Characters per second
Peak memory (MB)
PyThaiNLP nlpO3
5,056,595
90
PyThaiNLP newmm
936,850
101
LATTE-WordSeg-Lite , batched
104,709
136
AttaCut-C
99,619
437
AttaCut-SC
78,500
433
LATTE-WordSeg-Lite , per line
59,588
–
Appendix
Table 6: Speed on one CPU thread and peak memory, as measured.
Engine
TUD
PUD
WS160
VISTEC
BEST
ORCHID
khm
Avg
newmm (Table 1 )
69.64
67.96
73.35
76.88
69.13
79.17
60.18
70.90
newmm-safe
69.66
67.96
73.35
76.87
69.13
79.17
60.18
70.90
longest
68.93
67.21
72.27
75.64
68.95
79.16
61.04
70.46
mm
62.00
60.62
65.23
66.98
61.82
73.05
54.23
63.42
nercut
62.00
61.67
64.39
65.95
62.53
72.93
54.41
63.41
Appendix
Table 7: The word tokenisers of PyThaiNLP 5.4.0 (word F1, %), scored as in Table 1 .
Data
Used for
Size
Licence
VISTEC, training split
Teacher 1, long
36,000 lines
CC BY-SA 3.0
UD Thai-TUD, training split
Teacher 1, short
2,902 sentences
CC BY-SA 4.0
Wisesight-1000 without the WS160 lines
Teacher 1, short
747 lines
CC0 1.0
khammoon data, rows under CC BY-SA
Teacher 2, minimal
4,763 documents
CC BY-SA 4.0
Thai Wikipedia, dump of 2023-11-01
soft labels
60.0M characters
CC BY-SA
Wisesight sentiment, train and validation
soft labels
1.9M characters
CC0 1.0
Appendix
Table 8: Everything LATTE-WordSeg-Lite was trained on or built from, with the size used and the licence.
LATTE teachers
LATTE-WordSeg-Lite student
Encoder
XLM-RoBERTa-large
64-d characters; convolutions 3, 5, 7 ( × 128)
Layers on top
two lattice-attention layers, 8 heads
two BiLSTM layers, 128 units per direction
Lattice
words of up to 16 characters, as nodes
13 bits per character, as 32 dimensions
Output
one CRF per training corpus
one logit per unit
Parameters
634.6M
1.17M (1,168,771)
Labels
corpus labels (Table 8 )
teacher probabilities, 69.1M characters
Appendix
Table 9: Settings of the LATTE teachers and of the LATTE-WordSeg-Lite student, whose best checkpoint is step 54,000. Where two values are given, the first is for Teacher 1 and the second for Teacher 2.
Set
Host
Repository
Revision
Licence
TUD
GitHub
UniversalDependencies/UD_Thai-TUD
d4cb5fd3
CC BY-SA 4.0
PUD
GitHub
UniversalDependencies/UD_Thai-PUD
4e0e10fd
CC BY-SA 3.0
WS160
GitHub
PyThaiNLP/wisesight-sentiment
6995f993
CC0 1.0
VISTEC
GitHub
mrpeerat/OSKut
be9e16ac
CC BY-SA 3.0
BEST
Hugging Face
nectec/best2009
685fffc4
CC BY-NC-SA 3.0
ORCHID
GitHub
wannaphong/corpus_mirror
orchid-v1.0 (tag)
CC BY-NC-SA 3.0
Appendix
Table 10: Source, pinned revision and licence of each test set.
Set
Lines
Student
Any
TUD
363
3
5
PUD
1,000
0
0
WS160
160
5
5
VISTEC
10,000
1
157
BEST
13,072
13
15
ORCHID
1,747
9
11
Appendix
Table 11: Test lines with a copy or near-copy in the training text of the student (Student), or in that text and the training data of the two teachers (Any).
Kept as published
Where
The text of the treebank differs from the original sentence (in the third by eleven added spaces)
PUD (ids 72, 611 and 979)
A space between every word
TUD (id 300)
Literal <POEM> markup; a byte-order mark
BEST (54 lines; 4 lines)
Word lines drop what follows a slash ( TCP/IP becomes TCP ); a literal %@PUNC
ORCHID (all such words; 1 line)
A gold word that is only a zero-width space
khm (16 words), WS160 (1)
A gold word that starts with a combining mark, which no segmenter that keeps grapheme clusters can produce
VISTEC (19 words), ORCHID (29), BEST (5)
Appendix
Table 12: Defects of the sources, kept as published, and the effect of our rule that a space separates words. An id is the id field of a line in our test file of that set, counted from zero.
Test file and scoring
System
Source
Published
Ours
WS160, spaces kept
DeepCut
OSKut paper
93.47 / 84.03
93.47 / 84.03
DeepCut
SEFR CUT paper
93.8 / 84.0
93.47 / 84.03
AttaCut-SC
OSKut paper
93.50 / 84.04
93.37 / 83.58
AttaCut-SC
SEFR CUT paper
93.5 / 84.0
93.37 / 83.58
SEFR CUT-ws1000
SEFR CUT paper
95.2 / 87.4
95.17 / 87.40
OSKut-ws
OSKut paper
96.67 / 91.51
96.67 / 91.50
Appendix
Table 13: Published scores and our runs, scored as in each source, in %. Where two numbers are given, they are the character-level and the word-level F1. The sources are Table 3 of the SEFR CUT ( Limkonchotiwat et al., 2020 ) and OSKut ( Limkonchotiwat et al., 2021 ) papers, the benchmark page of the AttaCut documentation, whose word-level values are Table 2 of its paper ( Chormai et al., 2019 ) , the file tokenization-benchmark.md of the PyThaiNLP repository ( Phatthiyaphaibun et al., 2023 ) and Table 6 of the khammoon paper ( Sirichotedumrong et al., 2026 ) . The khammoon paper scores whole documents, and we score the lines of these documents.
Test set
VISTEC
TUD
WS160
khm
Unit
long
short
short
minimal
LATTE teachers
93.66
90.20
88.09
98.36
LATTE-WordSeg-Lite
92.77
90.27
88.32
98.44
LATTE-WordSeg-Lite, second run
92.59
90.10
88.29
98.43
Single-unit students
93.04
90.30
88.67
98.41
Corpus-trained networks
93.62
91.50
86.15
98.29
Appendix
Table 14: Table 4 on the test sets of the corpora of each unit, with the second run (word F1, %).
Identical
Boundary F1
Differing
Gold sides with
Set
Unit
lines (%)
between them
cuts
teachers (%)
student (%)
TUD
short
59.5
98.14
237
50.2
49.8
PUD
long
49.8
97.99
738
35.0
65.0
WS160
short
65.6
97.55
124
47.6
52.4
VISTEC
long
28.9
98.55
15,968
64.5
35.5
BEST
short
42.6
98.18
15,253
43.5
56.5
Appendix
Table 15: The student against the labels of its teachers, each set at its unit. The table gives the lines that both segment identically, the boundary F1 between their cuts and, where their cuts differ, how often gold agrees with each.
Set
Unit
Ours
Versus
F1
Δ [95% interval]
TUD
short
90.27
khammoon
85.52
+4.75 [ +3.19 , +6.21 ]
PUD
long
86.18
DeepCut
85.62
+0.56 [ −0.15 , +1.25 ]
PUD
long
86.18
SEFR CUT-best
85.55
+0.63 [ −0.06 , +1.32 ]
WS160
short
88.32
OSKut-scads
83.20
+5.12 [ +2.88 , +7.33 ]
WS160
short
88.32
SEFR CUT-ws1000
(86.69)
+1.64 [ −0.50 , +3.98 ]
WS160
short
88.32
OSKut-ws
(91.28)
−2.96 [ −4.99 , −1.05 ]
Appendix
Table 16: LATTE-WordSeg-Lite minus other systems in F1 points, with 95% intervals from 1,000 paired bootstrap resamples of lines. Parentheses are as in Table 1 . The clean lines are the VISTEC test lines inside the test split of OSKut-scads. The last row is boundary F1 on whole documents, the protocol of khammoon (10,000 resamples).
Commercial-use licence
Non-commercial licence
Average
System
TUD
PUD
WS160
VISTEC
BEST
ORCHID
khm
All
Commercial
LATTE-WordSeg-Lite
long
92.92
94.23
92.13
96.61
92.18
89.42
86.23
91.96
93.97
short
95.90
93.61
93.98
94.46
94.27
88.92
91.98
93.30
94.49
minimal
93.89
91.69
92.11
88.51
91.85
83.19
99.28
91.50
91.55
khammoon
93.93
91.46
91.38
88.07
(91.91)
83.24
99.22
91.32
91.21
Appendix
Table 17: Boundary F1 (%). This is Table 1 with the second metric, the cuts between two characters, without those next to a space. Columns, bold, underline and parentheses are as in Table 1 .
Key Laboratory of Linguistics, Chinese Academy of Social Sciences (University of Chinese Academy of Social Sciences), Beijing · Rixin College, Tsinghua University, Beijing · Institute of Linguistics, Chinese Academy of Social Sciences, Beijing +2