TL;DR
Diffusion Transformers (DiTs) are great at painting gorgeous scenes, yet they stumble when asked to write text in underrepresented languages or compose brand-new visual concepts. SpaG-DiT fixes this by giving text tokens temporary "GPS coordinates" inside their positional encodings only during training, untangling the "where" from the "what." At test time, the training wheels come off—leaving behind a pure text-to-image model that renders intricate scripts and novel creatures with remarkably little training data.
What Problem Does This Paper Address?
Modern text-to-image models—especially billion-parameter Diffusion Transformers like FLUX.1 and Qwen-Image—have largely solved photorealism, and with massive datasets, they even spell well in English and Chinese. However, ask them to write Hindi, Arabic, or Korean, or teach them a brand-new multi-part visual concept, and you quickly get gibberish glyphs and tangled anatomy.
Why? Because standard diffusion training suffers from a fundamental mismatch. The loss function (Mean Squared Error) demands exact, pixel-by-pixel reconstruction, while the text prompt offers only vague, high-level spatial hints like "on the top-right."
Without knowing where a word or object belongs on the canvas, the attention mechanism burns its capacity playing hide-and-seek across noisy image patches rather than learning the intricate curves of an unfamiliar script. Existing workarounds bolt on heavy auxiliary networks (like ControlNet) or require users to draw bounding boxes and supply glyph images at inference time—abandoning the simplicity of pure text-to-image generation.
Methods
Instead of adding bulky adapter networks, the authors look at an overlooked entry point: positional encodings (PE). In multimodal DiTs, image patches get 2D spatial coordinates (via Rotary Position Embeddings, or RoPE), while text tokens just sit on a flat, 1D sequential diagonal with zero geometric awareness of the canvas.
SpaG-DiT introduces Contextual Diagonal Position Encoding (CDPE) to bridge the two:
- Training-time spatial nudges: During training, if we know a text token corresponds to a specific bounding box on the image, CDPE takes the token's standard sequential position, centers it using a diagonal shift, and perturbs it with a scaled, quantized offset pointing toward that patch's $(x, y)$ coordinates relative to the image center.
- Preserving word order: Unlike naive projection—which dumps tokens straight onto 2D image coordinates and scrambles sentence structure—CDPE keeps the sequential index $i$ intact. Both word order and 2D layout survive.
- Zero-overhead inference: Spatial coordinates are strictly a training scaffold. At test time, spatial offsets are simply set to $(0, 0)$, reverting cleanly to the shifted sequential diagonal. Users just type a prompt—no bounding boxes required.
Datasets
Because existing text-rendering datasets heavily favor English and Chinese, the authors built two new benchmarks alongside a standard evaluation setup:
- SpaG-DiT-MultiLingual (New): 50,000 high-quality images across five underrepresented scripts—Hindi, Arabic, Japanese, Korean, and Bengali—sourced from MLT2019 and the web, filtered with EasyOCR, and recaptioned with Gemini 2.5-Flash.
- SpaG-DiT-Creature (New): ~5,000 synthetic text-image pairs across 200 novel, multi-part creature concepts (spanning animals, plants, artifacts, etc.) generated via a Gemini pipeline to test how well models bind new visual attributes to specific spatial layouts without identity leakage.
- MS COCO 2017 & GenEval: Standard COCO images (recaptioned with Gemini 2.5-Flash and paired with ground-truth bounding boxes) are used for training, then evaluated on the GenEval benchmark for general object composition and positioning.
Key Insights and Ideas
- Spatial ambiguity is a learning bottleneck, not just an inference problem: Models fail at low-resource scripts not because they lack capacity, but because spatial uncertainty drowns out fine-grained glyph learning during gradient updates. Give them temporary spatial anchors during training, and they learn complex character shapes from just ~50k total samples (instead of billions).
- You can't sacrifice sequence for space: In ablation studies, projecting text tokens directly onto 2D image coordinates (Image Position Encoding) or naively adding offsets without centering underperformed CDPE. Keeping linguistic sequence and centered spatial offsets in balance is what makes attention click.
- Soft quantized nudges tolerate noisy labels: Because CDPE applies bounded, truncated perturbations rather than hard attention masks, the model naturally tolerates moderate noise in automatically extracted bounding boxes.
Key Results
Built on Qwen-Image using lightweight LoRA fine-tuning, SpaG-DiT consistently beats both billion-scale baselines and vanilla supervised fine-tuning (Qwen-Image-SFT) trained on the exact same data:
- Multilingual Text Rendering: On SpaG-DiT-MultiLingual, base FLUX.1 Kontext dev (0.0000 Sentence Accuracy) and Qwen-Image (0.0482) virtually fail. Vanilla SFT reaches 0.1054 Sen.ACC, whereas SpaG-DiT jumps to 0.1738 Sen.ACC (a 1.6× gain) and 0.4326 Normalized Edit Distance (1.5× gain), while achieving the best image quality (87.64 FID).
- Novel Concept Learning: On SpaG-DiT-Creature, human evaluation accuracy rises from 69.0% (vanilla SFT) to 75.9% with SpaG-DiT, avoiding layout collapse and identity leakage.
- General Spatial Alignment: On GenEval, vanilla SFT actually dips slightly below the base model (84.52 vs. 84.71 overall), whereas SpaG-DiT pushes overall accuracy to 85.95%, hitting a perfect 100% on single-object rendering.
Limitations and Future Work
While SpaG-DiT makes dramatic strides over vanilla fine-tuning, a 17.38% exact sentence accuracy across mixed, underrepresented languages shows that pure text-to-image multilingual rendering is far from a solved problem. The authors explicitly note that rendering highly intricate, low-resource scripts remains an open limitation for future work to tackle.
Summary updated