Manuscript Offprint

arXiv:2608.28547

DARTS: Decoder-Aware Representation Tuning via Surgery for Model Merging

Aaryan Ajay Sharma, Sai Nishanth Padala, Seganrasan Subramanian

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Model merging combines multiple task-specific fine-tuned LLMs into a single multi-task model without additional training. However, merged models are known to suffer from representation bias: systematic drift between the merged model's hidden states and those of each individual source model. Prior work (Yang et al., 2024a) study and mitigate this bias for encoder-based vision models using a lightweight correction module trained with L1 loss. However, such bias is not studied for decoder models due to their autoregressive nature. Therefore, we first analyze the problem of representation bias in decoder models, and show two challenges absent in encoders: (1) the causal attention mask causes bias to accumulate across token positions, requiring position-dependent correction; and (2) not all token positions are equally important, i.e., high-entropy (decision-critical) positions matter far more than low-entropy ones. To address these challenges, we propose Decoder-Aware Representation Tuning via Surgery (DARTS). DARTS employs a novel entropy-weighted L1 loss to upweight correction at high-entropy positions where errors most affect generation quality, and a per-position additive bias that captures position-dependent error without overparameterization. We perform extensive evaluation on three domains: code generation (HumanEval), mathematical reasoning (GSM8K), and instruction following (AlpacaEval) on Llama-2-7B models, and show DARTS achieves significant improvement over the standard surgery approach while adding negligible parameters (0.1% of total parameters).

1 Introduction

