Text-to-Vector Generation with Neural Path Representation

Peiying Zhang, Nanxuan Zhao, Jing Liao

TL;DR

Existing text-to-vector models directly optimize Bézier curve control points, frequently producing tangled, self-intersecting paths and uneditable layers. This paper introduces a dual-branch VAE that learns a smooth latent space for individual neural vector paths, coupled with a two-stage optimization pipeline (Variational Score Distillation followed by layer-wise vectorization). The result is clean, highly editable, and semantically organized SVGs generated directly from natural language prompts.

What Problem Does This Paper Address?

Vector graphics (SVGs) are indispensable in digital design due to their infinite scalability, compact file size, and clean layer organization. However, automated text-to-vector (T2V) generation remains difficult:

  1. Raster-to-vector pipelines (generating an image with diffusion, then applying vectorizers like Potrace or LIVE) inherit photorealistic textures and complex gradients, yielding hundreds of fragmented, unmanageable paths.
  2. Direct optimization approaches (such as VectorFusion) optimize Bézier control points directly via score distillation. Because control points have unconstrained degrees of freedom, paths frequently become jagged, cross over themselves, and stack into messy visual clutter.
  3. Global SVG generative models attempt to learn SVG distributions end-to-end, but they fail to generalize beyond narrow domains like fonts, sketches, or simple monochromatic icons.

Methods

The authors decompose complex vector graphics into simple, well-behaved local primitives via a two-part framework:

[Path Data: Points + Image] ──> Dual-Branch VAE ──> Latent Code z (24-D)
                                                          │
Stage 1: VSD Optimization (Diffusion + LoRA) <─────────────┘
  └── Optimizes {z_i, Color_i, Transform_i} via Variational Score Distillation
Stage 2: Layer-wise Vectorization
  └── Path simplification + Diffusion-based guidance image + Coarse-to-fine CLIP/IoU loss
  1. Neural Path Representation (Dual-Branch VAE):
  2. Sequence Branch: A Transformer-based encoder-decoder processes normalized control point sequences (padded to length $k=50$) to capture geometric ordering and connectivity.
  3. Image Branch: A CNN encoder-decoder processes rendered raster path patches ($64 \times 64$) to capture rendered visual shape.
  4. Fusion & Losses: Latent sequence and image representations are fused into a shared 24-dimensional latent code $z \in \mathbb{R}^{24}$. The VAE is trained end-to-end using a shape-level Chamfer Distance loss across sampled Bézier points ($L_{cfr}$), image perceptual and $L_1$ losses ($L_{img}$), and a standard KL-divergence penalty ($L_{kl}$).
  5. Two-Stage Text-Driven Optimization:
  6. Stage 1 (VSD Path Optimization): An SVG is parameterized as $m$ paths, each defined by latent vector $z_i$, color $C_i$, and affine transform $Tr_i$. Instead of standard Score Distillation Sampling (SDS)—which causes over-saturation and mode collapse—the authors adopt Variational Score Distillation (VSD) via Stable Diffusion and an auxiliary LoRA network to optimize path distributions against the text prompt.
  7. Stage 2 (Layer-wise Vectorization): The raw output from Stage 1 ($SVG^0$) undergoes path pruning (removing low-opacity paths $<0.05$ or tiny areas $<10\text{ px}$) and merging. A rasterized version is denoised with Stable Diffusion to generate a clean guidance image $I_g$. Paths are then sorted by area and recursively refined coarse-to-fine using an intermediate CLIP feature loss and a silhouette Intersection-over-Union (IoU) loss.

Datasets

  • VAE Training: The FIGR-8-SVG dataset, preprocessed following IconShop protocols into 200,000 clean black-and-white path samples.
  • T2V Evaluation: 160 diverse text prompts from the Stable Diffusion Prompts dataset (generating 5 SVGs per prompt, total 800 SVGs).
  • Quality Benchmark: An evaluation set of 800 professionally designed SVGs collected from iconfont used as ground truth for FID evaluation.

Key Insights and Ideas

  • Local Primitives over Global SVG Latents: Prior models struggled to represent entire SVGs with global latent vectors. Recognizing that complex graphics are composites of simple, regular shapes, modeling individual paths in latent space provides regularized geometry while preserving combinatorial expressivity.
  • Dual-Modality Path Learning: Sequence models alone often produce control points that describe valid loops but distort under rasterization; image-only models produce clean pixels but degenerate curve orders. Fusing both modalities enforces both topological validity and visual shape fidelity.
  • Coarse-to-Fine Layer Scheduling: Human artists draw large background silhouettes before adding fine details. Mimicking this through area-sorted, layer-wise optimization prevents small foreground details from being swallowed or tangled into background contours.

Key Results

Compared against state-of-the-art vectorization and optimization baselines (CLIPDraw, DiffSketcher, VectorFusion, LIVE, and Potrace):

  • Path Smoothness & Simplicity: Achieves the highest smoothness score (0.8012 vs. VectorFusion's 0.6322) using only 40 paths on average, compared to 128 for direct optimization methods and 160–430 for raster-vectorization pipelines.
  • Layer Semantics: Scored 0.0591 on layer-wise semantic impact (measured by drop in text-image CLIP similarity after dropping 30% of paths), significantly higher than VectorFusion (0.0139) and Potrace (0.0226), indicating each path corresponds to a coherent visual element.
  • Visual Quality & Alignment: Recorded an FID of 52.30 (surpassing standard VectorFusion at 65.71) and top text-image CLIP alignment (0.3015).
  • Downstream Applications: The framework naturally extends to concept-driven SVG customization, natural image-to-vector iconification via ControlNet, and text-driven SVG animation using ModelScope video diffusion.

Limitations and Future Work

  • Diffusion Failure Modes: Complex multi-object prompts (e.g., "a fiddle next to a basketball on a ping pong table") can fail when the underlying diffusion prior omits objects.
  • Boundary Over-Smoothing: The latent space prioritizes smooth, regular paths, which occasionally strips fine, sharp boundary details (e.g., jagged animal fur). Expanding the VAE training set to more complex path topologies is needed.
  • Inference Speed: Like other score-distillation methods, optimization is iterative and slow, taking approximately 13 minutes per SVG on an NVIDIA RTX 3090. Training a direct feed-forward network over the neural path representation remains an open direction.

Summary updated

BibTeX
@article{zhang2024text,
  author = {Peiying Zhang and Nanxuan Zhao and Jing Liao},
  title = {{Text-to-Vector Generation with Neural Path Representation}},
  journal = {ACM Transactions on Graphics (Proc. SIGGRAPH )},
  year = {2024},
  url = {https://openreview.net/forum?id=KdQ4utw37u},
}
Figure