Decomposing Task Vectors for Refined Model Editing

Hamed Damirchi, Ehsan Abbasnejad, Zhen Zhang, Javen ShiarXiv 2025 · DOI

Introduction

Model editing via task arithmetic has emerged as a powerful paradigm for steering neural network behavior without the need for expensive retraining. By calculating the difference between a fine-tuned model and its pre-trained base, researchers can derive a "task vector"—a directional shift in parameter space. These vectors can be added to inject new capabilities (e.g., adding a specific artistic style) or subtracted to remove undesirable traits (e.g., reducing toxicity in Large Language Models).

However, a significant hurdle remains: task vectors are often entangled. For instance, a vector trained on the Street View House Numbers (SVHN) dataset contains unique features like handling cluttered backgrounds, but it also shares fundamental digit-recognition concepts with an MNIST task vector. When multiple vectors are combined, these overlapping shared concepts are over-emphasized, leading to unpredictable interference. In image generation, this often results in visual degradation; in LLMs, it can cause the accidental removal of general reasoning capabilities alongside the targeted behavior.

The DeVec Method

To address this, we introduce DeVec, a principled method to decompose task vectors into "shared" and "unique" components. This decomposition allows for more surgical model edits by isolating specific knowledge from general capabilities.

The DeVec process operates entirely in parameter space using linear algebra:

  1. Identify Shared Subspaces: We compute the Singular Value Decomposition (SVD) of the weight matrices for a set of task vectors. The left singular vectors are used to construct projection matrices for each task's column space.
  2. Extract the Shared Component: By chaining these projection matrices, we identify a "shared subspace"—directions in parameter space that remain largely consistent across tasks. The original vector is projected onto this space to isolate shared knowledge.
  3. Extract the Unique Component: The unique component is defined as the original task vector minus its shared component.

By utilizing only the unique components, we can add or remove specific traits without the collateral damage caused by over-emphasizing shared features.

Experimental Results

The DeVec framework was evaluated across three diverse domains:

Image Classification

On a suite of 14 standard datasets (including StanfordCars and CIFAR100) using CLIP ViT-B-32, DeVec improved multi-task merging performance. Integrating decomposed vectors into existing techniques like AdaMerging resulted in a 5% average accuracy boost, significantly outperforming state-of-the-art methods like TIES-Merging.

Image Generation

When mixing multiple visual styles in Flux Schnell 1.0, conventional task arithmetic typically leads to over-saturated, degraded images. By blending only the unique components of style vectors (e.g., Vintage Photography and Pixel Art), DeVec successfully generated high-quality composite images (like a pixel-art anime character) with no loss in fidelity.

Toxicity Removal in LLMs

DeVec achieved state-of-the-art results in reducing toxicity in LLaMA-2-7B. By negating only the unique component of a toxic task vector—isolated by comparing it against a pool of vectors covering physics, history, and clinical notes—toxicity on the ToxiGen benchmark dropped by 47%. Crucially, unlike previous methods, DeVec preserved the model's general reasoning abilities, with only a marginal drop in MMLU scores.

Conclusion and Future Work

DeVec provides a robust mathematical framework for refining model edits by disentangling shared and unique parameter shifts. While the method currently relies on a manual eigenvalue threshold ($\\tau \\approx 0.85$) and is influenced by the diversity of the task vector pool, it marks a significant step toward more precise control over neural network behavior. Future research may extend this projection-based approach to activation-based editing or deeper relational analysis between tasks in parameter space.

Summary updated

Abstract

Large pre-trained models have transformed machine learning, yet adapting these models effectively to exhibit precise, concept-specific behaviors remains a significant challenge. Task vectors, defined as the difference between fine-tuned and pre-trained model parameters, provide a mechanism for steering neural networks toward desired behaviors. This has given rise to large repositories dedicated to task vectors tailored for specific behaviors. The arithmetic operation of these task vectors allows for the seamless combination of desired behaviors without the need for large datasets. However, these vectors often contain overlapping concepts that can interfere with each other during arithmetic operations, leading to unpredictable outcomes. We propose a principled decomposition method that separates each task vector into two components: one capturing shared knowledge across multiple task vectors, and another isolating information unique to each specific task. By identifying invariant subspaces across projections, our approach enables more precise control over concept manipulation without unintended amplification or diminution of other behaviors. We demonstrate the effectiveness of our decomposition method across three domains: improving multi-task merging in image classification by 5% using shared components as additional task vectors, enabling clean style mixing in diffusion models without generation degradation by mixing only the unique components, and achieving 47% toxicity reduction in language models while preserving performance on general knowledge tasks by negating the toxic information isolated to the unique component. Our approach provides a new framework for understanding and controlling task vector arithmetic, addressing fundamental limitations in model editing operations.
BibTeX
@misc{damirchi2025decomposing,
  author = {Hamed Damirchi and Ehsan Abbasnejad and Zhen Zhang and Javen Shi},
  title = {{Decomposing Task Vectors for Refined Model Editing}},
  year = {2025},
  eprint = {2512.22511},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2512.22511},
}
Figure