ELLA: Equip Diffusion Models with LLM for Enhanced Semantic Alignment

Xiwei Hu, Rui Wang, Yixiao Fang, Bin Fu, Pei Cheng, Gang YuarXiv 2024

Abstract

Diffusion models have demonstrated remarkable performance in the domain of text-to-image generation. However, most widely used models still employ CLIP as their text encoder, which constrains their ability to comprehend dense prompts, encompassing multiple objects, detailed attributes, complex relationships, and long-text alignment. In this paper, we introduce an Efficient Large Language Model Adapter, termed ELLA, which equips text-to-image diffusion models with powerful Large Language Models (LLM) to enhance text alignment without training of either U-Net or LLM. To seamlessly bridge two pre-trained models, we investigate a range of semantic alignment connector designs and propose a novel module, the Timestep-Aware Semantic Connector (TSC), which dynamically extracts timestep-dependent conditions from LLM. Our approach adapts semantic features at different stages of the denoising process, assisting diffusion models in interpreting lengthy and intricate prompts over sampling timesteps. Additionally, ELLA can be readily incorporated with community models and tools to improve their prompt-following capabilities. To assess text-to-image models in dense prompt following, we introduce Dense Prompt Graph Benchmark (DPG-Bench), a challenging benchmark consisting of 1K dense prompts. Extensive experiments demonstrate the superiority of ELLA in dense prompt following compared to state-of-the-art methods, particularly in multiple object compositions involving diverse attributes and relationships.

Introduction: Overcoming the CLIP Bottleneck

Most popular text-to-image models, including Stable Diffusion and SDXL, rely on CLIP as their primary text encoder. While CLIP is effective for general concept matching, it suffers from a "semantic bottleneck" because it was trained on relatively short, simple alt-text pairs. This limitation manifests in three key areas: struggling with dense prompts containing multiple objects, failing to correctly bind attributes (like colors) to specific entities, and misinterpreting complex spatial or action-based relationships.

While state-of-the-art closed models like DALL-E 3 utilize LLMs to solve these issues, they typically require training the massive image-generation backbone (U-Net) from scratch. This approach is computationally prohibitive and breaks compatibility with the existing ecosystem of community tools. ELLA addresses this by acting as a lightweight, "plug-and-play" adapter that replaces CLIP with a powerful LLM while keeping both the LLM and U-Net frozen.

The ELLA Architecture: Timestep-Aware Semantic Connector (TSC)

The core innovation of ELLA is the Timestep-Aware Semantic Connector (TSC). The researchers observed that diffusion models process images in distinct stages: establishing global layout in early steps and filling in fine details in later steps.

ELLA enables complex semantic transformations, such as merging architectural landmarks with functional objects.

Unlike static conditioning, the TSC uses Adaptive Layer Normalization (AdaLN) to modulate the LLM's output based on the current denoising timestep. This allows the model to dynamically extract relevant semantic features—focusing on layout-related words early on and style or attribute-related words later. The TSC is based on a Perceiver Resampler, which handles variable-length text input from the LLM and produces fixed-length semantic queries for the U-Net.

Training and the DPG-Bench

To train ELLA, the authors utilized 34M image-text pairs from LAION and COYO, re-captioned using a Vision-Language Model (CogVLM) to create denser, more descriptive text. They also included 4M samples from JourneyDB.

To rigorously evaluate the model, the authors introduced the Dense Prompt Graph Benchmark (DPG-Bench). This benchmark consists of 1,065 complex prompts generated by GPT-4, categorized by entities, attributes, and relationships to provide a granular assessment of instruction-following capabilities.

Key Results and Performance

ELLA demonstrates significant improvements in prompt alignment and attribute binding. On the DPG-Bench, ELLA-SDXL achieved a score of 80.23, notably outperforming the base SDXL (74.65) and approaching the performance of DALL-E 3 (83.50).

ELLA demonstrates superior dense prompt following, correctly rendering multiple objects and attributes.

Beyond accuracy, ELLA is highly efficient, requiring less than 80% of the training time of other LLM-based models like PixArt-α. Because it keeps the U-Net frozen, it acts as a "brain transplant" for the model, retaining compatibility with existing LoRAs and ControlNets while providing the advanced linguistic reasoning of an LLM.

Conclusion

ELLA successfully bridges the gap between powerful Large Language Models and diffusion-based image generators. By introducing the Timestep-Aware Semantic Connector, the authors have provided a path to enhance semantic alignment and dense prompt following without the need for expensive retraining of the generation backbone. Future work will look toward interleaved image-text inputs and further refinements in spatial reasoning.

Summary updated

BibTeX
@misc{hu2024ella,
  author = {Xiwei Hu and Rui Wang and Yixiao Fang and Bin Fu and Pei Cheng and Gang Yu},
  title = {{ELLA: Equip Diffusion Models with LLM for Enhanced Semantic Alignment}},
  year = {2024},
  eprint = {2403.05135},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2403.05135},
}
Figure