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