StarVector: Generating Scalable Vector Graphics Code from Images and Text

Juan A. Rodríguez, Abhay Puri, Shubham Agarwal, Issam H. Laradji, Sai Rajeswar, David Vázquez, Christopher Pal, Marco Pedersoli

Abstract

StarVector is a multimodal foundation model that redefines Scalable Vector Graphics (SVG) generation as a code-generation task. By training a 1B-parameter vision-language transformer on the massive SVG-Stack dataset—comprising 2 million image-SVG pairs—StarVector learns to autoregressively produce complex, valid SVG code from raster images or text prompts. This approach bypasses the limitations of traditional geometric optimization, enabling the generation of rich SVG features like text and polygons with high efficiency.

Introduction

Scalable Vector Graphics (SVG) are indispensable in modern digital design due to their resolution independence. However, the process of "vectorization"—converting pixel-based raster images into SVGs—remains a significant technical challenge. Traditional methods typically rely on differentiable rendering, an iterative process that tweaks geometric shapes to minimize pixel-wise differences. These methods are often computationally expensive, struggle with complex topologies, and frequently ignore high-level SVG primitives such as text and gradients, reducing them to simplified paths.

Overview of StarVector's multimodal SVG generation capabilities.

StarVector addresses these challenges by treating SVG generation as a natural language processing (NLP) task. By leveraging the inherent structural "grammar" of SVG code, the model can "write" graphics directly, utilizing the full expressive power of the SVG language.

Methodology: SVG as a Language

The core of StarVector is a Vision-Language Transformer architecture designed to bridge the gap between visual perception and code synthesis. The system integrates three primary components:

  1. Image Encoder & Adapter: A pre-trained visual encoder (such as ViT) extracts high-level features from input images. These features are then mapped into the Large Language Model's (LLM) embedding space via a specialized adapter.
  2. Tokenizer & Embedder: Text instructions and SVG code are tokenized, allowing the model to treat SVG syntax with the same structural rigor as programming languages like Python.
  3. Large Language Model (LLM): A 1B-parameter transformer decoder, derived from the StarCoder family, serves as the generative engine.
The Vision-Language Transformer architecture of StarVector.

During training, the model is optimized to predict the next SVG token based on visual or textual context. At inference, it generates SVG code autoregressively, producing valid XML strings that can be rendered immediately.

The SVG-Stack Dataset

The performance of StarVector is underpinned by SVG-Stack, a novel large-scale dataset introduced by the authors. Sourced from TheStack (a repository of permissively licensed GitHub code), SVG-Stack contains over 2 million image-SVG pairs. Unlike previous datasets limited to simple icons, SVG-Stack encompasses real-world complexity, including diverse primitives, text elements, and advanced styling, providing the necessary diversity for a foundation model.

Key Insights and Results

StarVector demonstrates several advantages over traditional vectorization pipelines:

  • Structural Fidelity: By utilizing the full SVG syntax, the model generates higher-order primitives (e.g., <rect>, <text>) that traditional tools often simplify into complex, uneditable paths.
  • Multimodal Flexibility: The unified transformer architecture allows the model to perform both Image-to-SVG (vectorization) and Text-to-SVG (generation from natural language descriptions) within the same framework.
  • Computational Efficiency: Direct code generation avoids the costly iterative optimization loops required by diffusion-based or differentiable-rendering-based methods.

Limitations and Future Directions

Despite its strengths, StarVector faces challenges related to sequence length; extremely complex illustrations result in long strings that may exceed the transformer's context window or increase generation latency. Furthermore, while the model captures visual semantics effectively, achieving pixel-perfect precision for technical diagrams may still require manual refinement. Future work involves scaling model parameters and increasing dataset diversity to enable more sophisticated graphic design agents capable of complex UI and layout generation.

Summary updated

BibTeX
@inproceedings{rodriguez2025starvector,
  author = {Juan A. Rodríguez and Abhay Puri and Shubham Agarwal and Issam H. Laradji and Sai Rajeswar and David Vázquez and Christopher Pal and Marco Pedersoli},
  title = {{StarVector: Generating Scalable Vector Graphics Code from Images and Text}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2025},
  doi = {10.1609/aaai.v39i28.35369},
}
Figure