Task Arithmetic

Task Arithmetic is a model editing technique that represents task-specific knowledge as "task vectors" (the difference between fine-tuned and pre-trained weights) — these vectors can be added, negated, or combined to create models with new task capabilities.

How Does Task Arithmetic Work?

  • Task Vector: $\tau_A = \theta_A - \theta_0$ (difference between fine-tuned $\theta_A$ and pre-trained $\theta_0$).
  • Addition: $\theta_{A+B} = \theta_0 + \tau_A + \tau_B$ (combine capabilities of tasks A and B).
  • Negation: $\theta_{-A} = \theta_0 - \tau_A$ (remove task A capabilities, e.g., forget toxic behavior).
  • Scaling: $\theta_0 + \lambda \tau_A$ (control the strength of task A).
  • Paper: Ilharco et al. (2023).

Why It Matters

  • Model Editing: Add, remove, or modify model capabilities without retraining.
  • Multi-Task: Combine task-specific fine-tunes into a single multi-task model.
  • Safety: Negate toxic task vectors to reduce harmful model behaviors.

Task Arithmetic is algebra for neural network capabilities — adding and subtracting task knowledge using simple vector operations in weight space.

Take task arithmetic further

Ask the copilot about this term, or have our engineers assess it against your process.