arXivDaily arXiv每日学术速递 周一至周五更新
​通知:联邦节假日调休:哥伦布日 / 原住民日(Columbus Day / Indigenous Peoples' Day),今日(13日)无更新。
arXiv 2405.01768cs.CLcs.AI

上下文引导:推理时可控的个性化

Context Steering: Controllable Personalization at Inference Time

UC Berkeley(加州大学伯克利分校)

Jerry Zhi-Yang He, Sashrika Pandey, Mariah L. Schrum, Anca Dragan

AI总结:

本文提出无需训练的上下文引导(CoS)解码方法,通过比较有无上下文的前向概率差异并线性缩放,在推理时灵活控制大语言模型个性化程度,并在推荐和文本相关性推断中验证其有效性。

摘要:

为了提供高质量、个性化的回复,大语言模型(LLMs)必须有效地纳入上下文——即特定于最终用户的个人、人口统计和文化信息。例如,在上下文为“我是一个幼儿”时要求模型解释牛顿第二定律,所产生的回复应当不同于上下文为“我是一名物理学教授”时的回复。然而,在实践中利用上下文是一项微妙且具有挑战性的任务,并且通常依赖于具体情境或用户群体。模型必须在提供具体、个性化回复与保持通用适用性之间取得平衡。当前的解决方案,如提示工程和微调,需要收集上下文恰当的回复作为示例,这使得它们在跨不同上下文使用时耗时且灵活性较差。在这项工作中,我们引入了上下文引导(Context Steering,CoS)——一种简单、无需训练的解码方法,可在下一个词元预测中放大上下文的影响。CoS 通过比较两次大语言模型前向传播的输出概率来计算上下文影响:一次包含上下文,一次不包含上下文。通过对上下文影响进行线性缩放,CoS 使实践者能够针对不同用例灵活控制个性化程度。我们表明,CoS 可应用于自回归大语言模型,并在个性化推荐中展现出强大的性能。此外,我们还表明,CoS 可以作为一种贝叶斯生成模型,用于推断和量化开放式文本之间的相关性,从而拓宽其潜在应用。

英文摘要:

To deliver high-quality, personalized responses, large language models (LLMs) must effectively incorporate context -- personal, demographic, and cultural information specific to an end-user. For example, asking the model to explain Newton's second law with the context "I am a toddler" should produce a response different from when the context is "I am a physics professor". However, leveraging the context in practice is a nuanced and challenging task, and is often dependent on the specific situation or user base. The model must strike a balance between providing specific, personalized responses and maintaining general applicability. Current solutions, such as prompt-engineering and fine-tuning, require collection of contextually appropriate responses as examples, making them time-consuming and less flexible to use across different contexts. In this work, we introduce Context Steering (CoS) -- a simple, training-free decoding approach that amplifies the influence of the context in next token predictions. CoS computes contextual influence by comparing the output probabilities from two LLM forward passes: one that includes the context and one that does not. By linearly scaling the contextual influence, CoS allows practitioners to flexibly control the degree of personalization for different use cases. We show that CoS can be applied to autoregressive LLMs, and demonstrates strong performance in personalized recommendations. Additionally, we show that CoS can function as a Bayesian Generative model to infer and quantify correlations between open-ended texts, broadening its potential applications.

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

↑