[论文解读] Editing Models with Task Arithmetic
本文提出任务向量,一种在权重空间进行的算术方法,用于编辑预训练模型。通过计算微调权重与预训练权重之间的差异,它能够对任务进行否定、相加与类比,从而在不进行额外训练的情况下引导模型行为。
Changing how pre-trained models behave -- e.g., improving their performance on a downstream task or mitigating biases learned during pre-training -- is a common practice when developing machine learning systems. In this work, we propose a new paradigm for steering the behavior of neural networks, centered around extit{task vectors}. A task vector specifies a direction in the weight space of a pre-trained model, such that movement in that direction improves performance on the task. We build task vectors by subtracting the weights of a pre-trained model from the weights of the same model after fine-tuning on a task. We show that these task vectors can be modified and combined together through arithmetic operations such as negation and addition, and the behavior of the resulting model is steered accordingly. Negating a task vector decreases performance on the target task, with little change in model behavior on control tasks. Moreover, adding task vectors together can improve performance on multiple tasks at once. Finally, when tasks are linked by an analogy relationship of the form ``A is to B as C is to D", combining task vectors from three of the tasks can improve performance on the fourth, even when no data from the fourth task is used for training. Overall, our experiments with several models, modalities and tasks show that task arithmetic is a simple, efficient and effective way of editing models.
研究动机与目标
- 提供一种轻量级的后训练机制,在权重空间中沿着任务方向引导模型行为。
- 展示任务向量可以通过取负来遗忘或减少不良行为,且对其他方面的影响最小。
- 证明通过添加任务向量可以得到多任务模型,并且可以提升单任务的性能。
- 探索任务类比,以在数据稀缺的领域或子人群之间迁移知识。
提出的方法
- 将任务向量定义为对一个任务进行微调后的模型权重与同一模型的预训练权重之间的按元素差(τ_t = θ_ft^t − θ_pre)。
- 通过 θ_new = θ + λτ_new 将任务向量应用于模型权重,其中可调标量 λ 通过保留集验证选择。
- 研究任务向量的三种运算:取负 (−τ)、相加 (Στ_i),以及基于类比的组合 (τ_C + (τ_B − τ_A))。
- 在开放式架构(图像和语言模型)上,在多个任务和数据集上评估以评估编辑效用和鲁棒性。
实验结果
研究问题
- RQ1取负任务向量是否会降低目标任务的性能,同时保留对控制任务的性能?
- RQ2添加多个任务向量是否能得到与使用单独微调模型相比具有竞争力的多任务模型?
- RQ3任务类比是否能在目标任务几乎没有标注数据的情况下将改进迁移到该任务?
- RQ4学习率和任务相似性对任务向量有效性有何影响?
主要发现
- 取负任务向量可以显著降低目标任务的性能(例如,在 ViT-L/14 上为遗忘而导致目标准确率平均下降 45.8 个百分点),同时对控制任务几乎不改变。
- 对 GPT-2 的有毒生成提示取负可将有毒生成比例从 4.8% 降至 0.8%,同时让 WikiText-103 的困惑度接近预训练模型(在 0.5 点内)。
- 从多个任务添加任务向量得到的单一模型,性能与使用多个专门模型相比具有竞争力,甚至更好(当合并两个任务时,归一化准确率接近或超过 98.9%;随着向量数量增加,总体多任务准确率提升)。
- 任务类比(A 对 B 如 C 对 D)可以在 D 上获得提升,即使对 D 的数据极少或没有,在情感分析领域的域泛化和子群设置中有所证明。
- 在自然语言处理中,将外部任务向量添加到微调后的 T5 模型可以提高在 GLUE 任务上的目标任务准确率(如 MRPC、RTE、CoLA、SST-2),与零-shot 或基础微调模型相比。
阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。