SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2212.04089 · ICLR · 2023

Editing Models with Task Arithmetic

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

arXiv · PDF · Open in the Atlas

Code that ran

5 of 15 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (3 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 3 have no contract verdict; 2 failures of our instrument; 10 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2212.04089.json · badge: /api/ran/2212.04089.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
flowritecom/flow-merge community
Papers with Code archive
2 ran · 6 no recorded run
AntoAndGar/task_singular_vectors community
Papers with Code archive
1 ran · 1 no recorded run
yanyang19/ImPart community
Papers with Code archive
1 ran · 0 no recorded run
copy not recorded community
not in the paper's declared repositories
1 ran · 0 no recorded run
EnnengYang/AdaMerging community
Papers with Code archive
0 ran · 1 no recorded run
idankinderman/fs_merge community
Papers with Code archive
0 ran · 1 no recorded run
iurada/talos-task-arithmetic community
Papers with Code archive
0 ran · 1 no recorded run
FunctionStatusWhere it lives
Model Ran
ran on a synthesized input · constructed an object; no result was computed
flowritecom/flow-merge/flow_merge/lib/merge_methods/task_arithmetic.py
code served (permissive licence) · get_code("f075638111e309f6")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, Model: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
from transformers import PretrainedConfig
from unittest.mock import Mock, patch

torch.manual_seed(0)

# Create a minimal mock PretrainedConfig
class MockPretrainedConfig(PretrainedConfig):
    model_type = "mock"
    
    def __init__(self, **kwargs):
        super().__init__(**kwargs)

# Mock the AutoConfig.from_pretrained to avoid actual model downloads
mock_config = MockPretrainedConfig()

# Patch AutoConfig.from_pretrained at module level
with patch('transformers.AutoConfig.from_pretrained', return_value=mock_config):
    ARGS = {
        'path': 'bert-base-uncased',
        'config': mock_config,
        'revision': None,
        'trust_remote_code': False
    }
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pydantic, torch, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Model — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a Model output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
ModelWeight Ran
ran on a synthesized input · constructed an object; no result was computed
flowritecom/flow-merge/flow_merge/lib/merge_methods/task_arithmetic.py
code served (permissive licence) · get_code("d4eaf7b390d8c9b0")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, ModelWeight: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
from dataclasses import dataclass, field
from typing import Dict, Optional, Tuple, Type, Union

torch.manual_seed(0)

ARGS = {
    "name": "model.layers.0.self_attn.v_proj.weight",
    "type": "self_attn",
    "layer_type": "decoder",
    "projection": "v_proj",
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ModelWeight — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a ModelWeight output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
TaskVector Ran
ran on a synthesized input · constructed an object; no result was computed
yanyang19/ImPart/merge/task_vector.py
pointer only (licence: NONE) · get_code("1856c2a053748d8a")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, yanyang19/ImPart when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_param_names_to_merge Ran
ran; our contract draft was wrong, not the code
this paper's copy was not recorded; identical code first harvested from walkerworldpeace/mllmerging
pointer only; the stored copy get_code serves, from walkerworldpeace/mllmerging, is pointer only (licence: NONE) · get_code("dcafd602728bc51e")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

symmetric_difference Ran
ran; our contract draft was wrong, not the code
AntoAndGar/task_singular_vectors/src/models/task_vectors.py
code served (permissive licence) · get_code("55e4b4e72a5278b6")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
from typing import List

torch.manual_seed(0)

# Create two simple lists with some overlapping and non-overlapping elements
A = [1, 2, 3, 4, 5]
B = [4, 5, 6, 7, 8]

ARGS = {
    "A": A,
    "B": B
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family int — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
BaseMergeMethodSettings Not yet run
unverified (harvested, no recorded run)
flowritecom/flow-merge/flow_merge/lib/merge_methods/task_arithmetic.py
code served (permissive licence) · get_code("14d47affd7a90bf1")
How it ran

no invocation recorded.

DareTiesMergingSettings Not yet run
unverified (harvested, no recorded run)
flowritecom/flow-merge/flow_merge/lib/merge_methods/task_arithmetic.py
code served (permissive licence) · get_code("69c09a0f38cec086")
How it ran

no invocation recorded.

MergeMethod Not yet run
unverified (harvested, no recorded run)
flowritecom/flow-merge/flow_merge/lib/merge_methods/task_arithmetic.py
code served (permissive licence) · get_code("6ed53c7b8f6e6d42")
How it ran

no invocation recorded.

TaskArithmetic Not yet run
unverified (harvested, no recorded run)
flowritecom/flow-merge/flow_merge/lib/merge_methods/task_arithmetic.py
code served (permissive licence) · get_code("9689fce839afa1ba")
How it ran

no invocation recorded.

TaskArithmeticSettings Not yet run
unverified (harvested, no recorded run)
flowritecom/flow-merge/flow_merge/lib/merge_methods/task_arithmetic.py
code served (permissive licence) · get_code("69cf6d6c6a4ba37c")
How it ran

no invocation recorded.

TaskVector Not yet run
unverified (harvested, no recorded run)
EnnengYang/AdaMerging/src/task_vectors.py
code served (permissive licence) · get_code("f893acd6847a295a")
How it ran

no invocation recorded.

TaskVector Not yet run
unverified (harvested, no recorded run)
idankinderman/fs_merge/src/merges/task_vectors.py
pointer only (licence: NONE) · get_code("da649407a76a7991")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, idankinderman/fs_merge when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

TiesMergingSettings Not yet run
unverified (harvested, no recorded run)
flowritecom/flow-merge/flow_merge/lib/merge_methods/task_arithmetic.py
code served (permissive licence) · get_code("1fbdfa9343efe4a0")
How it ran

no invocation recorded.

_TaskVector Not yet run
unverified (harvested, no recorded run)
AntoAndGar/task_singular_vectors/src/models/task_vectors.py
code served (permissive licence) · get_code("b255d4dccd3371a7")
How it ran

no invocation recorded.

_TaskVector Not yet run
unverified (harvested, no recorded run)
iurada/talos-task-arithmetic/nlp/task_vectors.py
pointer only (licence: NONE) · get_code("137de145e64658d2")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, iurada/talos-task-arithmetic when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

Also present in other papers' code

Of 15 samples lifted from this paper's linked repositories, 15 carry a function identity and 0 do not. Of the 15 distinct functions with an identity, 6 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 6 later) and 9 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
get_param_names_to_merge
brick of this paper's assembly: helper
4 other papers
4 later
2408.03092 (2024-08)
Extend Model Merging from Fine-Tuned to Pre-Trained Large Language Models via Weight Disentanglement
2503.22178 (2025-03)
AdaRank: Adaptive Rank Pruning for Enhanced Model Merging
2505.19892 (2025-05)
OptMerge: Unifying Multimodal LLM Capabilities and Modalities via Model Merging
and 1 more not named here
BaseMergeMethodSettings
brick of this paper's assembly: helper
1 other paper
1 later
2306.01708 (2023-06)
TIES-MERGING: Resolving Interference When Merging Models
Model
brick of this paper's assembly: helper
1 other paper
1 later
2306.01708 (2023-06)
TIES-MERGING: Resolving Interference When Merging Models
TaskArithmeticSettings
brick of this paper's assembly: helper
1 other paper
1 later
2306.01708 (2023-06)
TIES-MERGING: Resolving Interference When Merging Models
TiesMergingSettings
brick of this paper's assembly: helper
1 other paper
1 later
2306.01708 (2023-06)
TIES-MERGING: Resolving Interference When Merging Models
symmetric_difference
brick of this paper's assembly: helper
1 other paper
1 later · 1 only as an assembly brick
2410.17146 (2024-10)
LiNeS: Post-training Layer Scaling Prevents Forgetting and Enhances Model Merging

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

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 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.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2212.04089")
get_code_for_paper("2212.04089")
have("2212.04089")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2212.04089.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2212.04089.svg)](https://syntology.ai/paper/2212.04089)

Connect an agent — have() is free.