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 · DOI

Abstract

State-of-the-art text-to-image diffusion models frequently exhibit "dyslexia," failing to render legible and accurate text within generated scenes. This research identifies Byte Pair Encoding (BPE) tokenization and weak cross-attention binding as primary obstacles. We propose a novel framework that integrates Mixed Granularity Input—treating words as visual units—and Glyph-Aware Training, utilizing OCR-based feedback. Our approach significantly improves text accuracy in both English and Chinese while maintaining or enhancing overall image quality.

1. Introduction

Modern diffusion models like Stable Diffusion XL (SD-XL) produce high-fidelity imagery but struggle with the precise spatial and structural requirements of text. A request for a specific word often results in misspellings or illegible artifacts. This "dyslexia" stems from two main issues: the fragmentation of words into sub-tokens via BPE, which obscures the visual structure of glyphs, and the lack of strong alignment between text prompts and pixel-level generation in cross-attention layers. Furthermore, complex scripts like Chinese are largely unsupported by existing open-source backbones.

2. Methodology: Mixed Granularity and Glyph-Aware Training

To address these limitations, we introduce two key technical innovations designed to "empower" the underlying diffusion backbone.

2.1 Mixed Granularity Input

Traditional models rely on BPE tokens, which break words into arbitrary fragments (e.g., "diffusion" into "dif" and "fusion"). Our method supplements these with "glyph word" features. We use a pre-trained OCR model to extract visual features from a rendered template of the target text. These features are fused with standard CLIP embeddings, providing the model with a visual reference for the intended glyphs before the denoising process begins.

Comparison of BPE-based tokenization versus the proposed Mixed Granularity approach for text generation.

2.2 Glyph-Aware Training

We refine the training process using three specialized loss functions:

  • Attention Alignment Loss ($L_{attn}$): Ensures internal attention maps align precisely with the intended text coordinates.
  • Local MSE Loss ($L_{loc}$): Increases the weight of pixel-level reconstruction loss within text-heavy regions to capture fine details.
  • OCR Recognition Loss ($L_{ocr}$): Employs an OCR module as a "critic" during training. By penalizing the model when generated text is unreadable, we enforce legibility through Connectionist Temporal Classification loss.

3. Datasets and Evaluation

Our model was trained on two curated datasets. The English dataset consists of 240,000 high-quality image-caption pairs where text is prominent, with captions generated by Multimodal Large Language Models (MLLMs) to ensure descriptive accuracy. For Chinese, we developed a synthetic dataset of 50,000 samples, rendering phrases onto diverse backgrounds using image-to-image tools. Evaluation was conducted using the ChineseDrawText benchmark.

4. Results

Our enhanced models, built upon SD-XL and SDXL-Turbo, demonstrate superior performance across multiple metrics.

4.1 Quantitative Performance

On the ChineseDrawText benchmark, our "Ours(Turbo)" model achieved an OCR F1 score of 0.331, outperforming the base SDXL-Turbo (0.326) and significantly exceeding the standard SD-XL (0.125). In Chinese text generation, where baselines often fail entirely, our model achieved a Precision of 0.598 and an F1 score of 0.606.

4.2 Qualitative and Human Evaluation

User studies indicate a strong preference for our model in terms of text aesthetics, accuracy, and semantic relevance. Notably, focusing on text grounding improved the overall scene layout, leading to better FID scores than the original backbone models, suggesting a synergy between text accuracy and general image quality.

Example of high-quality English text generation on a complex, translucent object.

5. Conclusion and Future Work

By moving beyond sub-token fragmentation and incorporating visual feedback during training, we have significantly mitigated the text-rendering weaknesses of diffusion models. While training costs remain high and residual errors persist in highly stylized contexts, this work provides a robust path toward multi-lingual, glyph-accurate visual generation. Future research will explore expansion to additional languages and more diverse artistic styles.

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