NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Glyph-ByT5: A Customized Text Encoder for Accurate Visual Text Rendering

Zeyu Liu, Weicong Liang, Zhanhao Liang, Chong Luo, Ji Li, Gao Huang, Yuhui Yuan

Abstract

State-of-the-art text-to-image (T2I) models, while visually impressive, frequently fail to render accurate and legible text, often producing "gibberish" when prompted for specific strings or paragraphs. This paper presents Glyph-ByT5, a customized text encoder specifically engineered to overcome these limitations. By replacing standard sub-word encoders with a character-aware, glyph-aligned architecture, Glyph-ByT5 significantly enhances the ability of diffusion models to plan and render complex typography. Our approach improves text rendering accuracy on design benchmarks from less than 20% to nearly 90%, outperforming industry leaders like DALL-E 3 in typography quality and layout precision.

Introduction: The Text Rendering Bottleneck

Despite the rapid advancement of models like Stable Diffusion XL (SDXL) and DALL-E 3, accurate visual text rendering remains a persistent challenge. The primary cause is the reliance on text encoders like CLIP, which utilize sub-word tokenization. This process obscures individual character identities, making it difficult for the model to "see" the spelling of words. While T5-based models offer better linguistic understanding, they lack alignment with visual glyphs. To achieve high-fidelity text rendering, an encoder must possess both character awareness and visual alignment.

Methodology

The researchers developed Glyph-ByT5 through a multi-staged training and architectural overhaul:

  1. Character-Aware Foundation: The system utilizes ByT5, a model that processes text byte-by-byte. This ensures that every character is represented individually, providing the necessary granularity for spelling accuracy.
  2. Glyph-Alignment Pre-training: Using a "Learning from IT" (LiT) strategy, the ByT5 encoder is fine-tuned to align its text embeddings with visual character representations from a frozen DINOv2 encoder. DINOv2 was chosen over CLIP for its superior ability to preserve the geometric identity of shapes.
  3. Box-level Contrastive Loss: A novel loss function was introduced to force the model to align specific text strings with their corresponding spatial bounding boxes, improving layout control.
  4. Glyph Augmentation: To ensure robustness against spelling errors, the model was trained on "hard negatives"—text strings containing intentional typos—forcing the encoder to prioritize exact character sequences.
  5. Integration via Region-wise Multi-head Cross-Attention: This mechanism allows Glyph-ByT5 features to be injected into specific regions of the image (where text is required) while maintaining standard CLIP features for the background, ensuring overall image quality.
Figure 3: An example of a design poster rendered with high accuracy, showing complex text like "60% OFF" and specific dates.

Datasets and Benchmarks

To train and evaluate Glyph-ByT5, several specialized datasets were curated:

  • Glyph-Text & Paragraph-Glyph-Text: Synthetic datasets containing ~1 million pairs of text-glyph data, including dense paragraphs (100–400 characters) to teach multi-line layout planning.
  • Visual Design Dataset: A collection of high-quality posters and cards with detailed captions generated by LLaVA.
  • VisualParagraphy Benchmark: A new evaluation set of 1,000 prompts requiring complex, multi-line text rendering across various aspect ratios.

Key Results and Insights

The implementation of Glyph-ByT5 leads to several breakthroughs in T2I performance:

  • Accuracy Leap: On design benchmarks, Glyph-SDXL boosted text rendering accuracy from under 20% to nearly 90%.
  • Superior Paragraph Rendering: The model demonstrates an unprecedented ability to render over 100 characters in a single image, managing line spacing and word wrapping automatically.
  • User Preference: In head-to-head studies, Glyph-SDXL was preferred over DALL-E 3 for its superior typography and layout quality.
Figure 1: Demonstration of multi-line paragraph rendering, showing the model's ability to handle long quotes with proper layout and legibility.

Conclusion and Future Directions

Glyph-ByT5 demonstrates that the text encoder is the primary bottleneck in visual text rendering. While the model excels at design-oriented text, future work will focus on improving "scene text" (text on 3D surfaces or in perspective) and mitigating "language drift," where heavy text-tuning can slightly impact general prompt following. Scaling the training data to 100 million pairs is expected to further enhance font diversity and multilingual capabilities.

Summary updated

BibTeX
@inproceedings{liu2024glyph,
  author = {Zeyu Liu and Weicong Liang and Zhanhao Liang and Chong Luo and Ji Li and Gao Huang and Yuhui Yuan},
  title = {{Glyph-ByT5: A Customized Text Encoder for Accurate Visual Text Rendering}},
  booktitle = {European Conference on Computer Vision},
  year = {2024},
  doi = {10.1007/978-3-031-73226-3\_21},
}
Figure