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 \textit{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.
翻译:在开发机器学习系统时,通常的做法是改进在下游任务上的表现或减少在培训前学到的偏见,改变培训前模式的行为方式,这是发展机器学习系统时的一种常见做法。在这项工作中,我们提出了一个指导神经网络行为的新模式,以\ textit{task矢量为中心。任务矢量在培训前模式的重量空间中指明了方向,因此朝着这一方向的移动可以改善任务绩效。我们通过在对一项任务进行微调后从同一模式的重量中减去培训前模式的重量来建立任务矢量。我们表明,这些任务矢量可以通过诸如否定和添加等算术操作加以修改和合并,并据此对由此形成的模型的行为进行引导。任务矢量减少目标任务的业绩,同时在控制任务的模型行为模式上几乎没有改变。再加任务矢量可以同时提高多项任务的业绩。当任务通过将 " `A'表格与 " B " 类比为 " C " 与 " 联系起来时,我们将这些任务矢量的矢量可以一起修改和组合在一起,将任务从三个任务矢量操作的计算方式结合起来,当我们使用一个简单的进度时,一个任务的任务可以改进一个任务的进度是用于整个编辑任务时,一个任务中的一项任务,一个任务,一个任务就是用于一个简单的任务,一个任务和一个任务,一个任务的任务就是用于一个简单的模型。