arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2410.15696cs.CLcs.FL
收藏

作为有限状态转导的分词

Tokenization as Finite-State Transduction

Tokyo Institute of Technology(东京工业大学)

Marco Cognetta, Naoaki Okazaki

AI总结:

本文提出有限状态转导框架来统一编码正则语言的所有可能分词,证明 BPE 和 WordPiece 均适用,并实现引导式生成中模式约束与规范分词的同时满足。

摘要:

分词是现代神经语言模型流水线中的第一步,其中输入文本被转换为子词标记序列。我们从第一性原理出发,引入一个有限状态转导框架,该框架能够高效编码一个正则语言的所有可能分词。然后我们构造性地证明,字节对编码(BPE)和 MaxMatch(WordPiece)这两种流行的分词方案都适用于该框架。对于 BPE 而言,这一点尤其令人惊讶,因为它与上下文无关文法相似,并且它并不按从左到右的顺序对字符串进行分词。该框架的一个应用是引导式生成,即语言模型的输出被约束为匹配某种模式。在这里,模式是在字符级别编码的,这造成了约束与模型子词词汇表之间的不匹配。以往的工作只关注约束输出而不考虑底层分词算法,而我们的框架允许同时约束模型输出以匹配指定模式,同时遵循底层分词器的规范分词。

英文摘要:

Tokenization is the first step in modern neural language model pipelines where an input text is converted to a sequence of subword tokens. We introduce from first principles a finite-state transduction framework which can efficiently encode all possible tokenizations of a regular language. We then constructively show that Byte-Pair Encoding (BPE) and MaxMatch (WordPiece), two popular tokenization schemes, fit within this framework. For BPE, this is particularly surprising given its resemblance to context-free grammar and the fact that it does not tokenize strings from left to right. An application of this is to guided generation, where the outputs of a language model are constrained to match some pattern. Here, patterns are encoded at the character level, which creates a mismatch between the constraints and the model's subword vocabulary. While past work has focused only on constraining outputs without regard to the underlying tokenization algorithm, our framework allows for simultaneously constraining the model outputs to match a specified pattern while also adhering to the underlying tokenizer's canonical tokenization.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