--- license: apache-2.0 library_name: pytorch tags: - svg - computer-vision - autoencoder - representation-learning - arxiv:2608.21893 --- # SLS — A Scalable Vector Graphics Latent Space Pretrained weights and tokenizer for **A Scalable Vector Graphics Latent Space** (ECCV 2026). - **Authors:** Leonardo Zini, Elia Frigieri, Lorenzo Baraldi - **Paper:** https://arxiv.org/abs/2608.21893 - **Code:** https://github.com/aimagelab/svg_latent_space - **Project page:** https://aimagelab.github.io/svg_latent_space/ ## Model SLS is a Transformer autoencoder that maps each SVG path to a 1024 dimensional latent vector and decodes it back to symbolic geometry and style. The released model has 8 encoder layers, 8 decoder layers, 8 attention heads, a vocabulary of 448 tokens, and 135,774,656 learned parameters. This is a custom PyTorch model loaded using the code repository linked above. The architecture is described in `config.json`, and `configs/sls.yaml` contains the training and inference settings used by the code. ## Files ```text weights/sls/model.safetensors tokenizer/tokenizer.model tokenizer/tokenizer.vocab configs/sls.yaml config.json assets_manifest.json LICENSE ``` The release contains the pretrained model and tokenizer. Optimizer, scheduler, RNG states, training logs and datasets are not included. SHA256 checksums for the model and tokenizer are recorded in `assets_manifest.json`. ## Quick start Clone the code repository and install its dependencies using Python 3.11: ```bash git clone https://github.com/aimagelab/svg_latent_space.git cd svg_latent_space python -m venv .venv source .venv/bin/activate pip install -r requirements.txt ``` Download the assets and set the required environment variable: ```bash hf download lzini/SLS --local-dir sls_release export SLS_ASSETS_DIR="$(realpath sls_release)" ``` **In this version, `SLS_ASSETS_DIR` must be exported before using the default config for training or inference.** Repeat the export in each new terminal. ```bash python inference.py reconstruct --input examples/example.svg --output outputs/reconstructed.svg python inference.py encode --input examples/example.svg --output outputs/embeddings.safetensors python inference.py decode --input outputs/embeddings.safetensors --output outputs/decoded.svg ``` CUDA is used when available. Add `--device cpu` to select CPU execution. See the code repository for training, fine-tuning and checkpoint-resume commands. ## Representation and limits The model uses last-token pooling (`cls_mode: last`) and produces raw latent vectors (`l2norm: false`). Preserve their magnitude when decoding. Normalize a separate copy when computing cosine similarity. The inference code canonicalizes supported SVG shapes into paths on a 512×512 canvas, with rounded coordinates and serialized style. Inputs exceeding 1024 tokens per path are rejected. Arbitrary CSS and nested transforms are not fully supported, and predicted SVG/XML paths may require validation. ## License The released weights and tokenizer are licensed under Apache-2.0. See `LICENSE`. ## Citation ```bibtex @inproceedings{zini2026scalable, title = {A Scalable Vector Graphics Latent Space}, author = {Zini, Leonardo and Frigieri, Elia and Baraldi, Lorenzo}, booktitle = {Proceedings of the European Conference on Computer Vision (ECCV)}, year = {2026} } ```