Abstract
Text-to-image (T2I) diffusion models often struggle to maintain semantic alignment when faced with long, complex textual descriptions. This paper introduces LongAlign, a framework designed to overcome the 77-token encoding limit and the aesthetic-driven overfitting common in preference-based fine-tuning. By employing segment-level encoding and a novel decomposed preference optimization strategy, LongAlign significantly enhances the instruction-following capabilities of T2I models without sacrificing visual quality.
Introduction
While current T2I models like Stable Diffusion excel at generating images from concise prompts, they frequently encounter a "semantic wall" as descriptions grow in length and detail. Two primary bottlenecks hinder performance: the fixed token limits of standard encoders (e.g., CLIP's 77-token limit) and the tendency of models to overfit to general aesthetic rewards during fine-tuning, which often leads them to ignore specific textual nuances in favor of generic visual appeal.
Methodology
Segment-Level Text Encoding
To address encoding constraints without losing the alignment benefits of contrastive models, LongAlign introduces a segment-level approach. Long prompts are partitioned into smaller segments (such as individual sentences) and encoded independently. The framework utilizes a specialized merging strategy that retains all start-of-text (<sot>) tokens while removing end-of-text (<eot>) tokens, creating a continuous, interpretable embedding stream for the diffusion process.
Decomposed Preference Optimization
The core innovation of LongAlign is the decomposition of preference signals. The authors observed that preference scores (e.g., PickScore) conflate text-relevant alignment with text-irrelevant aesthetic quality. By identifying a common "aesthetic direction" in the embedding space, LongAlign applies a gradient reweighting strategy during fine-tuning. This down-weights generic aesthetic signals, forcing the model to prioritize the specific semantic instructions provided in the prompt.
Experimental Setup
The model was trained on a diverse dataset of approximately 2 million images from sources including SAM, COCO2017, LLaVA, and JourneyDB. To ensure high-quality supervision, all images were re-captioned with detailed, long-form descriptions using advanced captioning models like LLaVA-Next. Evaluation was conducted using DPG-Bench and a custom 1k long-prompt dataset, with GPT-4o serving as a judge for head-to-head comparisons.
Key Results
The resulting model, longSD, demonstrates a marked improvement in following complex instructions. In GPT-4o evaluations, longSD achieved 668 wins against the base Stable Diffusion v1.5's 195. Despite its smaller architecture, longSD outperformed larger state-of-the-art models like PixArt-α and Kandinsky v2.2 in alignment metrics such as Denscore-O and VQAscore.
Qualitative analysis confirms that the model successfully manages spatial arrangements and multiple object placements that baseline models typically ignore. For instance, the model can accurately render dense, heart-shaped arrangements of specific items, maintaining both global structure and local detail.
Conclusion
LongAlign proves that superior text-to-image alignment is achievable through targeted fine-tuning strategies rather than just increasing model scale. By isolating the alignment signal from aesthetic bias and bypassing traditional encoding limits, LongAlign transforms standard diffusion models into robust tools for complex, long-text generation. Future research will focus on addressing deeper contextual dependencies and moving beyond the limitations of CLIP-based architectures.
Summary updated