cs.CLNov 25, 2026
SaveTokenisation is not in APX
Organizations: Department of Computer Science, ETH Zürich
Abstract
In this paper, we prove that, unless P=NP, no polynomial-time algorithm can find a tokeniser whose objective is within any constant factor of the optimum, meaning that tokenisation is not in the APX complexity class. We prove this for direct and bottom-up tokenisation, under both a compression or unigram log-likelihood objectives, and for binary or larger alphabets. We further show that, even over unary alphabets, direct tokenisation is APX-hard, and thus admits no polynomial-time approximation scheme.
Figures & tables
Figure 1: Approximation ratios ruled out for tokenisation, assuming . A ratio of means exact solutions ( -hardness), some constant ( -hardness), and “any ” every constant (not in ). Under compression, is achieved by character-level tokenisation.
Appendix figures & tables7 assets
Supplementary material from the paper’s appendix.
Appendix
Figure 2: (a) Each symbol becomes blocks {\color[rgb]{0.9961,0.3789,0}\texttt{enc}}_{j}({\color[rgb]{0.3281,0.4961,0.9375}c}) , each a start marker {\color[rgb]{0.3281,0.4961,0.9375}1}{\color[rgb]{0.3281,0.4961,0.9375}1} followed by an identifier of ({\color[rgb]{0.3281,0.4961,0.9375}c},j) . (b) Each boundary cuts at most one block, so fewer than boundaries leave some index uncut; the -blocks of each token spell a word, and these words generate .
Figure 3: The -blow-up of a triangle ( Definition 3 ). Each edge becomes a complete bipartite graph between two clusters, drawn in the edge’s colour.
Figure 4: The source string of Eq. 58 , for the path – – and {\color[rgb]{0,0,0}\lambda}=1 (for illustration only, as this graph is not cubic). (a) The graph has four arcs and six walks, {\color[rgb]{0.3281,0.4961,0.9375}aba} , {\color[rgb]{0.3281,0.4961,0.9375}abc} , {\color[rgb]{0.3281,0.4961,0.9375}cba} , {\color[rgb]{0.3281,0.4961,0.9375}cbc} , {\color[rgb]{0.3281,0.4961,0.9375}bab} , and {\color[rgb]{0.3281,0.4961,0.9375}bcb} ; with distinct separators, its source string is {\color[rgb]{0.3281,0.4961,0.9375}\mathbf{w}}={\color[rgb]{0.3281,0.4961,0.9375}aba}{\color[rgb]{0.3281,0.4961,0.9375}\diamond_{1}}{\color[rgb]{0.3281,0.4961,0.9375}abc}{\color[rgb]{0.3281,0.4961,0.9375}\diamond_{2}}{\color[rgb]{0.3281,0.4961,0.9375}cba}{\color[rgb]{0.3281,0.4961,0.9375}\diamond_{3}}{\color[rgb]{0.3281,0.4961,0.9375}cbc}{\color[rgb]{0.3281,0.4961,0.9375}\diamond_{4}}{\color[rgb]{0.3281,0.4961,0.9375}bab}{\color[rgb]{0.3281,0.4961,0.9375}\diamond_{5}}{\color[rgb]{0.3281,0.4961,0.9375}bcb}{\color[rgb]{0.3281,0.4961,0.9375}\diamond_{6}}{\color[rgb]{0.3281,0.4961,0.9375}\#} , of length 4{\color[rgb]{0,0,0}M}+1=25 . (b) A maximum cut, with coloured {\color[rgb]{0,0,0}B} and coloured {\color[rgb]{0,0,0}W} . The two arcs from {\color[rgb]{0,0,0}B} to {\color[rgb]{0,0,0}W} are kept (solid); the other two arcs, and , are merged (dashed) and form the covering set {\color[rgb]{0,0,0}\mathcal{U}}^{\star} of Lemma 6 . (c) Merging these two bigrams shortens every walk by one token (phase 1 of Lemma 7 ). The remaining 3{\color[rgb]{0,0,0}M}+1=19 tokens are then joined by merges (phase 2), so collapsing {\color[rgb]{0.3281,0.4961,0.9375}\mathbf{w}} takes {\color[rgb]{0,0,0}\nu}=2+18=20 merges, as given by Eq. 61 . (d) Keeping arcs which enter and leave the same vertex (here, and at ) leaves a walk with no merged bigram (here, {\color[rgb]{0.3281,0.4961,0.9375}abc} ): the kept arcs of a covering set must form a cut.
Figure 5: The binary encoding of Eq. 59 . (a) The pattern {\color[rgb]{0.3281,0.4961,0.9375}1}{\color[rgb]{0.3281,0.4961,0.9375}1} starts each half-word, and the centre (shaded) starts the second one. (b) Between two consecutive centres (dots) lies {\color[rgb]{0.3281,0.4961,0.9375}\langle a\rangle}\circ{\color[rgb]{0.3281,0.4961,0.9375}0}\circ{\color[rgb]{0.3281,0.4961,0.9375}\langle b\rangle} , so a token containing both reveals both symbols ( Lemma 10 ).
Figure 6: Markers {\color[rgb]{0.3281,0.4961,0.9375}1}{\color[rgb]{0.3281,0.4961,0.9375}1} (tinted) start every half-word, at phases and {\color[rgb]{0,0,0}r} , and centres (shaded, with dots) lie at phase {\color[rgb]{0,0,0}r} ; here {\color[rgb]{0,0,0}r}=7 and {\color[rgb]{0,0,0}q}=15 . The gap to the next marker is {\color[rgb]{0,0,0}r} after a phase- marker and {\color[rgb]{0,0,0}r}+1 after a phase- {\color[rgb]{0,0,0}r} one. The first two markers inside {\color[rgb]{0.8633,0.1484,0.4961}s} are {\color[rgb]{0,0,0}r}+1 apart, so the first of them is a centre ( Lemma 10 ).
Figure 7: A merge forest on the encoding of a source string , with codewords drawn schematically as five characters each and centres in black. Shaded triangles abbreviate subtrees which build a whole codeword; they contain no join, as every codeword contains a single centre. The forest has one join (highlighted), which combines two tokens that each contain a centre. The other two roots have only one child containing a centre each; in particular, the middle root spans codeword {\color[rgb]{0.3281,0.4961,0.9375}\widetilde{a_{3}}} together with the first two characters of {\color[rgb]{0.3281,0.4961,0.9375}\widetilde{a_{4}}} , ignoring codeword boundaries. The forest has {\color[rgb]{0,0,0}Z}=3 roots containing a centre and join, as in the first step of the proof of Lemma 11 .
| Length | c_{{\color[rgb]{0,0,0}B}} | c_{{\color[rgb]{0,0,0}W}} | (c_{i})_{i\in{\color[rgb]{0,0,0}{\color[rgb]{0,0,0}\mathcal{V}}_{{\color[rgb]{0,0,0}J}}}} | |
|---|---|---|---|---|
| {\color[rgb]{0,0,0}B} | ||||
| {\color[rgb]{0,0,0}W} | ||||
| \ell^{{\color[rgb]{0,0,0}B}}_{i} | ||||
| \ell^{{\color[rgb]{0,0,0}W}}_{i} |
Table 1: Formal coefficients of the lengths in Reduction 4 .