Empowering Backbone Models for Visual Text Generation with Input Granularity Control and Glyph-Aware Training

Wenbo Li, Guohao Li, Zhibin Lan, Xue Xu, Wanru Zhuang, Jiachen Liu, Xinyan Xiao, Jinsong Su

Abstract

Text-to-image diffusion models often struggle with generating accurate and legible visual text, a phenomenon largely attributed to sub-optimal tokenization and weak cross-attention mechanisms. This paper introduces a framework that enhances backbone models like SDXL through Mixed Granularity Input and Glyph-Aware Training. By incorporating glyph-centric representations and specialized loss functions, including OCR-based feedback, the proposed method significantly improves text rendering accuracy in both English and Chinese without compromising artistic image quality.

Introduction

While contemporary diffusion models excel at artistic composition, they frequently fail at the "spelling bee" of visual text generation. Prompts requiring specific text often result in illegible or misspelled characters. This research identifies two core issues: the fragmentation of words caused by Byte Pair Encoding (BPE) tokenization and the inability of cross-attention mechanisms to precisely bind text tokens to spatial regions.

Methodology

The proposed framework addresses these limitations through a two-pronged approach designed to augment existing backbone architectures.

Mixed Granularity Input

To move beyond fragmented BPE tokens, the authors implement a "glyph-centric" representation. Words intended for the image are rendered as simple glyphs and processed through a pre-trained OCR model to extract visual features. These features are then fused with standard text embeddings, providing the model with a visual template for character formation.

Comparison of standard BPE tokenization versus the proposed Mixed Granularity approach, showing significant improvements in text legibility for both English and Chinese.

Glyph-Aware Training

The training process is augmented with three specialized loss functions:

  1. Attention Alignment Loss ($L_{attn}$): Synchronizes internal attention maps with the intended spatial location of the text.
  2. Local MSE Loss ($L_{loc}$): Enhances pixel-level detail within text regions to prevent blurring.
  3. OCR Recognition Loss ($L_{ocr}$): Utilizes a pre-trained OCR model as a discriminator to penalize illegible text generation.
Visualization of attention maps, demonstrating how the proposed alignment loss focuses the model's internal representations on specific text regions.

Datasets and Implementation

The model was trained on a curated English dataset of 240,000 high-quality image-caption pairs and a synthetic Chinese dataset of 50,000 samples. The use of visual glyph features allows the method to scale effectively to logographic languages like Chinese, where traditional tokenization is particularly ineffective.

Results

Experimental results on SDXL and SDXL-Turbo demonstrate substantial gains. On the ChineseDrawText benchmark, the enhanced model achieved an OCR F1 score of 0.606, compared to the baseline's 0.284. Human evaluations also favored the proposed model across text aesthetics, accuracy, and semantic relevance. Importantly, the model maintains high image realism, as evidenced by stable FID scores.

Conclusion

By integrating mixed granularity inputs and glyph-aware training, this framework effectively bridges the gap between linguistic prompts and visual text generation. Future work will focus on expanding font diversity and applying these techniques to image-to-image editing tasks.

Summary updated

BibTeX
@inproceedings{li2024empowering,
  author = {Wenbo Li and Guohao Li and Zhibin Lan and Xue Xu and Wanru Zhuang and Jiachen Liu and Xinyan Xiao and Jinsong Su},
  title = {{Empowering Backbone Models for Visual Text Generation with Input Granularity Control and Glyph-Aware Training}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2024},
  doi = {10.18653/v1/2024.emnlp-main.455},
}
Figure