Decouple-Then-Merge: Finetune Diffusion Models as Multi-Task Learning

Qianli Ma, Xuefei Ning, Dongrui Liu, Li Niu, Linfeng Zhang

Abstract

The Decouple-Then-Merge (DeMe) framework addresses the inherent gradient conflicts in diffusion models by treating different denoising timesteps as distinct tasks. Standard models use a single set of parameters for all stages, leading to optimization trade-offs between global structure and fine detail. DeMe finetunes specialized "expert" models for specific timestep ranges and merges them back into a single unified model using parameter-space arithmetic. This approach achieves significant gains in image quality (FID) and text alignment (CLIP score) without any additional computational overhead during inference.

The Problem: Gradient Conflicts in Diffusion

Standard diffusion models are "one-size-fits-all" architectures. A single neural network is responsible for denoising an image at every stage, from pure Gaussian noise ($t=T$) to fine-grained detail refinement ($t=0$). However, these stages are fundamentally different: early stages focus on low-frequency global structure, while late stages focus on high-frequency textures.

Research into gradient similarity reveals that these different stages produce gradient conflicts. The optimization direction required to improve the model at one timestep range might harm performance at another. While previous solutions like model ensembles are computationally expensive, and loss reweighting often fails to fully resolve these underlying conflicts, DeMe provides a structural solution by decoupling the process.

Analysis of gradient similarity showing conflicts in traditional training (b) versus high similarity within decoupled ranges (c).

The DeMe Framework

The DeMe framework operates in three main phases to resolve these conflicts efficiently:

1. Decouple

The total timestep range $[0, T]$ is divided into $N$ non-overlapping ranges. A pretrained diffusion model serves as the base for $N$ separate "expert" versions, each specialized for one specific range.

2. Specialized Finetuning

To ensure experts learn effectively without losing the base model's general knowledge, three techniques are employed:

  • Channel-wise Projection: A small learnable layer (~1% parameters) captures feature distribution shifts across timesteps, primarily in the channel dimension.
  • Consistency Loss: A penalty prevents finetuned experts from drifting too far from the original pretrained weights.
  • Probabilistic Sampling: During training, experts occasionally sample from the full timestep range to maintain global stability.

3. Model Merging

Instead of maintaining an expensive ensemble for inference, DeMe computes task vectors ($\tau_i$)—the difference between each finetuned expert and the pretrained base. These vectors are linearly combined and added back to the base model to create a single, unified model.

The DeMe pipeline: Experts are finetuned on specific ranges and then merged into a single model using task-vector arithmetic.

Key Insights

  • The Geometry of Conflict: Analysis shows that while a pretrained model might appear optimized for the full range, it remains on a steep slope for specific sub-ranges, indicating significant room for improvement through decoupling.
  • Channels over Space: By analyzing activations, researchers found that the difference between general and specialized models is most pronounced in channel dimensions rather than spatial ones, justifying the use of channel-wise projection layers.
  • Efficient Performance: Merging allows the knowledge of multiple specialized experts to be "squashed" into a single set of weights, providing ensemble-level performance with the inference speed of a single model.

Results and Evaluation

The authors evaluated DeMe across multiple benchmarks, including unconditional generation (CIFAR10, LSUN) and text-to-image generation (Stable Diffusion).

  • LSUN-Church: DeMe achieved a massive reduction in Fréchet Inception Distance (FID), dropping from 10.69 to 7.27, outperforming standard loss-reweighting baselines.
  • Stable Diffusion: On MS-COCO, the method improved FID by 0.36 and increased the CLIP score by 0.23, indicating better text-image alignment.
  • Qualitative Improvements: DeMe showed superior prompt following. For instance, it successfully rendered complex scenes (e.g., a "small wooden cabin" in a foggy landscape) where the base Stable Diffusion model often omitted key elements.

Conclusion

Decouple-Then-Merge introduces a novel "train-then-merge" paradigm for multi-task learning within diffusion models. By resolving gradient conflicts through specialized finetuning and parameter-space merging, it offers a "free" performance boost for existing architectures. Future work may explore scaling the number of experts for larger models like SDXL and applying this paradigm to other domains.

Summary updated

BibTeX
@inproceedings{ma2025decouple,
  author = {Qianli Ma and Xuefei Ning and Dongrui Liu and Li Niu and Linfeng Zhang},
  title = {{Decouple-Then-Merge: Finetune Diffusion Models as Multi-Task Learning}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2025},
  doi = {10.1109/cvpr52734.2025.02168},
}
Figure