arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2409.17027cs.LGcs.AIcs.CL
收藏

大型语言模型中的反事实令牌生成

Counterfactual Token Generation in Large Language Models

Max Planck Institute for Software Systems(马克斯·普朗克软件系统研究所)

Ivi Chatzi, Nina Corvelo Benz, Eleni Straitouri, Stratis Tsirtsis, Manuel Gomez-Rodriguez

AI总结:

本文提出一种基于Gumbel-Max因果模型的反事实令牌生成方法,使大型语言模型能以零额外成本生成反事实文本,无需微调,并应用于偏见检测。

摘要:

“当然,我很乐意为您生成一个故事:莱拉船长站在她信赖的船‘风暴之怒’号的舵轮旁,凝视着无边无际的大海。[...] 莱拉的眼眶湿润了,因为她意识到一个残酷的事实——她为了短暂的财富牺牲了一切,却失去了船员的爱、家人的爱,以及她自己的爱。”尽管这个由大型语言模型生成的故事引人入胜,但人们可能会好奇——如果模型选择了“梅芙船长”作为主角,故事会如何展开?我们无从知晓。最先进的大型语言模型是无状态的——它们不维护内部记忆或状态。给定一个提示,它们通过自回归过程生成一个令牌序列作为输出。因此,它们无法对过去生成的令牌进行反事实推理。在这项工作中,我们的目标是增强它们这一功能。为此,我们开发了一个基于Gumbel-Max结构因果模型的令牌生成因果模型。我们的模型允许任何大型语言模型以几乎零额外成本(与普通令牌生成相比)执行反事实令牌生成,实现起来极其简单,且无需微调或提示工程。我们在Llama 3 8B-Instruct和Ministral-8B-Instruct上实现了我们的模型,并对反事实生成的文本进行了定性和定量分析。最后,我们展示了反事实令牌生成在偏见检测中的示范应用,揭示了对大型语言模型构建的世界模型的有趣见解。

英文摘要:

"Sure, I am happy to generate a story for you: Captain Lyra stood at the helm of her trusty ship, the Maelstrom's Fury, gazing out at the endless sea. [...] Lyra's eyes welled up with tears as she realized the bitter truth - she had sacrificed everything for fleeting riches, and lost the love of her crew, her family, and herself." Although this story, generated by a large language model, is captivating, one may wonder -- how would the story have unfolded if the model had chosen "Captain Maeve" as the protagonist instead? We cannot know. State-of-the-art large language models are stateless -- they maintain no internal memory or state. Given a prompt, they generate a sequence of tokens as an output using an autoregressive process. As a consequence, they cannot reason about counterfactual alternatives to tokens they have generated in the past. In this work, our goal is to enhance them with this functionality. To this end, we develop a causal model of token generation that builds upon the Gumbel-Max structural causal model. Our model allows any large language model to perform counterfactual token generation at almost no cost in comparison with vanilla token generation, it is embarrassingly simple to implement, and it does not require any fine-tuning nor prompt engineering. We implement our model on Llama 3 8B-Instruct and Ministral-8B-Instruct and conduct a qualitative and a quantitative analysis of counterfactually generated text. We conclude with a demonstrative application of counterfactual token generation for bias detection, unveiling interesting insights about the model of the world constructed by large language models.

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

↑