A Comprehensive Study of Decoder-Only LLMs for Text-to-Image Generation

Andrew Z. Wang, Songwei Ge, Tero Karras, Ming-Yu Liu, Yogesh Balaji

Introduction

While the text-to-image (T2I) generation field has seen rapid advancement, the underlying text encoders have remained relatively stagnant, often relying on aging architectures like CLIP or T5. This research investigates the potential of modern decoder-only Large Language Models (LLMs), such as Mistral and Llama 3, to serve as more effective "brains" for image generators. The study reveals that by moving beyond simple last-layer embeddings and adopting layer-normalized averaging, these models can significantly enhance image-text alignment and compositional reasoning.

Methodology

To isolate the impact of the text encoder, the researchers established a standardized training pipeline based on the Stable Diffusion v2 (SD2) architecture. They maintained a constant U-Net, autoencoder, and training dataset, swapping only the text encoder across 27 different model configurations.

Technical Innovations

A critical finding of this work is that the standard practice of using the final layer's embeddings is suboptimal for decoder-only LLMs, as these layers are highly specialized for next-token prediction. Instead, the authors introduced layer-normalized averaging, which extracts and averages normalized embeddings from every layer of the model. This approach provides the diffusion model with a richer, more comprehensive linguistic representation. Additionally, a learnable linear projection layer was utilized to map varying LLM dimensions to a consistent 1024-dimensional space.

Evaluation Framework

Models were trained on a 46-million subset of LAION-Aesthetics, enriched with detailed captions via VisualFactChecker (VFC). Evaluation was conducted using GenAI-Bench, a suite of 1,600 challenging prompts designed to test specific skills such as negation, counting, and spatial relations. Performance was measured using VQAScore (implemented with GPT-4o), providing a human-aligned automated metric.

Radar chart comparing performance across GenAI-Bench categories for different encoder strategies.

Key Insights: The "Last Layer" Trap

The study highlights that middle layers of an LLM often contain a superior balance of syntax and semantics compared to the final layer. By averaging across all layers, the generator captures both low-level structural details and high-level conceptual nuances. Furthermore, while scaling from 1.5B to 7B parameters generally improves performance, it does not linearly solve complex logic tasks like negation. Interestingly, LLMs fine-tuned specifically for text embedding tasks, such as bge-Gemma2, demonstrated the strongest performance, suggesting that retrieval-based tuning translates well to generative guidance.

Results and Qualitative Analysis

When employing layer-normalized averaging, models powered by Mistral-7B and bge-Gemma2-9B consistently outperformed the industry-standard T5-XXL baseline across nearly all reasoning categories.

Qualitative comparison of images generated using CLIP, T5-XXL, Mistral, and bge-Gemma2 encoders.

As shown in the qualitative results, the LLM-based encoders exhibit a marked improvement in handling complex prompts. For instance, they more accurately depict specific details like a rose blooming through a "narrow crack" or distinguishing between similar yet distinct subjects within the same frame. The researchers also noted that LLM-based encoders are more sensitive to Classifier-Free Guidance (CFG) weights, requiring careful tuning to reach peak performance.

Limitations and Future Directions

Despite these gains, challenges remain. The current study was conducted at 256x256 resolution, and models still struggle with comparative logic (e.g., "the largest tomato"). Future research may explore hybrid encoder architectures that combine the strengths of multiple LLMs or integrate them with CLIP to further bridge the gap in compositional and spatial reasoning.

Summary updated

BibTeX
@inproceedings{wang2025comprehensive,
  author = {Andrew Z. Wang and Songwei Ge and Tero Karras and Ming-Yu Liu and Yogesh Balaji},
  title = {{A Comprehensive Study of Decoder-Only LLMs for Text-to-Image Generation}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2025},
  doi = {10.1109/cvpr52734.2025.02661},
}
Figure