Abstract: Recent advancements in diffusion models have notably improved the perceptual quality of generated images in text-to-image synthesis tasks. However, diffusion models often struggle to produce images that accurately reflect the intended semantics of the associated text prompts. We examine cross-attention layers in diffusion models and observe a propensity for these layers to disproportionately focus on certain tokens during the generation process, thereby undermining semantic fidelity. To address the issue of dominant attention, we introduce attention regulation, a computation-efficient on-the-fly optimization approach at inference time to align attention maps with the input text prompt. Notably, our method requires no additional training or fine-tuning and serves as a plug-in module on a model. Hence, the generation capacity of the original model is fully preserved. We compare our approach with alternative approaches across various datasets, evaluation metrics, and diffusion models. Experiment results show that our method consistently outperforms other baselines, yielding images that more faithfully reflect the desired concepts with reduced computation overhead.
Introduction: The Semantic Fidelity Gap
While modern diffusion models like Stable Diffusion produce visually stunning images, they frequently struggle with "semantic fidelity"—the ability to accurately render all components of a text prompt. A common failure mode is the omission of specific objects or attributes requested by the user. For instance, a prompt for a "dog in a cage with a bed and bowl" might result in an image of just a dog in a cage, neglecting the bed and bowl.
The authors identify this issue as a result of attention dominance, where certain tokens (like "dog") monopolize the attention values in the cross-attention layers, effectively "crowding out" other tokens (like "bowl").
Methodology: Attention Regulation
To combat this, the researchers introduce Attention Regulation, a training-free, plug-in optimization method applied during inference. Unlike previous methods that require expensive fine-tuning or slow optimization loops at every generation step, Attention Regulation treats the process as a constrained optimization problem focused on two goals:
- High-Quantile Thresholding: Ensuring the most attentive regions for every token reach a minimum intensity.
- Balanced Distribution: Preventing any single token from hogging the "attention budget."
To maintain efficiency and image quality, the method uses Smooth Parameterization. Instead of optimizing individual pixels, it optimizes a small weight matrix controlling a 2D Gaussian kernel. This ensures edits are spatially smooth and computationally light. Furthermore, regulation is only applied to specific "bottleneck" layers and stopped after the 25th step, once the global layout is established.
Key Insights: Visualizing Attention Dominance
The core "Aha!" moment of the research comes from analyzing the statistical distribution of attention values. By using violin plots to track attention for specific tokens over time, the authors demonstrated that in failed generations, the attention for missing objects drops toward zero very early in the process.
As shown in the figure above, the baseline model (top) loses focus on the "glasses" token by step 24. Attention Regulation (bottom) acts as a safety net, boosting the attention for marginalized tokens to ensure they are physically manifested in the final image.
Results and Efficiency
Experimental results across datasets like MS-COCO and the A&E benchmark show significant improvements. On the A&E dataset, Attention Regulation achieved a 66.2% Detection Success Rate (Det.Rate), a substantial leap from Stable Diffusion's 46.7%.
Crucially, this performance does not come at the cost of extreme latency. Attention Regulation is approximately 8x faster than previous state-of-the-art methods like Attend-and-Excite, adding only a ~49% overhead to the standard generation time. It also maintains high image quality, as evidenced by competitive FID scores.
Conclusion and Limitations
Attention Regulation provides a robust, efficient way to improve the reliability of text-to-image models without retraining. While it significantly reduces "missing object" errors, challenges remain in resolving "feature fusion" (where two objects merge into one) and handling semantic biases in the underlying model's training data. Future work aims to incorporate human-centric common sense to further refine these conceptual boundaries.
Summary updated