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

语言模型的转化

Transducing Language Models

ETH Zürich(苏黎世联邦理工学院);University of Copenhagen(哥本哈根大学);CHI-FRO

Vésteinn Snæbjarnarson, Samuel Kiegeland, Tianyu Liu, Reda Boumasmoud, Ryan Cotterell, Tim Vieira

AI总结:

本文提出了一种基于确定性字符串到字符串转换的通用语言模型框架,通过有限状态机实现对不同输出格式的适应性转换。

摘要:

现代语言模型定义了字符串上的分布,但下游任务往往需要不同的输出格式。例如,一个生成字对字符串的模型并不直接生成词级预测,而一个DNA模型也不直接生成氨基酸序列。在这种情况下,一个确定性的字符串到字符串转换可以将模型的输出转换为所需的形式。这在概率论中是一个熟悉的模式:对随机变量X~p应用函数f,得到一个变换后的随机变量f(X),具有诱导分布。虽然这种变换偶尔在语言建模中被使用,但先前的工作并未将其视为产生新的、完全功能的语言模型。我们正式阐述了这一观点,并介绍了一种通用的语言模型框架,该框架基于确定性的字符串到字符串转换。我们专注于可以表示为有限状态机的转换——一种常用于高效字符串到字符串映射的状态机抽象。我们开发了将语言模型与FST组合的算法,以对映射到给定目标的源字符串进行边缘化,通过转换器传播概率,而无需改变模型参数,从而实现对转换输出的条件化。我们提出了一个精确的算法、一个高效的近似算法以及理论分析。我们在三个领域进行了实验:将语言模型从令牌转换为字节、从令牌转换为词,以及从DNA转换为氨基酸。这些实验展示了预训练语言模型在推理时间适应以匹配应用特定的输出要求。

英文摘要:

Modern language models define distributions over strings, but downstream tasks often require different output formats. For instance, a model that generates byte-pair strings does not directly produce word-level predictions, and a DNA model does not directly produce amino-acid sequences. In such cases, a deterministic string-to-string transformation can convert the model's output to the desired form. This is a familiar pattern in probability theory: applying a function $f$ to a random variable $X\sim p$ yields a transformed random variable $f(X)$ with an induced distribution. While such transformations are occasionally used in language modeling, prior work does not treat them as yielding new, fully functional language models. We formalize this perspective and introduce a general framework for language models derived from deterministic string-to-string transformations. We focus on transformations representable as finite-state transducers -- a commonly used state-machine abstraction for efficient string-to-string mappings. We develop algorithms that compose a language model with an FST to *marginalize* over source strings mapping to a given target, propagating probabilities through the transducer without altering model parameters and enabling *conditioning* on transformed outputs. We present an exact algorithm, an efficient approximation, and a theoretical analysis. We conduct experiments in three domains: converting language models from tokens to bytes, from tokens to words, and from DNA to amino acids. These experiments demonstrate inference-time adaptation of pretrained language models to match application-specific output requirements.

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

↑