Harmonized Multi-Layer Text-to-Image Generation with Generative Priors

Yusuf Dalva, Yijun Li, Qing Liu, Nanxuan Zhao, Jianming Zhang, Zhe Lin, Pinar Yanardag

TL;DR

LayerFusion is a training-free framework that simultaneously generates a transparent foreground layer (RGBA), a clean background layer (RGB), and a harmonized composite image directly from text prompts. By dynamically blending internal attention maps during the latent diffusion process, it allows layers to interact naturally, producing realistic lighting, shadows, and refractions without the artifacts typical of sequential generation.

What Problem Does This Paper Address?

State-of-the-art text-to-image diffusion models (like Stable Diffusion or DALL-E) excel at creating realistic imagery, but they generate flat, single-layer outputs. For creative professionals in graphic design and digital art, workflows are fundamentally layer-based, requiring independent control over individual visual elements.

Current workarounds fall short:

  1. Post-hoc Segmentation: Generating a flat image and then cutting out the foreground reduces transparency to a binary mask, losing complex alpha-channel details like glass refractions or semi-transparent smoke.
  2. Sequential Generation: Generating one layer and then "outpainting" the rest often leads to disjointed lighting, missing shadows, and noticeable visual artifacts where the layers meet.

LayerFusion solves the challenge of harmonization—ensuring that simultaneously generated layers realistically share lighting, shadows, and environmental reflections while remaining completely independent and editable.

Methods

LayerFusion introduces an optimization-free, training-free pipeline that runs two parallel diffusion processes sharing the same timestep schedule: a transparent-foreground branch (leveraging pretrained weights from LayerDiffuse) and a frozen, off-the-shelf SDXL model handling the background and composite views.

Instead of blending the final pixels, LayerFusion performs attention-level blending across three latent streams (Foreground, Background, and Composite) inside every transformer block:

  1. Priors from Attention: The system extracts two types of guidance maps on the fly. A static structure prior is pulled from the final self-attention block of the foreground denoiser to pinpoint the object's sharp boundaries. Concurrently, a dynamic content-confidence prior is extracted from cross-attention maps (specifically tracking the <EOS> text token) to capture how strongly the text prompt is driving the image content at that specific depth.
  2. Mask Extraction: These priors are combined mathematically to generate soft and hard spatial blending masks.
  3. Latent Stream Fusion: Using these masks, foreground activations are softly injected into the composite stream, and the background stream adapts to the evolving composite without overwriting purely background regions.
The LayerFusion framework pipeline, showing how structure and content priors guide attention-level blending across parallel diffusion streams.

Datasets

Because LayerFusion is entirely training-free, no new datasets were used to train the model. For evaluation and benchmarking, the authors utilized a dataset of 150 text prompts and seeds to generate image triplets. The resulting outputs were evaluated against native SDXL generations and LayerDiffuse reference sets using public aesthetic predictors and standard distribution metrics.

Key Insights and Ideas

  • Attention Maps as Free Priors: You don't need to retrain massive diffusion models on synthetic layered data to achieve high-quality layer generation. The internal self- and cross-attention maps of frozen models already contain rich structural and semantic information that can be exploited directly.
  • Bidirectional Contextual Influence: Because blending occurs at the attention level during generation, the background context dynamically alters foreground details. For instance, changing the background prompt to a snowy scene naturally adds snow details to a foreground character's outfit while preserving their identity.
  • Self vs. Cross Attention Synergy: The authors found that using self-attention alone causes latent leaks, while cross-attention alone affects the entire image. Combining both achieves sharp boundaries and internal coherence.

Key Results

LayerFusion was evaluated both quantitatively and via user studies, outperforming existing state-of-the-art baselines:

  • Quantitative Performance: In a latent-blending benchmark, LayerFusion achieved the highest aesthetic scores using public SigLIP (6.33) and CLIP (6.24) predictors. It also significantly reduced the Kernel Inception Distance (KID) to 0.0032, outperforming LayerDiffuse (0.0047) and Blended Latent Diffusion (0.0156).
  • User Preference: A study with 50 participants rating image triplets scored LayerFusion significantly higher ($3.233 \pm 0.566$) than LayerDiffuse ($2.960 \pm 0.692$).
  • Spatial Editing Cleanness: Unlike sequential methods that suffer from background completion artifacts, LayerFusion generates clean, isolated layers that can be seamlessly rearranged or moved without degrading image quality.
Qualitative comparison demonstrating that LayerFusion avoids the background completion artifacts of previous methods, enabling clean spatial editing.

Limitations and Future Work

While highly effective, LayerFusion is currently limited to the standard two-layer case (one RGBA foreground and one RGB background). The authors note that extending this attention-guided fusion mechanism to complex, multi-layered scenes remains an open challenge.

Additionally, because the framework relies on frozen diffusion checkpoints, it can inherit inherent model biases. Future work will focus on developing more robust mask extraction techniques, introducing bias-mitigation strategies, and releasing a public layered-image dataset to push the boundaries of text-guided image harmonization.

Summary updated

BibTeX
@inproceedings{dalva2026harmonized,
  author = {Yusuf Dalva and Yijun Li and Qing Liu and Nanxuan Zhao and Jianming Zhang and Zhe Lin and Pinar Yanardag},
  title = {{Harmonized Multi-Layer Text-to-Image Generation with Generative Priors}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2026},
  url = {https://openreview.net/forum?id=YrvMM1X10k},
}
Figure