GlyphControl: Glyph Conditional Control for Visual Text Generation

Yukang Yang, Dongnan Gui, Yuhui Yuan, Weicong Liang, Haisong Ding, Han Hu, Kai Chen

TL;DR

GlyphControl is a highly efficient, adapter-based framework that enables off-the-shelf text-to-image diffusion models to generate accurate and legible visual text. By incorporating a ControlNet branch conditioned on rendered text "whiteboards," it gives users precise control over text content, location, size, and orientation without needing to retrain the underlying base model.

What Problem Does This Paper Address?

While modern text-to-image models can generate breathtaking, photorealistic imagery, they notoriously stumble when asked to write text. Prompt a model to generate a sign saying "OpenSource," and you are likely to get a garbled mess of gibberish or misspelled characters.

This failure stems from two core issues:

  1. Tokenization Blindness: Standard text encoders (like CLIP or T5) use Byte-Pair Encoding (BPE) tokenizers, which group characters into sub-word tokens. This strips away character-level spelling information.
  2. Lack of Spatial Layout Control: Even when models use character-aware encoders (like ByT5), they lack explicit spatial awareness, frequently leading to layout errors like missing, merged, or misplaced glyphs.

Existing fixes usually involve swapping text encoders and retraining massive diffusion models from scratch. GlyphControl avoids this costly retraining by treating visual text generation as a geometry-conditioned control problem.

Methods

Instead of modifying the text encoder or altering the base generative model, GlyphControl builds upon a frozen Stable Diffusion 2.0-base model and introduces a trainable ControlNet branch.

The workflow relies on a simple but powerful concept: Glyph Images.

[User Input: Text + Bounding Box] 
               │
               ▼
      ┌─────────────────┐
      │  Glyph Render   │ ──► Generates "Whiteboard" Image (g)
      └─────────────────┘
               │
               ▼
      ┌─────────────────┐
      │ GlyphControlNet │ ──► Guides Spatial Layout
      └─────────────────┘
               │
               ▼
      ┌─────────────────┐
      │ Stable Diffusion│ ──► Generates Final Image with Legible Text
      └─────────────────┘
  • The Glyph Image: This is a clean, whiteboard-style image where the desired text characters are rendered in a default font at the exact target location, size, and rotation specified by the user.
  • Training Pipeline: During training, an off-the-shelf OCR engine (PP-OCR) extracts text and bounding boxes from real images to construct these whiteboard glyph maps. The ControlNet learns to map these geometric text structures into the latent space of the diffusion model.
  • Inference Pipeline: At inference time, users provide explicit "glyph instructions" (the text string, position, and size). The system renders the corresponding whiteboard map, and the ControlNet guides the frozen U-Net to cleanly integrate the text into the final generated scene.

Datasets

To train and evaluate the model, the authors introduced several key resources:

  • LAION-Glyph: A newly curated dataset derived from filtering LAION-2B-en. The authors selected images containing rich text content (verified via PP-OCRv3) and high aesthetic scores (>4.5), then generated clean, accurate captions using BLIP-2. This dataset was split into 100K, 1M, and 10M subsets for scalable training.
  • SimpleBench & CreativeBench: Two new evaluation benchmarks designed to test text rendering accuracy across varying prompt complexities—ranging from simple signposts (A sign that says "word") to complex, creative scenes (A photographer wears a t-shirt with the word "word" printed on it).

Key Insights and Ideas

  • Layout Beats Scale: Explicit geometric guidance (telling the model where to put the letters) is significantly more effective for rendering text than simply scaling up the language model size.
  • Parameter Efficiency: By freezing the base U-Net and only training the ControlNet adapter, GlyphControl achieves superior text rendering accuracy while using less than 22% of the parameters of massive pixel-level models like DeepFloyd IF.
  • Preserving Case and Flexibility: Unlike competing models that default to rendering all text in blocky capital letters, GlyphControl successfully preserves case sensitivity and fine-grained layout instructions, such as text rotation and multi-line splitting.

Key Results

GlyphControl significantly outperforms Stable Diffusion v2.0, SDXL 1.0, and DeepFloyd IF across OCR accuracy, CLIP score, and FID (image quality).

Figure 1: Illustrating selected 512 × 512 GlyphControl samples for different text prompts and glyph conditions. Our GlyphControl can generate coherent images with well-formed visual text.
  • OCR Accuracy: On SimpleBench, GlyphControl achieved a case-insensitive OCR accuracy ($\hat{Acc}$) of 48%, drastically outperforming DeepFloyd IF-I-XL (33%) and SDXL (13%). On CreativeBench, it achieved 34% accuracy vs. DeepFloyd's 21%.
  • Image Quality: It achieved the lowest Frechet Inception Distance (FID) on the evaluation sets, proving that adding strict text layout controls does not degrade the visual quality or realism of the background scene.

Limitations and Future Work

  • Style and Color Constraints: The current framework only utilizes a single default font style and renders text in black on the conditional whiteboard map. Consequently, the model lacks direct control over artistic font styles or text colors.
  • The Small Text Challenge: The model struggles to render large paragraphs of small text. This is partly because the training pipeline filtered out images with more than five OCR bounding boxes to avoid pixel-level reconstruction artifacts.
  • Captioning Bottlenecks: The performance remains bounded by the quality of the automated captions (BLIP-2), which occasionally fail to perfectly balance describing both the background scene and the exact text content simultaneously.

Summary updated

BibTeX
@inproceedings{yang2023glyphcontrol,
  author = {Yukang Yang and Dongnan Gui and Yuhui Yuan and Weicong Liang and Haisong Ding and Han Hu and Kai Chen},
  title = {{GlyphControl: Glyph Conditional Control for Visual Text Generation}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=thPI8hrA4V},
}
Figure