Large language models (LLMs) have demonstrated remarkable capabilities across a wide range of tasks, from code generation (Chen et al., 2021; Rozière et al., 2024) and mathematical reasoning (Cobbe et al., 2021; Luo et al., 2025; Wei et al.,

Figure

Figure 1: Per-token L1 representation bias between a merged Llama-2-7B model and each individual fine-tune, measured at the final transformer layer. Each row is a calibration sample; each column is a token position. Across all three domains (code, math, instruct), we see an increasing trend of bias with token position due to error accumulation under the causal attention mask. This position-dependent structure motivates the decoder-aware corrections proposed in DARTS.

  1. to open-ended instruction following (Ouyang et al., 2022). However, these capabilities are typically obtained through task-specific fine-tuning (Hu et al., 2021; Touvron et al., 2023), producing a proliferation of specialized models, each of which excels on its target domain but requires independent deployment. As the number of specialized models grows, so does the cost of serving them, making multi-task consolidation increasingly attractive.

Model merging (Wortsman et al., 2022; Ilharco et al., 2023; Yadav et al., 2023; Yang et al., 2024b; Yadav et al., 2025) offers an elegant solution to this problem: combine the weights of multiple fine-tuned models into a single model that inherits capabilities from all source models, without any

∗^{*}Equal contribution. Author order determined by quantum random number generator over Google Meet.

†^{\dagger}Corresponding authors.

Work done during Aaryan’s internship at ServiceNow.

additional training data or computation. Methods such as Task Arithmetic (Ilharco et al., 2023), TIES-Merging (Yadav et al., 2023), and DARE (Yu et al., 2024) have shown that simple arithmetic operations in weight space (such as adding scaled task vectors, resolving sign conflicts, or dropping redundant parameters) can produce surprisingly effective multi-task models. This has made model merging a standard tool in the open-source LLM ecosystem (Goddard et al., 2024), where practitioners routinely merge instruction-tuned, code-specialized, and math-specialized models into unified checkpoints.

Despite this progress, a substantial performance gap persists between merged models and their individual fine-tuned counterparts. Merged models frequently degrade on one or more constituent tasks (Ilharco et al., 2023; Yadav et al., 2023; Yang et al., 2024b), and the severity of this degradation varies unpredictably across tasks, merging methods, and model scales. Understanding why merging hurts performance, and finding principled ways to close the gap, remains an open challenge.

Yang et al. (2024a) recently offered a compelling explanation for this degradation. By visualizing the hidden representations of merged vision models (ViT-B/32, ViT-B/16, ViT-L/14 on eight classification tasks), they demonstrated that merged models suffer from representation bias: a systematic discrepancy between the feature representations extracted by the merged model and those of each individual fine-tuned model. Crucially, they showed that representation bias correlates with task performance: merging methods that produce smaller representation bias (e.g., AdaMerging (Yang et al., 2024b)) consistently outperform those with larger bias (e.g., Weight Averaging). Building on this insight, they proposed representation surgery: a lightweight low-rank module trained with L1 loss to predict and subtract the representation bias, achieving significant performance gains across all merging methods.

However, the original surgery framework was designed exclusively for encoder-based vision models. In ViT architectures (Dosovitskiy et al., 2021), bidirectional self-attention ensures that each token (image patch) is contextualized by all other tokens equally, producing representation bias that is roughly uniform across token positions. A position-agnostic surgery module, which applies the same correction at every position, is well-suited to this setting. Likewise, the uniform L1 loss used for training treats all token positions as equally important, which is reasonable when every patch contributes similarly to the classification decision.

Decoder-based LLMs are fundamentally different. The autoregressive transformer architecture (Vaswani et al., 2017; Brown et al., 2020) processes tokens left-to-right under a causal attention mask: token t can only attend to tokens 0, 1, ..., t-1. This architectural constraint has two consequences for representation bias that render the original surgery framework inadequate:

First, representation bias in decoder models is position-dependent. Because each token’s representation is computed from a strictly causal context, any bias introduced by weight-space merging at earlier positions propagates forward through the attention mechanism. Later tokens aggregate not only the original merging error at their own position but also the accumulated errors from all preceding positions. Figure 1 empirically shows this effect: plotting per-token L1 distance between merged and individual model representations reveals a clear increasing trend, with later positions exhibiting 2−3×2-3\times higher bias than early positions. A position-agnostic surgery module, which applies identical corrections at every position, is structurally incapable of capturing this pattern, forcing it to compromise between under-correcting later tokens and over-correcting earlier ones.

Second, not all token positions are equally important for generation quality. In autoregressive LLMs, the model’s prediction at each position determines the next token in the generated sequence. At some positions, the model is highly confident and assigns most probability mass to a single token (e.g., closing brackets, deterministic syntax, common phrases). At other positions, the model distributes probability across many plausible continuations; these are the decision-critical positions where the choice of next token meaningfully affects the quality and correctness of the generated output. Small hidden-state errors at high-entropy positions can flip the argmax prediction and cascade through subsequent tokens, while comparable errors at low-entropy positions are absorbed without consequence. The standard L1L_{1} loss (Yang et al., 2024a) treats all positions uniformly, wasting the surgery module’s limited correction capacity on positions that do not affect downstream generation. Figure 2 illustrates this idea.

To address these decoder-specific challenges, we propose Decoder-Aware Representation Tuning via Surgery (DARTS), which adapts representation surgery to the autoregressive setting through two complementary innovations. First, we introduce entropy-weighted L1L_{1} loss (EWL1), which weights the per-position correction penalty by the target model's prediction entropy, focusing the surgery module's capacity on decision-critical positions where errors most affect generation quality. Second, we augment the low-rank content correction with a position correction module, a direct per-position additive bias table that learns independent correction vectors for each token position, capturing the structured position-dependent bias without network overparameterization. We evaluate DARTS on Llama-2-7B (Touvron et al., 2023) models merged from three specialized fine-tunes (code generation, mathematical reasoning, and instruction following), showing that it achieves significant improvement over the original surgery approach.

The main contributions of this paper are as follows:

  1. We analyze the problem of representation bias in decoder models and empirically demonstrate two challenges absent in encoder models: position-dependent bias accumulation under the causal attention mask, and non-uniform position importance arising from the autoregressive generation process.

  2. To address these challenges, we propose DARTS, which uses a novel entropy-weighted L1L_{1} loss and a position correction module, to upweight correction at decision-critical positions, and perform position-dependent bias corrections.

  3. We perform extensive experiments to show that DARTS reduces causal representation bias and significantly improves MTL performance on a variety of different tasks while adding merely 0.1% of parameters to the model.

References (16)