VGBench: Evaluating Large Language Models on Vector Graphics Understanding and Generation

Bocheng Zou, Mu Cai, Jianrui Zhang, Yong Jae Lee

Abstract

Vector graphics (VG) are fundamental to design and engineering, yet research into Large Language Models (LLMs) has primarily focused on rasterized pixel data. We introduce VGBench, a comprehensive benchmark designed to evaluate LLMs on their ability to understand and generate vector graphics across three distinct formats: SVG, TikZ, and Graphviz. Our evaluation reveals a significant "semantic gap": LLMs excel at high-level, code-like formats (TikZ and Graphviz) but struggle with low-level geometric descriptions (SVG). We demonstrate that while Vision-Language Models (VLMs) perform better on raw SVG, LLMs leverage the structured nature of TikZ and Graphviz more effectively.

Introduction

Most computer vision research treats images as grids of pixels. However, vector graphics—represented as text-based geometric primitives like lines, circles, and paths—are the standard for designers and engineers. While models like GPT-4 exhibit an emergent ability to interpret code-based imagery, existing evaluations have been fragmented and often qualitative.

VGBench addresses this gap by providing a unified framework to test both understanding (answering questions about VG code) and generation (creating VG code from text) across diverse semantic levels.

Overview of VGBench: Vector Graphics Types, Question Types, and Tasks.

Methodology

VGBench evaluates models through two primary tasks:

  1. Vector Graphics QA (VGQA): Models are presented with VG code and must answer multiple-choice questions. These range from low-level attribute identification (e.g., color, count) to high-level functional reasoning (e.g., usage in software, relational positions).
  2. Vector Graphics Generation (VGen): Models generate valid, visually accurate code based on descriptive text captions.

The benchmark was constructed using a semi-automated pipeline. VG code was curated from web sources and existing datasets. Question-answer pairs were initially suggested by GPT-4V based on rendered images and subsequently filtered by human annotators to ensure ground-truth accuracy. For generation tasks, performance was measured using CLIP scores and Fréchet Inception Distance (FID) to assess visual similarity between the generated output and the ground truth.

Dataset Characteristics

VGBench comprises a large-scale collection of 4,279 visual question-answer pairs for understanding and 5,845 VG-caption pairs for generation. It covers three formats with varying levels of abstraction:

  • SVG: Low-level XML containing raw coordinates and path data.
  • TikZ: High-level LaTeX-based scientific graphics.
  • Graphviz: Structural diagrams defined by nodes and edges.
Examples of visual question-answering tasks for SVG, TikZ, and Graphviz.

Key Insights and Results

The Semantic Alignment Hypothesis

A core finding is that LLMs perform significantly better on TikZ and Graphviz than on SVG. We hypothesize this is due to semantic alignment: TikZ and Graphviz use labels like \node or edge that map directly to natural language concepts learned during pre-training. In contrast, SVG's "wall of numbers" lacks inherent linguistic meaning, making it harder for text-only models to parse.

LLMs vs. VLMs

In a comparative study, Vision-Language Models (VLMs) like LLaVA outperformed LLMs on SVG tasks by "looking" at the pixels. However, LLMs significantly outperformed VLMs on TikZ and Graphviz. This suggests that for structured graphics, the code representation is more informative for language models than the rendered image.

Performance Benchmarks

  • Model Rankings: GPT-4 remains the state-of-the-art, achieving 81-85% accuracy on TikZ/Graphviz, though this drops to 55-60% for SVG. Open-source models like Llama-3-70B and Qwen2-72B are increasingly competitive.
  • Prompting Strategies: Advanced techniques like Chain-of-Thought (CoT) and In-Context Learning (ICL) improved SVG performance by up to 7%, indicating that models possess latent geometric knowledge that requires specific reasoning paths to unlock.
  • Complexity: Performance on SVG and Graphviz reasoning tasks degrades as the complexity (string length) of the graphics increases.

Conclusion

VGBench highlights the current strengths and limitations of LLMs in the domain of vector graphics. While high-level formats are well-handled, low-level geometric reasoning remains a challenge. Future work will explore more complex prompting strategies, dynamic or animated graphics, and the integration of interactive UI components into the benchmark.

Summary updated

BibTeX
@inproceedings{zou2024vgbench,
  author = {Bocheng Zou and Mu Cai and Jianrui Zhang and Yong Jae Lee},
  title = {{VGBench: Evaluating Large Language Models on Vector Graphics Understanding and Generation}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2024},
  doi = {10.18653/v1/2024.emnlp-main.213},
}
Figure