TL;DR
This paper introduces the Large Vectorized Glyph Model (LVGM), a novel GPT-like architecture for generating vectorized Chinese characters by predicting strokes sequentially. By leveraging large language models and a new stroke-based SVG dataset, LVGM can generate complete characters, words, and even unseen verses with high fidelity and semantic coherence, mimicking the natural writing process.
What Problem Does This Paper Address?
Vectorized glyphs, which represent characters using mathematical primitives, are highly desirable for their scalability and flexibility in applications like graphic design and animation. While existing methods can generate vectorized characters, they often lack coherence in overall glyph structure, as they tend to generate segments and then stitch them together. This approach doesn't mimic the natural stroke-by-stroke writing process, which is crucial for both visual aesthetics and human understanding. The paper aims to bridge this gap by modeling character generation as a sequential prediction of strokes, enabling a more natural and coherent generation process.
Methods
The core of the LVGM approach is a two-stage process:
- Stage 1: Stroke Modeling and Quantization:
- Individual strokes within a glyph are first represented as sequences of SVG instructions (parameterized Bézier curves).
- These stroke representations are then encoded into discrete latent variables called "stroke embeddings." This is achieved using an encoder-decoder architecture inspired by VQ-VAE, where the encoder compresses the stroke representation, and the decoder reconstructs it, with the index of the nearest vector in a codebook serving as the discrete embedding. This stage focuses on learning a high-fidelity representation of individual strokes.
- Stage 2: Sequential Stroke Prediction:
- A large language model (LLM), specifically fine-tuned DeepSeek-Coder-1.3B, is used to predict the next stroke embedding in a sequence.
- The model is trained by feeding it sequences of stroke embeddings, separated by special tokens, to learn the order and dependencies between strokes. This stage leverages the sequential prediction capabilities of LLMs to generate entire glyphs by predicting one stroke after another, mimicking the writing process.
Datasets
- SVG-Strokes Dataset: The authors introduce a new, large-scale dataset comprising 907,267 Chinese glyphs. This dataset is unique in that it's based on individual strokes, ordered sequentially, and includes both regular and semi-cursive scripts. It's derived from existing sources and augmented with manual annotations for stroke segmentation and order. The dataset is structured using SVG format, with each glyph represented as a sequence of strokes, and each stroke as a series of SVG instructions.
Key Insights and Ideas
- Stroke-by-Stroke Generation is Key: The paper strongly advocates for modeling character generation as a sequential process of predicting individual strokes, rather than generating segments and merging them. This approach aligns with human cognition and leads to more coherent and aesthetically pleasing results.
- LLMs for Visual Generation: LVGM demonstrates the potential of large language models, traditionally used for text, to excel in visual generation tasks like vectorized glyph creation. This opens up new avenues for LLM applications beyond natural language processing.
- Data Scaling Matters: The experiments show a clear correlation between the size of the training dataset and the quality of the generated glyphs. Larger datasets lead to improved identifiability, aesthetics, and literary quality.
- Generating Unseen Content: A remarkable capability of LVGM is its ability to generate semantically coherent words and verses that were not explicitly present in the training data, showcasing a degree of creative extrapolation.
Key Results
- High-Quality Generation: LVGM achieves high scores across multiple evaluation metrics, including identifiability, aesthetics, and literature quality, as assessed by both experts and students. For instance, with a 100K sample training set, the model achieved a final score of 4.67 (experts) and 4.69 (students).
- Competitive Performance: Table 3 shows LVGM outperforming other state-of-the-art methods like DeepSVG, Im2Vec, and DeepVecFont-v2 in terms of MSE, PSNR, SSIM, and LPIPS, indicating superior graphic quality.
- Scaling Behavior: The model exhibits clear scaling behavior, with performance improving significantly as the training dataset size increases from 10K to 100K samples.
- Missing Stroke Generation: The model demonstrates a strong ability to complete glyphs even when provided with only a few initial strokes, showcasing its predictive power.
Limitations and Future Work
- Stroke Smoothness: The authors acknowledge that due to the high compression rate in Stage 1, the smoothness and completeness of generated strokes might occasionally be lacking.
- Limited Resources: The current experiments were constrained by available resources, preventing fine-tuning of larger models or exploration of even larger datasets.
- Future Directions:
- Scaling up both the model and the dataset, potentially incorporating Reinforcement Learning (RL) methods like PPO and DPO.
- Extending glyph generation to languages and styles beyond Chinese.
- Incorporating multimodal data to further enhance generation capabilities.
Summary updated