NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Towards Understanding the Working Mechanism of Text-to-Image Diffusion Model

Mingyang Yi, Aoxue Li, Yi Xin, Zhenguo Li

Introduction

While latent Diffusion Probabilistic Models (DPMs) like Stable Diffusion have revolutionized high-quality text-to-image (T2I) generation, they are often treated as "black boxes." We know that injecting a text prompt into a gradually denoised image generator yields stunning results, but the specific dynamics—how and when different parts of the prompt influence the image—remain poorly understood.

This paper sets out to demystify this process by answering two fundamental questions: How does the image structure evolve during the denoising process, and which parts of the text prompt are actually doing the heavy lifting at different stages? Understanding these mechanisms provides a roadmap for making these computationally expensive models faster and more controllable.

Methodology

To unpack the black box of T2I generation, the researchers employed a mix of empirical observation, frequency analysis, and intervention experiments across several datasets (including MS-COCO and custom prompt sets):

  • Frequency Analysis: Using Fourier Transforms, the authors tracked how low-frequency (shape-related) and high-frequency (texture-related) signals evolve during generation.
  • Token Categorization: They divided CLIP-encoded prompts into three distinct categories: the [SOS] (start) token, semantic tokens (the actual descriptive words), and the [EOS] (end) token.
  • Intervention Experiments: To test token influence, they created "hybrid" prompts, swapping semantic tokens from one prompt with the [EOS] token of another.
  • Guidance Truncation: They experimented with removing the text-conditioning term at various steps in the 50-step DDIM sampling process to identify when the prompt stops being necessary.

Key Findings

First Shape, Then Details

The denoising process is inherently hierarchical. Because the forward noise-adding process takes longer to destroy low-frequency information, the reverse denoising process recovers it first. The "essence" or global shape of the image is settled very early in the generation timeline, while fine details and textures are filled in later.

The Unexpected Power of the [EOS] Token

In CLIP-based models, the text encoder is auto-regressive. This means the final [EOS] token effectively "absorbs" the semantic meaning of the entire preceding sentence. Surprisingly, the authors found that the [EOS] token has a much larger impact on the final image's layout and shape during the early generation stages than the individual semantic word tokens. Semantic tokens still contribute to non-structural attributes like color or texture, provided they don't conflict with the shape already dictated by the [EOS] token.

Front-Loaded Text Guidance

The primary job of the text prompt is to "steer" the initial Gaussian noise into a specific global shape. Once that shape is established—usually within the first 15 to 20 steps of a 50-step process—the model can finish the textures and details using its own internal "knowledge" of what a realistic image looks like, without needing further text guidance.

Cross-attention maps across denoising timesteps showing how text token influence evolves.

As illustrated in the cross-attention maps above, the model's focus on the text prompt is highly active in the early timesteps (t=50 to t=30) to establish the layout, but this reliance converges and drops off significantly as the process nears completion.

Results & Performance

By leveraging the insight that text guidance is front-loaded, the authors proposed a simple yet highly effective acceleration technique: removing text guidance after the initial shape-formation stage.

  • Significant Speedups: By dropping the text-conditioning term after the first ~20 steps of a 50-step process, the authors achieved a 25%+ reduction in inference latency on NVIDIA V100 GPUs.
  • Quality Preservation: This "training-free" acceleration method resulted in almost no drop in image quality. On the MS-COCO benchmark using Stable Diffusion v1.5, the FID score remained nearly identical while saving significant compute.
  • Broad Applicability: The findings held true across different architectures, including Stable Diffusion v1.5, v2.1, and the transformer-based Pixart-Alpha.

Limitations and Future Work

While these findings offer a significant leap in understanding and optimizing DPMs, the authors note a few limitations. The heavy reliance on the [EOS] token is partly a byproduct of the auto-regressive nature of the CLIP text encoder; models using different encoders (like T5) might exhibit different token-level dynamics. Additionally, very complex prompts with multiple interacting objects might require longer guidance to ensure all spatial relationships are correctly established.

Future work will explore how this mechanism applies to subject-driven generation (like DreamBooth or PhotoMaker) and could lead to even more sophisticated methods for model compression and real-time generation.

Summary updated

BibTeX
@inproceedings{yi2024towards,
  author = {Mingyang Yi and Aoxue Li and Yi Xin and Zhenguo Li},
  title = {{Towards Understanding the Working Mechanism of Text-to-Image Diffusion Model}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=zTu0QEpvtZ},
}
Figure