UniSVG: A Unified Dataset for Vector Graphic Understanding and Generation with Multimodal Large Language Models

Jinke Li, Jiarui Yu, Chenxing Wei, Hande Dong, Qiang Lin, Liangjing Yang, Zhicai Wang, Yanbin Hao

TL;DR

UniSVG is a new large-scale, multi-task dataset containing over 525k instances designed to train and evaluate Multimodal Large Language Models (MLLMs) on Scalable Vector Graphics (SVGs). By providing a unified framework for both SVG generation and understanding, UniSVG allows fine-tuned open-source models to match or even outperform proprietary giants like GPT-4V and Claude 3.7 in structural precision and semantic accuracy.

What Problem Does This Paper Address?

While modern MLLMs excel at processing bitmap images (pixels), they struggle with Scalable Vector Graphics (SVGs). Unlike bitmaps, SVGs are represented as XML-based code containing precise geometric paths, coordinates, and floating-point parameters. This makes them infinitely scalable and highly editable, but it also demands extreme precision from AI models attempting to read or write them.

Existing AI approaches for SVGs are often fragmented—focusing narrowly on either generating an SVG from a text prompt or converting a raster image into vector paths. Furthermore, current datasets lack the scale and multi-task diversity required to effectively train MLLMs to handle both understanding and generation tasks simultaneously.

Methods

The authors introduce a unified pipeline to collect, clean, and annotate a massive SVG dataset, followed by targeted MLLM fine-tuning.

Figure 1: Overview of our proposed UniSVG dataset, task, and benchmark on MLLMs
  1. Rigorous Data Cleaning: Raw SVG files collected from the web are notoriously noisy. The authors filtered out unrenderable files, stripped out redundant XML metadata (like DOCTYPE declarations and comments), used perceptual hashing (pHash) to remove duplicate images, and excluded overly complex graphics containing more than 100 Bézier curves to maintain training stability.
  2. Automated Multi-Modal Annotation: Using GPT-4V, the authors generated detailed descriptions ("SVGDES") for each cleaned SVG, capturing four key dimensions: overall description, colors, categories, and real-life usage.
  3. SVG-Specific Token Optimization: To boost training efficiency, the authors experimented with removing redundant syntax (such as commas and unnecessary decimal points) from the SVG code string.
  4. Model Fine-Tuning: The authors fine-tuned several open-source MLLMs (including LLaVA, LLaMA 3.2, and Qwen 2.5 VL) across three primary tasks: Image-to-SVG generation (ISVGEN), Text-to-SVG generation (TSVGEN), and SVG Understanding (SVGUN).
The UniSVG construction pipeline

Datasets

The paper introduces UniSVG, which consists of two main splits:

  • UniSVG (Training Set): 525,741 data items. This includes 450,642 items for generation tasks (split between image-to-code and text-to-code) and 75,099 items for understanding tasks (such as predicting color, size, shape count, and category).
  • UniSVG Benchmark (Test Set): A curated, high-quality evaluation set of 2,850 items (1,000 for ISVGEN, 500 for TSVGEN, and 1,350 for SVGUN) to rigorously test MLLM performance using metrics like SSIM, LPIPS, CLIP Score, and BERTScore.

Key Insights and Ideas

  • Stage 1 vs. Stage 2 Fine-Tuning: MLLMs typically undergo a two-stage training process: Stage 1 (aligning visual features with language tokens) and Stage 2 (supervised fine-tuning for instruction following). Interestingly, the authors found that fine-tuning a Stage 1 model on UniSVG yielded superior results compared to fine-tuning a Stage 2 model. This suggests that standard instruction-tuning might actually degrade an MLLM's capacity to learn highly specialized code-generation tasks.
  • The Code-LLM Advantage: Models built on top of language backends that are already proficient in code generation (e.g., LLaMA 3.1 vs. Vicuna) showed a massive performance boost when handling SVGs, confirming that vector graphics generation is fundamentally a code-generation challenge.
  • The Token Efficiency Trade-off: Stripping redundant commas and decimals from SVG code reduced the training token count by roughly 35% and cut training time by nearly 40%. However, this optimization caused a slight drop in generation quality, highlighting a delicate balance between computational efficiency and structural fidelity.

Key Results

The fine-tuned open-source models achieved outstanding results on the UniSVG Benchmark:

  • Qwen 2.5 VL (Finetuned) achieved the highest overall final score of 0.752, outperforming the best closed-source model, Claude 3.7 (0.722), as well as GPT-4V (0.650).
  • Structural Precision: While closed-source models like Claude 3.7 scored highly on semantic metrics (CLIP Score), their pixel-level similarity scores (SSIM and LPIPS) were quite poor. In contrast, the UniSVG-finetuned models generated vector graphics with vastly superior structural accuracy and visual detail.

Limitations and Future Work

While removing redundant syntax tokens significantly speeds up training, it alters standard SVG syntax, which slightly hurts the model's generation quality. The authors note that finding better ways to compress SVG code without losing structural meaning remains an open challenge.

For future work, the authors plan to explore how the high abstraction and information density of SVGs can be leveraged to improve MLLMs' core visual understanding capabilities, potentially treating SVG as a primary visual modality alongside traditional raster images.

Summary updated

Abstract

Unlike bitmap images, scalable vector graphics (SVG) maintain quality when scaled, frequently employed in computer vision and artistic design in the representation of SVG code. In this era of proliferating AI-powered systems, enabling AI to understand and generate SVG has become increasingly urgent. However, AI-driven SVG understanding and generation (U&G) remain significant challenges. SVG code, equivalent to a set of curves and lines controlled by floating-point parameters, demands high precision in SVG U&G. Besides, SVG generation operates under diverse conditional constraints, including textual prompts and visual references, which requires powerful multi-modal processing for condition-to-SVG transformation. Recently, the rapid growth of Multi-modal Large Language Models (MLLMs) have demonstrated capabilities to process multi-modal inputs and generate complex vector controlling parameters, suggesting the potential to address SVG U&G tasks within a unified model. To unlock MLLM's capabilities in the SVG area, we propose an SVG-centric dataset called UniSVG, comprising 525k data items, tailored for MLLM training and evaluation. To our best knowledge, it is the first comprehensive dataset designed for unified SVG generation (from textual prompts and images) and SVG understanding (color, category, usage, etc.). As expected, learning on the proposed dataset boosts open-source MLLMs' performance on various SVG U&G tasks, surpassing SOTA close-source MLLMs like GPT-4V. We release dataset, benchmark, weights, codes and experiment details on https://ryanlijinke.github.io/.
BibTeX
@inproceedings{li2025unisvg,
  author = {Jinke Li and Jiarui Yu and Chenxing Wei and Hande Dong and Qiang Lin and Liangjing Yang and Zhicai Wang and Yanbin Hao},
  title = {{UniSVG: A Unified Dataset for Vector Graphic Understanding and Generation with Multimodal Large Language Models}},
  booktitle = {ACM Multimedia},
  year = {2025},
}
Figure