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

表征调优

Representation Tuning

Christopher M. Ackerman

AI总结:

本文提出表征调优方法,通过余弦相似度加 token 损失将诚实性相关激活向量直接微调进 LLM,效果优于在线引导且泛化更好,可作为安全措施。

摘要:

激活工程作为一种对大语言模型(LLMs)进行在线控制的手段正变得越来越流行。在本工作中,我们将“用表示感兴趣行为方向的向量进行推理时引导”这一思想扩展为直接将这些向量调优进模型,从而无需在线控制。首先,我们在一个开源 LLM(Llama-2-13b-chat)中识别出与诚实性相关的激活向量。接着,我们证明在生成过程中向残差流激活添加这些向量的正倍数或负倍数,可以使模型输出变得更诚实或更不诚实。然后,我们展示通过微调将这些向量直接写入模型也能达到类似效果,具体做法是使用一种双重损失函数,该函数基于残差流激活与这些向量之间的余弦相似度,并结合标准的基于 token 的损失(“表征调优”)。最后,我们将所得模型对诚实性探测提示的生成结果,与仅使用基于 token 的损失微调得到的模型,以及未调优但进行在线引导的模型进行比较。总体而言,使用余弦相似度加 token 损失将向量微调进模型,其效果强于在线引导,并且比仅使用标准损失具有更好的泛化能力,这表明该方法作为一种安全措施具有潜在实用价值。代码和数据可在 https://github.com/cma1114/representation_tuning 获取。调优后的模型可在 https://huggingface.co/collections/cackerman/representation-tuning-66da1e5ab41cd1b824687d9f 获取。

英文摘要:

Activation engineering is becoming increasingly popular as a means of online control of large language models (LLMs). In this work, we extend the idea of inference-time steering with vectors that represent a behavioral direction of interest to tuning those vectors directly into the model, obviating the need for online control. First, we identify activation vectors related to honesty in an open-source LLM (Llama-2-13b-chat). Next, we demonstrate that model output can be made more or less honest by adding positive or negative multiples of these vectors to residual stream activations during generation. Then, we show that a similar effect can be achieved by fine-tuning the vectors directly into the model, by use of a dual loss function based on the cosine similarity of residual stream activations to the vectors combined with a standard token-based loss ("representation tuning"). Finally, we compare the generations in response to honesty-probing prompts from the resulting models to those from models fine-tuned with a token-based loss alone, and to those from the untuned model subjected to online steering. Overall, fine-tuning the vectors into the models using the cosine similarity plus token loss showed a stronger effect than online steering, and generalized better than using the standard loss, suggesting the potential utility of this approach as a safety measure. Code and data are available at https://github.com/cma1114/representation_tuning. Tuned models are available at https://huggingface.co/collections/cackerman/representation-tuning-66da1e5ab41cd1b824687d9f.

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

↑