UniCalli: A Unified Diffusion Framework for Column-Level Generation and Recognition of Chinese Calligraphy

Tianshuo Xu, Kai Wang, ZhiFei Chen, Leyi Wu, Tianshui Wen, Fei Chao, Ying-Cong Chen

TL;DR

UniCalli is a unified diffusion framework that simultaneously masters the generation and recognition of Chinese calligraphy at the column level. By training these dual tasks together, the model learns to balance structural character accuracy with the artistic "flow" of ligatures and spacing, achieving state-of-the-art results that even extend to ancient scripts like Oracle Bone and Egyptian hieroglyphs.

What Problem Does This Paper Address?

Chinese calligraphy is more than just a sequence of characters; it is a holistic art form where the "rhythm" between characters—known as Qi-Yun—is as important as the characters themselves. This involves complex ligatures (connecting strokes), varied spacing, and fluctuating character scales.

Existing AI methods typically fall into two traps:

  1. Isolated Synthesis: They produce high-quality individual characters but fail to arrange them into aesthetically pleasing columns, resulting in "robotic" layouts without natural connections.
  2. Holistic Failure: They attempt to generate full pages but often sacrifice "calligraphic correctness," rendering characters with improper structures or "hallucinated" strokes.

Furthermore, calligraphic data is notoriously "long-tail"—there are thousands of characters but very few high-quality digitized examples for specific historical masters, making it difficult for standard models to generalize.

Methods

The researchers introduced UniCalli, built upon a Multimodal Diffusion Transformer (MMDiT) backbone. Its core innovation lies in treating recognition and generation as two sides of the same coin.

UniCalli Architecture
  • Unified Bidirectional Learning: Instead of separate pipelines, UniCalli uses asymmetric noising. To generate calligraphy, the model is given "clean" text and asked to denoise a blurry image. To recognize calligraphy, the process is reversed: the image is kept clean while the text latent is denoised. This joint training forces the model to learn a deep, "concept-level" understanding of radicals and stroke structures.
  • Box Map Latents: To master layout, the authors introduced a rasterized "box map" (an image representing character bounding boxes). By predicting this map during generation, the model learns the spatial "rhythm" of a column—where to shrink a character or where to leave room for a sweeping ligature.
  • Duplicate RoPE with Modulated Embedding: To fuse text, images, and box maps, the model employs a modified Rotary Positional Embedding (RoPE). It gives all three modalities a shared spatial coordinate system while using learnable "modality offsets" to keep their identities distinct.
  • Conditional Dropout: To prevent the model from becoming "too obsessed" with a specific style at the expense of character legibility, they use a dropout strategy that occasionally forces the model to generate characters without style prompts, ensuring the underlying structure remains sound.

Datasets

The authors curated a massive new resource for the community:

  • The UniCalli Corpus: Over 8,000 digitized works from 93 classical calligraphers (e.g., Wang Xizhi, Mi Fu).
  • Dense Annotations: 4,000 of these pieces are meticulously annotated with script types, per-character bounding boxes, and modern transcriptions, totaling over 150,000 character instances.
  • Synthetic Augmentation: They used TrueType Font (TTF) files to generate a vast amount of synthetic data, helping the model learn rare characters that don't appear often in historical scrolls.

Key Insights and Ideas

  • The Synergy of Duality: The most striking insight is that recognition makes the generator better, and generation makes the recognizer better. Recognition acts as a "structural constraint" that prevents the generator from making up fake characters, while generation provides the recognizer with "style priors" that help it decipher messy, cursive scripts.
  • Global Planning vs. Sequential Printing: Unlike autoregressive models that generate one character at a time (like a typewriter), UniCalli’s transformer attends to the entire column simultaneously. This allows it to "plan" ligatures between characters before the strokes are even drawn.
  • The Semantic Bridge: For Egyptian hieroglyphs, the authors used Chinese as an intermediary. Since both are logographic/pictographic, they mapped English -> Chinese -> Hieroglyphs, successfully bypassing the difficulty of direct alphabetic-to-pictographic translation.

Key Results

Visual Comparison with Baselines
  • Generative Quality: In user studies with calligraphy enthusiasts, UniCalli significantly outperformed ChatGPT-5, Ernie-4.5, and Doubao. It scored 4.56/5.0 in overall preference, compared to Doubao’s 3.93.
  • Recognition Accuracy: On a difficult test set of five different script styles, UniCalli achieved a total accuracy of 0.540, outperforming specialized models like CalliReader (0.533) and GPT-4o (0.380).
  • Zero-Shot Transfer: Despite being trained on Chinese, the model successfully generalized to Oracle Bone Script (67% completely correct generation) and Egyptian hieroglyphs (96% recognition accuracy).

Limitations and Future Work

  • Historical "Noise": Because the model is trained on stone rubbings (beike), it sometimes faithfully reproduces "weathering artifacts"—white patches or cracks in the stone—thinking they are part of the artistic style. The authors plan to implement better denoising to separate "art" from "decay."
  • Long-Tail Styles: While robust, the model still struggles with extremely rare, idiosyncratic styles that have very little representation in the training set.
  • Complex Layouts: The current work focuses on column-level generation; moving to full-page multi-column compositions with varying margins remains a future challenge.

Summary updated

BibTeX
@inproceedings{xu2026unicalli,
  author = {Tianshuo Xu and Kai Wang and ZhiFei Chen and Leyi Wu and Tianshui Wen and Fei Chao and Ying-Cong Chen},
  title = {{UniCalli: A Unified Diffusion Framework for Column-Level Generation and Recognition of Chinese Calligraphy}},
  booktitle = {International Conference on Learning Representations},
  year = {2026},
  url = {https://openreview.net/forum?id=OSIPdrw56X},
}
Figure