Baidu's Unlimited SVG Turns Any Image Into Editable Vector Code
Baidu open sourced a 0.5B active parameter multimodal model that converts complex images, CAD drawings, and blueprints into clean, editable SVG code.
Takeaways
- Baidu open sourced Unlimited SVG, a multimodal model that converts images into structured, editable SVG code.
- MoE architecture activates only ~0.5B parameters per token, enabling local deployment on a single GPU.
- Built on DeepSeek-OCR: compresses 2048x2048 images to 1024 vision tokens before decoding.
- Handles CAD drawings, blueprints, floor plans, and complex PDFs, not just logos or icons.
- Sustains real-time generation past 10,000 output tokens with full layer separation.
- Available under MIT license on Hugging Face with Transformers and vLLM inference scripts.
Baidu’s ERNIE multimodal team has released Unlimited SVG, an open-source model that converts raster images into structured SVG code. The model generates shapes, paths, colors, text, coordinates, and drawing order that can be rendered and edited with standard vector tools. Baidu reports roughly 0.5 billion activated parameters per token and provides the project under an MIT license through GitHub and Hugging Face.
SVG makes visual output testable
Image captions preserve subjects and broad relationships while discarding much of the underlying geometry. SVG can encode object boundaries, dimensions, colors, text, and spatial relationships in a machine-readable format that renders directly into an image.
Renderable output gives developers a practical evaluation loop. A pipeline can render the generated SVG, compare it with the source image, inspect element coordinates, and modify individual paths or text nodes. The same representation supports visual reconstruction, structured extraction, and downstream editing.
The 10,000-token bottleneck
Complex images can require more than 10,000 output tokens because every path, attribute, and text element consumes part of the sequence. Autoregressive decoding becomes slower and more expensive as that sequence grows. Unlimited SVG builds on DeepSeek-OCR and addresses the input and output costs separately:
- Compressed visual input: DeepEncoder represents a 2048 × 2048 image with 1,024 vision tokens. Baidu says the representation retains small text, thin strokes, and spatial details while shortening the visual prefix processed during generation.
- Sparse decoding: A mixture-of-experts architecture routes each token through a subset of the network, activating about 0.5 billion parameters per token. This reduces decoding compute during long SVG generations.
The activated-parameter figure describes computation per token. Deployment memory still depends on the model’s total weights, runtime, precision, and cache requirements. The release targets local inference on a single NVIDIA GPU with BF16 support, although the repository should be checked for current memory and software requirements before deployment.
Dense diagrams are the main target
Baidu positions the model for inputs with many small, precisely placed elements, including CAD drawings, architectural plans, floor plans, charts, scanned documents, icons, and marketing graphics. The generated SVG separates content into editable elements and preserves drawing order through the sequence of SVG nodes.
The release materials also describe occlusion-aware reconstruction, in which the model infers complete shapes when portions are hidden behind other objects. That capability can produce cleaner geometry, but it also introduces inferred content that may differ from the source. Measurements, labels, and safety-critical diagrams therefore require independent verification.
Generated SVGs can contain malformed paths, incorrect text, misplaced elements, or unnecessary complexity. XML validation confirms that a document is structurally parseable; visual fidelity requires rendering the result and comparing it with the input.
Two paths to local inference
The repository provides a direct Transformers workflow and a vLLM server for repeated requests. Both use 2048 × 2048 global-image inference in the documented configuration.
| Path | Best suited to |
|---|---|
| Transformers script | Local tests, batch jobs, and pipeline integration |
| vLLM server | Long-running services and higher request throughput |
Generation temperature affects the balance between deterministic geometry and varied output. The project recommends tuning it by image type:
| Input type | Suggested temperature | Purpose |
|---|---|---|
| CAD, diagrams, and charts | 0 to 0.3 | Preserve geometry, labels, and repeated structure |
| Natural scenes and photographs | 0.5 to 0.8 | Reduce repetitive generation and permit more varied paths |
A minimal inference call uses the model’s image prompt and 2048-pixel configuration:
raw = model.infer(
tokenizer,
prompt="<image> SVG:",
image_file="input.png",
base_size=2048,
image_size=2048,
crop_mode=False,
eval_mode=True,
)
The example script extracts the <svg>...</svg> block, parses it with ElementTree.fromstring, and writes the validated XML to disk. Its default limit of 30,000 new tokens accommodates large outputs, with corresponding effects on latency and memory use.
Production pipelines need guardrails
A practical integration should treat the generated document as untrusted structured output and add checks around the model:
- Prepare the input. Rasterize PDF pages and other unsupported document formats at a resolution that preserves small labels and lines.
- Validate the XML. Reject truncated output, malformed elements, invalid attributes, and documents without a usable
viewBox. - Sanitize the SVG. Remove scripts, event handlers, external references, and unsupported embedded content before displaying or distributing the file.
- Render in isolation. Use a sandboxed renderer with limits on file size, path count, dimensions, and processing time.
- Compare with the source. Render the SVG to a bitmap and calculate visual similarity, text accuracy, and geometry-specific checks relevant to the application.
- Preserve review paths. Route low-confidence results and technical drawings to human inspection before publication or operational use.
Where the model can save work
Unlimited SVG fits workflows that currently depend on manual tracing or brittle autotrace software:
- Converting scanned floor plans and blueprints into editable vector files
- Recovering CAD-style line art from flattened images
- Extracting reusable graphics from rasterized documents
- Reconstructing icons, diagrams, and charts from image-only sources
- Creating structured scene representations for editing, search, or measurement
The MIT license and local inference path also make the model suitable for document-processing systems that must keep source images within an organization’s infrastructure.
A richer training signal for vision models
Baidu proposes SVG generation as a pretraining task for broader vision-language systems. Producing renderable code requires a model to represent detailed geometry, object relationships, text, color, and occlusion order. Developers can then evaluate those predictions by rendering the output and comparing it with the original image.
The team also describes potential robotics applications based on coordinates, part relationships, and occlusion. An agent could generate a structured sketch of a scene before planning an action. That use remains speculative and would require stronger guarantees than visual reconstruction alone, including calibrated uncertainty, physical-scale estimation, and task-specific safety checks.
Unlimited SVG’s immediate contribution is a compact, locally deployable image-to-vector model with editable output and a permissive license. Its practical value will depend on reconstruction quality across real documents, generation latency, hardware requirements, and the strength of the validation pipeline built around it.