Layer-Aware Task Arithmetic: Disentangling Task-Specific and Instruction-Following Knowledge

Yan-Lun Chen, Yi-Ru Wei, Chia-Yi Hsu, Chia-Mu Yu, Chun-Ying Huang, Ying-Dar Lin, Yu-Sung Wu, Wei-Bin Lee · DOI

Abstract

Layer-Aware Task Arithmetic (LATA) addresses the performance degradation in multi-task model merging caused by redundant instruction-following components. By analyzing layer-wise cosine similarity between instruction-tuned and task-specific vectors, LATA identifies and prioritizes layers containing unique task knowledge. Experimental results demonstrate that LATA maintains higher utility and accuracy across diverse tasks and safety-editing scenarios compared to existing state-of-the-art merging techniques.

The Challenge of Redundant Knowledge in Fine-Tuning

When fine-tuning a Large Language Model (LLM) for a specific task, the process inadvertently reinforces general instruction-following (IF) behaviors alongside the target skill. In the framework of Task Arithmetic (TA), models are merged by manipulating "task vectors"—the weight differences between a fine-tuned model and its base. However, merging multiple task vectors often leads to interference between these overlapping IF components, resulting in "worse utility" where conversational quality and task performance degrade.

Decomposition of the task vector into components affecting utility and task ability

Methods: Layer-Aware Task Arithmetic (LATA)

LATA moves beyond treating the model as a single vector by performing a granular, layer-wise analysis to disentangle task-specific knowledge from general instructions. The process involves four key stages:

  1. Vector Derivation: An "instruction vector" ($\tau_{instr}$) is defined as the difference between an instruction-tuned model and a raw base model. A "complex vector" ($\tau_{comp}$) represents the difference between a task-specific fine-tuned model and the same base.
  2. Similarity Analysis: LATA calculates the cosine similarity between $\tau_{instr}$ and $\tau_{comp}$ for every layer.
  3. Layer Identification: Layers with high similarity are identified as primarily reinforcing general instruction-following, while layers with low similarity are deemed critical for the specific task.
  4. Weighted Merging: A "pure vector" is constructed by assigning higher weights to task-specific layers and attenuating instruction-heavy layers using schemes such as Linear-Drop-by-Rank or Threshold-based dropping.
The LATA workflow for identifying and weighting important layers

Experimental Evaluation

The researchers evaluated LATA across three primary domains: Task Learning (merging Math and Code capabilities), Task Forgetting (removing harmful content), and Language Utility (maintaining performance in languages like Japanese, Russian, and Thai).

Key Insights

  • Knowledge Distribution: LLM layers are non-uniform; earlier layers (0–20) typically focus on instruction processing, while specialized knowledge is concentrated in later layers (26–30).
  • Sparsity: In forgetting tasks, discarding up to 90% of the task vector (retaining only task-specific layers) yielded better results than standard methods, suggesting task knowledge is highly concentrated.
  • Task Synergy: Merging logic-heavy tasks like math and code simultaneously often improved performance, suggesting LATA effectively exploits intrinsic task similarities.

Key Results

LATA consistently outperformed baselines like TIES and DARE:

  • Utility Maintenance: In multi-task merging, LATA kept perplexity (confusion) below 10.5, significantly lower than the 11.5+ seen in other methods.
  • Accuracy: On the GSM8K math benchmark, LATA achieved 0.8431 accuracy, surpassing standard TA (0.8241).
  • Safety Editing: LATA reduced toxicity more effectively while maintaining higher utility across multiple languages compared to standard sparsification techniques.

Limitations and Future Work

LATA is currently constrained by the requirement that all merged models share the same architecture. Additionally, the scaling coefficient ($\lambda$) requires careful tuning to avoid model instability. Future research will explore cross-family model merging and more complex behavioral editing beyond simple addition and subtraction.

Summary updated

BibTeX
@misc{chen2025layer,
  author = {Yan-Lun Chen and Yi-Ru Wei and Chia-Yi Hsu and Chia-Mu Yu and Chun-Ying Huang and Ying-Dar Lin and Yu-Sung Wu and Wei-Bin Lee},
  title = {{Layer-Aware Task Arithmetic: Disentangling Task-Specific and Instruction-Following Knowledge}},
  year = {2025},
  eprint = {2502.20186},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2502.20186},
}
Figure