Scalable Vector Graphics are a fundamental medium for resolution-independent visual content, yet the deep learning community lacks a continuous, dense, and invertible latent space for vector representations, the kind of foundational building block that Variational Autoencoders and their descendants have long provided for raster images. We introduce SLS (SVG Latent Space), a Transformer-based autoencoder that learns compact dense representations of individual SVG paths, the atomic visual elements from which any SVG image can be composed. By modeling SVG commands, coordinate data, and visual properties within a unified BPE-based token vocabulary, SLS learns fixed-size latent representations that jointly capture structure and appearance, and can be decoded back into valid, style-consistent SVG paths with high fidelity. The resulting embedding space is robust, invertible, and structured: embeddings lie on a unit hypersphere, enabling efficient similarity search, composition, and downstream conditioning through simple vector-space operations. Finally, we demonstrate that SLS generalizes across diverse tasks reducing their FLOPs by over 150 times compared to token-based approaches, and establishing a general-purpose latent foundation for vector graphics research.
Figures & tables
Figure 1: Overview of the proposed approach: from left to right, we show (i) SLS path-level latent space, (ii) the encoding and decoding framework that learns structured dense representations, and (iii) and (iv) downstream applications including captioning with a large language model and element-level retrieval via similarity matching.
Figure 2: Overview of SLS architecture. SVG paths are encoded into latent representations, with Gaussian noise injection during training for regularization. The autoregressive decoder reconstructs paths through greedy sampling decoding. Embeddings on the unit hypersphere enable efficient downstream applications: similarity-based path retrieval and image captioning via learned projection into language model token space.
Method
Image
Path
MSE ↑
SSIM ↑
LPIPS ↓
DINO ↑
mIoU ↑
BLEU 5↑
MET ↑
Baseline
DeepSVG [ 5 ]
76.03
67.85
53.99
49.86
–
–
–
retrained
76.05
67.85
53.31
57.95
–
–
–
Ours
w/ ℓ2
86.51
81.05
28.63
72.41
66.79
62.05
90.02
Table 1: Reconstruction performance at image and path levels.
Figure 3: Qualitative results on reconstruction of input image.
Method
Image
Path
MSE ↑
SSIM ↑
LPIPS ↓
DINO ↑
mIoU ↑
BLEU 5↑
MET. ↑
Projection size
512
79.37
71.44
51.47
47.99
26.16
46.95
65.82
768
79.69
72.03
46.76
52.48
43.91
66.61
78.52
Pooling and training
LAST
90.77
87.13
19.27
81.08
79.17
96.17
97.04
Table 2: Architectural and training ablation studies. We evaluate the effect of (i) embedding projection size, (ii) training loss and pooling strategy (CLS vs. EOS, with/without KL), (iii) command-based tokenization approaches, and (iv) a block-wise image decomposition strategy instead of path-level modeling.
Encoder
SVG
Backbone
T2I ↑
BLEU5↑
METEOR ↑
ROUGE1↑
ROUGE2↑
Qwen3 0.6B [ 3 ]
29.48
49.44
69.12
75.23
63.48
CLIP [ 23 ]
✗
Gemma2 2B [ 31 ]
29.03
24.78
53.72
55.70
41.40
Llama 3.2 1B [ 1 ]
29.57
54.67
71.87
77.39
67.18
Qwen3 0.6B [ 3 ]
21.95
10.38
32.14
38.84
23.49
XML
✓
Gemma2 2B [ 31 ]
22.73
12.62
34.48
44.31
26.67
Llama 3.2 1B [ 1 ]
23.99
12.31
32.45
43.25
28.13
Table 3: SVG captioning performance with different encoders and language models. SLS surpasses invertible baselines (DeepSVG, XML) across all evaluation metrics, demonstrating superior semantic quality of learned embeddings. CLIP (gray) represents a non-invertible reference.
Figure 7
Llama3 1B
Qwen3 0.6B
Gemma2 2B
Avg.
Speedup
Context
w/o SLS
1636.55
2803.26
2856.27
2432.02
156.29
length
w/ SLS
15.56
15.56
15.56
15.56
Training
w/o SLS
9.82
10.09
34.27
18.06
167.22
TFLOPs
w/ SLS
0.09
0.05
0.18
0.108
Table 4: Computational analysis of SVG image captioning with and without SLS. Our compact path-level representations reduce the average context length by 156× and the training cost by over 167× TFLOPs across three LLM backbones.
Model
Raster
MSE-Sim ↑
LAB Dist. ↓
BLEU5↑
METEOR ↑
CLIP-B [ 23 ]
✓
98.67
11.66
10.58
34.12
DINOv2-B [ 21 ]
✓
98.86
14.68
10.77
34.55
DeepSVG [ 5 ]
✗
81.45
32.06
12.89
43.27
SLS (Ours)
✗
89.95
25.27
20.91
47.78
Table 5: Path retrieval performance on the SVG test set. SLS outperforms SVG-native encoders by retrieving more faithful SVG paths.
Figure 6: Reconstruction performance of SLS under varying noise levels. Additive Gaussian noise (left) and rotational perturbations applied to input vectors (right).
Model
MSE ↑
DINO ↑
LPIPS ↓
SSIM ↑
ID
90.83
80.85
18.79
87.26
OOD
86.67
76.12
30.18
78.44
Table 6: SLS performance in in-domain (ID) and out-of-domain (OOD) settings.
Recent large language models have shifted SVG generation from differentiable rendering optimization to autoregressive program synthesis. However, existing approaches still rely on generic byte-level tokenization inherited from natural language processing, which poorly reflects the geometric structure of vector graphics. Numerical coordinates are fragmented into discrete symbols, destroying spatial relationships and introducing severe token redundancy, often leading to coordinate hallucination and inefficient long-sequence generation. To address these challenges, we propose HiVG, a hierarchical SVG tokenization framework tailored for autoregressive vector graphics generation. HiVG decomposes raw SVG strings into structured atomic tokens and further compresses executable command--parameter groups into geometry-constrained segment tokens, substantially improving sequence efficiency while preserving syntactic validity. To further mitigate spatial mismatch, we introduce a Hierarchical Mean--Noise (HMN) initialization strategy that injects numerical ordering signals and semantic priors into new token embeddings. Combined with a curriculum training paradigm that progressively increases program complexity, HiVG enables more stable learning of executable SVG programs. Extensive experiments on both text-to-SVG and image-to-SVG tasks demonstrate improved generation fidelity, spatial consistency, and sequence efficiency compared with conventional tokenization schemes. Our code is publicly available at https://github.com/ximinng/HiVG
Scalable Vector Graphics (SVGs) power much of the modern visual ecosystem, yet state-of-the-art generative models focus almost entirely on rasterized images. We explore whether inference-time methods can unlock SVG generation capabilities in off-the-shelf vision-language models (VLMs). We systematically evaluate a constrained iterative refinement harness that combines visual feedback, structured editing, and constrained decoding to characterize the capabilities and limitations of current VLMs for SVG generation. Across multiple VLMs and generation settings, we find that constrained decoding improves compilation success rates, while iterative refinement reveals a deficit in visual reasoning and self-correction. Our results highlight both the promise and current limitations of using inference-time methods to adapt general-purpose VLMs for SVG generation.
Matthew Perlman, James Beetham, Niels Da Vitoria Lobo +2
University of Massachusetts Amherst · University of Central Florida
Scalable Vector Graphics (SVGs) function both as visual images and as structured code that encode rich geometric and layout information, yet most methods rasterize them and discard this symbolic organization. At the same time, recent sentence embedding methods produce strong text representations but do not naturally extend to visual or structured modalities. We propose a training-free, instruction-guided multimodal embedding framework that uses a Multimodal Large Language Model (MLLM) to map text, raster images, and SVG code into an aligned embedding space. We control the direction of embeddings through modality-specific instructions and structural SVG cues, eliminating the need for learned projection heads or contrastive training. Our method has two key components: (1) Multimodal Explicit One-word Limitation (mEOL), which instructs the MLLM to summarize any multimodal input into a single token whose hidden state serves as a compact semantic embedding. (2) A semantic SVG rewriting module that assigns meaningful identifiers and simplifies nested SVG elements through visual reasoning over the rendered image, exposing geometric and relational cues hidden in raw code. Using a repurposed VGBench, we build the first text-to-SVG retrieval benchmark and show that our training-free embeddings outperform encoder-based and training-based multimodal baselines. These results highlight prompt-level control as an effective alternative to parameter-level training for structure-aware multimodal retrieval. Project page: https://scene-the-ella.github.io/meol/