arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2305.12798cs.CLcs.AIcs.LG
收藏

词嵌入是语言模型的转向器

Word Embeddings Are Steers for Language Models

University of Illinois Urbana-Champaign(伊利诺伊大学厄巴纳-香槟分校)

Chi Han, Jialiang Xu, Manling Li, Yi Fung, Chenkai Sun, Nan Jiang, Tarek Abdelzaher, Heng Ji

AI总结:

本文提出 LM-Steers,证明输出词嵌入的线性变换等价于语言模型风格转向控制,仅需 0.2% 参数量即可在去毒化和情感控制等任务上达到或超越现有方法,并支持可解释性、迁移与组合。

摘要:

语言模型(LMs)在语言语料库上进行预训练时自动学习词嵌入。尽管词嵌入通常被解释为单个词的特征向量,但它们在语言模型生成中的作用仍未得到充分探索。在本工作中,我们从理论和实证两方面重新审视输出词嵌入,并发现它们的线性变换等价于对语言模型生成风格进行转向控制。我们将这类转向器命名为 LM-Steers,并发现它们存在于各种规模的语言模型中。对每种风格进行转向控制所需学习的参数量仅为原始语言模型规模的 0.2%。在语言模型去毒化和情感控制等任务上,与最先进的受控生成方法相比,LM-Steers 能够取得相当或更优的性能,同时在与生成质量的平衡方面表现更好。学习到的 LM-Steer 可作为观察文本风格的透镜:它揭示出词嵌入在与语言模型生成相关联时是可解释的,并且能够突出显示最能体现风格差异的文本片段。LM-Steer 可以通过显式形式计算在不同语言模型之间进行迁移。人们还可以通过简单地缩放 LM-Steer 来连续地转向控制语言模型,或者通过将多个 LM-Steer 的变换相加来组合它们。我们的代码已公开,地址为 \url{https://github.com/Glaciohound/LM-Steer}。

英文摘要:

Language models (LMs) automatically learn word embeddings during pre-training on language corpora. Although word embeddings are usually interpreted as feature vectors for individual words, their roles in language model generation remain underexplored. In this work, we theoretically and empirically revisit output word embeddings and find that their linear transformations are equivalent to steering language model generation styles. We name such steers LM-Steers and find them existing in LMs of all sizes. It requires learning parameters equal to 0.2% of the original LMs' size for steering each style. On tasks such as language model detoxification and sentiment control, LM-Steers can achieve comparable or superior performance compared with state-of-the-art controlled generation methods while maintaining a better balance with generation quality. The learned LM-Steer serves as a lens in text styles: it reveals that word embeddings are interpretable when associated with language model generations and can highlight text spans that most indicate the style differences. An LM-Steer is transferrable between different language models by an explicit form calculation. One can also continuously steer LMs simply by scaling the LM-Steer or compose multiple LM-Steers by adding their transformations. Our codes are publicly available at \url{https://github.com/Glaciohound/LM-Steer}.

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

↑