MagicFusion: Boosting Text-to-Image Generation Performance by Fusing Diffusion Models

Jing Zhao, Heliang Zheng, Chaoyue Wang, Long Lan, Wenjing Yang · DOI

Abstract

MagicFusion introduces Saliency-aware Noise Blending (SNB), a training-free method to combine the strengths of two different diffusion models during the image generation process. By leveraging classifier-free guidance as a built-in "saliency map," the system automatically determines which model to prioritize for specific regions of an image. This enables high-fidelity results, such as integrating specific, finely-detailed objects into complex, photorealistic environments without the need for manual masking or expensive retraining.

Introduction

The open-source community has produced a vast array of specialized diffusion models, ranging from experts in automotive design to anime styles and general photorealism. However, ensembling these models effectively remains a challenge. Simple averaging (Mean Fusion) often results in cluttered images where the strengths of individual models are diluted. Manual masking, while effective, is labor-intensive and frequently fails to achieve natural interaction between the foreground object and the background environment—for instance, failing to render environmental effects like snow or shadows on the object. MagicFusion addresses these issues by providing an automated way to fuse models, preserving fine-grained details while maintaining global scene coherence.

Methodology: Saliency-aware Noise Blending (SNB)

The core innovation of MagicFusion is the discovery that the response of Classifier-Free Guidance (CFG)—the standard mechanism for prompt adherence—serves as an effective saliency indicator. The SNB algorithm operates through the following steps:

  1. Saliency Estimation: During each denoising step, the system calculates the difference between the model's conditional prediction (with text) and its unconditional prediction (without text). High values indicate regions where the model is actively working to match the prompt.
  2. Mask Generation: Saliency maps are generated for both the General and Expert models. These maps are normalized using a softmax function and converted into a binary mask via argmax.
  3. Spatial Blending: Instead of averaging, the system performs pixel-wise selection. The noise prediction from the Expert Model is used in areas of high saliency for that model (e.g., the object of interest), while the General Model’s prediction is used elsewhere.
  4. Semantic Alignment: Because both models receive the blended noisy image as input for subsequent steps, they naturally align their predictions, allowing for seamless integration and environmental interaction.
Figure 1: Comparison of general model outputs, expert car model outputs, and the final MagicFusion results across various prompts.

Applications and Results

MagicFusion has been evaluated across several key domains:

  • Fine-grained Fusion: The method successfully generates specific car brands and models (e.g., a red Audi A1) within complex scenes where a general model would produce a generic vehicle.
  • Recontextualization: In tasks involving specific objects (e.g., a personalized backpack), MagicFusion outperforms DreamBooth by maintaining object identity even as prompt complexity increases.
  • Cross-domain Fusion: The system can combine the imaginative compositions of stylized models (e.g., cartoon or anime) with the photorealistic textures of general models.
Figure 2: Cross-domain fusion example: combining a cartoon model's composition with a general model's photorealistic textures.

Discussion and Limitations

While MagicFusion offers a powerful, training-free solution for model fusion, it does introduce computational overhead. Running two separate U-Net forward passes at every sampling step effectively doubles inference time and memory requirements. Additionally, the results can be sensitive to the temperature parameter ($k$) used in the softmax function. Future work may explore extending this framework to support the fusion of more than two models simultaneously.

Summary updated

BibTeX
@misc{zhao2023magicfusion,
  author = {Jing Zhao and Heliang Zheng and Chaoyue Wang and Long Lan and Wenjing Yang},
  title = {{MagicFusion: Boosting Text-to-Image Generation Performance by Fusing Diffusion Models}},
  year = {2023},
  eprint = {2303.13126},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2303.13126},
}
Figure