在有限字母表上进行分词是困难的
Tokenisation over Bounded Alphabets is Hard
AI总结:
在有限字母表上分词的难度研究显示,无论字母表大小如何,分词问题均为NP完全,且无多项式时间近似方案,揭示了分词计算不可行性的根本原因。
摘要:
最近的研究表明,分词是NP完全的。然而,这些研究假设分词应用于具有无界大字母表的输入——这是一个不现实的假设,因为实际中分词器操作在固定大小的字母表上,例如字节或Unicode字符。我们通过分析在有限的n进制字母表上进行分词来填补这一空白,考虑两种自然变体:自底向上的分词和直接分词,其中分别需要选择一系列合并操作或一个词汇表,其应用可以最优地压缩数据集。首先,我们注意到证明对于n进制字母表的难度结果,等同于证明对于任何更大大小的字母表的相同结果。然后我们证明,即使在二进制字母表上,两种变体不仅NP完全,而且除非P=NP,否则不具有多项式时间近似方案。我们进一步证明,即使应用于一进制字母表,直接分词仍然NP完全。虽然一进制字母表可能不具实际用途,但这一结果表明,分词的计算不可行性不是大字母表或复杂构造的产物,而是一个根本性的障碍。总体而言,我们的结果解释了为什么实际算法如BPE和UnigramLM是启发式的,并指出了近似算法是分词研究未来的重要路径。
英文摘要:
Recent works have shown that tokenisation is NP-complete. However, these works assume tokenisation is applied to inputs with unboundedly large alphabets -- an unrealistic assumption, given that in practice tokenisers operate over fixed-size alphabets, such as bytes or Unicode-characters. We close this gap by analysing tokenisation over bounded alphabets, considering two natural variants: bottomup tokenisation and direct tokenisation, where we must, respectively, select a sequence of merge operations or a vocabulary whose application optimally compresses a dataset. We prove that even with binary alphabets, both variants are not only NP-complete, but also APX-hard and thus admit no polynomial-time approximation scheme (unless P=NP). We further show that direct tokenisation remains NP-complete even when applied to unary alphabets. These results establish that the computational intractability of tokenisation is not an artifact of large alphabets or complex constructions, but a fundamental barrier. Overall, our results explain why current practical algorithms such as BPE and UnigramLM are heuristic, and point toward approximation algorithms being an important path going forward for tokenisation research.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。