Papers › Editing Models with Task Arithmetic

Editing Models with Task Arithmetic

8 Dec 2022arXiv:2212.04089archive 2025-07-28

Gabriel Ilharco, Marco Tulio Ribeiro, Mitchell Wortsman, Suchin Gururangan, Ludwig Schmidt, Hannaneh Hajishirzi, Ali Farhadi

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.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2212.04089")

Code

Syntology Ran 5 of 15 code samples harvested from 6 repositories linked to this paper; 10 have no recorded run. Of those that ran: 2 ran · our draft was wrong; 3 ran with no contract checked.

By repository: community (archive-listed): 14 samples from 6 repositories, 4 ran; 1 identical to code first harvested elsewhere. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

mlfoundations/task_vectors officialmentioned in papermentioned on GitHubpytorch report
AntoAndGar/task_singular_vectors mentioned on GitHubpytorch report
EnnengYang/AdaMerging mentioned on GitHubpytorch report
flowritecom/flow-merge mentioned on GitHubpytorch report
idankinderman/fs_merge mentioned on GitHubpytorch report
iurada/talos-task-arithmetic mentioned on GitHubpytorch report
thennal10/fisher-nodes-merging mentioned on GitHubpytorch report
yanyang19/ImPart mentioned on GitHubpytorch report
zibojia/COCOCO mentioned on GitHubpytorch report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

15 samples harvested; 5 ran; 0 honoured the contract we drafted; 10 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

2ran · our draft was wrong
3ran
10unverified

Licence: 4 of the 15 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from 6 repositories linked to this paper, official or community; each sample names its own and says which. Some samples are identical code Syntology first harvested from another repository; for those, this paper's copy is not located and its licence is not recorded. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

Model flowritecom/flow-merge/flow_merge/lib/merge_methods/task_arithmetic.py community (archive-listed) ran Apache-2.0 (permissive) · f075638111e309f6 · report
ModelWeight flowritecom/flow-merge/flow_merge/lib/merge_methods/task_arithmetic.py community (archive-listed) ran Apache-2.0 (permissive) · d4eaf7b390d8c9b0 · report
TaskVector yanyang19/ImPart/merge/task_vector.py community (archive-listed) ran no licence file found · pointer only · 1856c2a053748d8a · report
symmetric_difference AntoAndGar/task_singular_vectors/src/models/task_vectors.py community (archive-listed) ran · our draft was wrong fingerprinted Apache-2.0 (permissive) · 55e4b4e72a5278b6 · report
BaseMergeMethodSettings flowritecom/flow-merge/flow_merge/lib/merge_methods/task_arithmetic.py community (archive-listed) unverified Apache-2.0 (permissive) · 14d47affd7a90bf1 · report
DareTiesMergingSettings flowritecom/flow-merge/flow_merge/lib/merge_methods/task_arithmetic.py community (archive-listed) unverified Apache-2.0 (permissive) · 69c09a0f38cec086 · report
MergeMethod flowritecom/flow-merge/flow_merge/lib/merge_methods/task_arithmetic.py community (archive-listed) unverified Apache-2.0 (permissive) · 6ed53c7b8f6e6d42 · report
TaskArithmetic flowritecom/flow-merge/flow_merge/lib/merge_methods/task_arithmetic.py community (archive-listed) unverified Apache-2.0 (permissive) · 9689fce839afa1ba · report
TaskArithmeticSettings flowritecom/flow-merge/flow_merge/lib/merge_methods/task_arithmetic.py community (archive-listed) unverified Apache-2.0 (permissive) · 69cf6d6c6a4ba37c · report
TaskVector EnnengYang/AdaMerging/src/task_vectors.py community (archive-listed) unverified MIT (permissive) · f893acd6847a295a · report
TaskVector idankinderman/fs_merge/src/merges/task_vectors.py community (archive-listed) unverified no licence file found · pointer only · da649407a76a7991 · report
TiesMergingSettings flowritecom/flow-merge/flow_merge/lib/merge_methods/task_arithmetic.py community (archive-listed) unverified Apache-2.0 (permissive) · 1fbdfa9343efe4a0 · report
_TaskVector AntoAndGar/task_singular_vectors/src/models/task_vectors.py community (archive-listed) unverified Apache-2.0 (permissive) · b255d4dccd3371a7 · report
_TaskVector iurada/talos-task-arithmetic/nlp/task_vectors.py community (archive-listed) unverified no licence file found · pointer only · 137de145e64658d2 · report
get_param_names_to_merge identical code first harvested elsewhere ran · our draft was wrong licence of this copy not recorded · dcafd602728bc51e · report

Tasks

NegationTask Arithmetic

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections