Turning Any Image Into Editable SVG Without Burning Through Tokens
You've probably tried getting a model to reproduce an image as SVG and watched it choke somewhere past a few thousand tokens—or cough up shapes that look nothing like what you fed it. Vectorizing a complex image is one of those tasks that sounds simple until you see the token counts. Baidu's Unlimited-SVG is a compact multimodal model built specifically to redraw any image as a structured, editable SVG, and it does it with just 0.5B activated parameters.
What It Does
Unlimited-SVG takes an image and outputs a complete, editable SVG. The README is upfront about the core problem: generating a full SVG for a complex image often exceeds 10,000 tokens, which puts large models into a long-context regime where they get slow and expensive fast. The project attacks that bottleneck from both directions.
On the input side, it's built on DeepSeek-OCR, and its DeepEncoder compresses an entire 2048 × 2048 image into just 1024 vision tokens while keeping fine details intact—small text, thin strokes, exact spatial coordinates. That shrinks the visual prefix dramatically before decoding even starts. On the output side, the model uses a mixture-of-experts architecture that activates only around 0.5B parameters per token. Minimal visual prefix plus sparse active compute means it can sustain real-time generation well past 10,000 tokens, which is what makes long-horizon SVG conversion practical on a model you can run locally.
Why It's Cool
-
The two-sided compression is the clever part. Most approaches to long-context generation try to solve one half of the problem. Unlimited-SVG shrinks what goes in (1024 tokens for a full 2048 × 2048 image) and what gets activated per token on the way out. Those two savings compound, and that's what gets you past the 10,000-token wall without a frontier API.
-
It's small enough to actually deploy. The README frames this as a locally deployable model rather than a dependency on "heavy frontier APIs." A 0.5B active parameter model with a 2048 × 2048 global inference mode is something you can reasonably run yourself, which matters if you're processing images at volume or don't want to ship your inputs to someone else's endpoint.
-
The temperature guidance is genuinely useful. The README doesn't just say "tune the temperature"—it tells you how. CAD, diagrams, and charts want low temperatures (0–0.3) to keep geometry and text exact. Natural scenes and photos want higher temperatures (0.5–0.8) to avoid repetitive loops and get more varied strokes. That's the kind of practical detail that saves you an afternoon of guessing.
-
The preprocessing details are handled. The inference examples use
ImageOps.padto resize the long edge to 2048 pixels, preserve aspect ratio, and center on a gray canvas—no tiling. Transparent pixels get composited onto white first, so images with alpha don't come out black. Small things, but they're the small things that break otherwise.
How to Try It
You'll need x86-64 Linux with uv, a compatible NVIDIA driver, and a free BF16-capable GPU. The model lives on Hugging Face as baidu/Unlimited-SVG.
- Set up a virtual environment and install dependencies:
uv venv .venv-svg-hf --python 3.12
uv pip install --python .venv-svg-hf/bin/python \
torch==2.6.0 torchvisio
-
Run inference from the repository root. The examples pad your image to a 2048 × 2048 gray canvas without tiling—keep that preprocessing, since transparent pixels need compositing onto white first.
-
Start greedy. Both the Transformers and vLLM examples run deterministically by default (
do_sample=Falsefor Transformers,temperature=0for vLLM). Then adjust based on your image type using the guidance above—low for diagrams, higher for photos.
There's also a Hugging Face Spaces demo (credited to AK and Hugging Face) if you want to poke at it before committing to a local setup, and the model is mirrored on ModelScope. Head to the repo for the full inference code.
Final Thoughts
Unlimited-SVG is aimed at a specific job—converting images into editable vector graphics at a scale where token cost actually matters—and the architecture choices make sense for that job rather than trying to be a general-purpose model. If you're vectorizing diagrams, CAD exports, or charts and need exact geometry, this is worth a look. If you need a single photo converted once, the setup overhead probably isn't worth it. The interesting takeaway is the design pattern: compress the input hard, activate sparsely, and suddenly long-context generation stops being a frontier-lab-only problem.
Follow @githubprojects for more developer tools and open source projects.