功能化器:子词分词的无损功能分解
研究论文 · 2026/09/23
标准子词分词器要么将单词的每种拼写变体(如 hello、Hello、HELLO 和 Héllo)视为无关的词汇条目,从而碎片化嵌入空间,要么通过有损归一化丢弃这些变体。我们提出 Functionalizer,一种无损预分词框架,在分词前将拼写和结构变体分解为组合式操作码/操作数前缀流:一个规范基础词元(操作数)前缀有参数化变换算子(操作码),编码在 Unicode 私用区。我们引入覆盖大小写(CAPITALIZE)、变音符号(13 个专用操作码)和字符重复(REPEAT、MULTIREPEAT)的算子,这些算子完全可逆。在自然语言和代码语料库上,Functionalizer 在无约束穷举条件下以显著更小的词汇表实现完整语料覆盖,将实际词汇槽需求减少最多 19.7%。在 98M 参数 GPT-2 模型上的下游评估显示,Functionalizer 提高了 Python 代码语法有效性(9.12% 对 7.70%),同时减少了自然语言散文中的重复 n-gram 重复。这些发现表明,功能分解可以成为词汇高效、结构感知语言建模的有效机制,并值得在生产规模上进一步验证。
该研究提出了一种创新的无损分词预处理方法,能显著减少词汇表大小并提升代码生成质量,对高效语言建模有实际意义。
Standard subword tokenizers either treat every orthographic variation of a word (such as hello, Hello, HELLO, and Héllo) as unrelated vocabulary entries, which fragments the embedding space, or discard this variation through lossy normalization. We present the Functionalizer, a lossless pre-tokenizer framework that factors orthographic and structural variations into a compositional opcode/operand prefix stream before tokenization: a canonical base token (operand) prefixed by parametric transformation operators (opcodes) encoded in the Unicode Private Use Area. We introduce operators covering casing (CAPITALIZE), diacritics (13 dedicated opcodes), and character repetition (REPEAT, MULTIREPEAT), which are fully reversible. Across natural language and code corpora, the Functionalizer enables complete corpus coverage with significantly smaller vocabularies under unconstrained exhaustion conditions, reducing actual vocabulary slot requirements by up to 19.7%. Downstream evaluations on 98M-parameter GPT-2 models show that the Functionalizer improves Python code syntax validity (9.12% vs. 7.70%) while reducing duplicate n-gram repetition in natural language prose. These findings demonstrate that functional decomposition can be an effective mechanism for vocabulary-efficient, structurally aware language modeling, and motivate further validation at production scale.