Unlimited-SVG · WebGPU
baidu/Unlimited-SVG, which redraws an image as structured, editable SVG, converted to ONNX so it runs entirely in a web browser on WebGPU with onnxruntime-web. Nothing is sent to a server: the image encoder and the mixture-of-experts decoder both run in the page.
Files
| File | Size | Contents |
|---|---|---|
encoder/encoder_fp16.onnx (+ .data) |
790 MB | SAM-B + CLIP-L + projector at 2048 × 2048 → 1057 × 1280 image embeddings |
decoder/decoder.onnx (+ .data0, .data1) |
1.69 GB | DeepSeek-V2 MoE language model with KV cache |
decoder/embed_int8.bin, embed_scales.bin |
158 MB | token embeddings, int8 per row |
decoder/vocab.json, config.json |
1.7 MB | byte-level BPE vocabulary (decode only), ids and shapes |
manifest.json |
every file the runtime fetches, with sizes |
About 2.6 GB in total, downloaded once and kept in the browser's Cache API.
Graphs
encoder · pixel_values f32 [1, 3, 2048, 2048] → image_embeds f32 [1057, 1280]
Input: flatten alpha onto white, pad to 2048 × 2048 (aspect kept, centered, gray 127), then x / 127.5 - 1.
Output is laid out as the original: 32 rows × (32 + newline) + view separator.
decoder · inputs_embeds f32 [1, S, 1280], past_key_values.{0..11}.key/value f32 [1, 10, P, 128]
→ logits f32 [1, 129280] (last position), present.* [1, 10, P + S, 128]. Positions are taken from the
cache length. The prompt is [BOS] + 1057 image embeddings + " SVG:" (ids 0, then 125430, 28);
generation ends at id 1.
Precision
- Encoder: weights stored fp16, computed in fp32. With fp16 math on WebGPU the embeddings drift (cosine 0.86 against PyTorch); fp16 storage with fp32 compute reaches cosine 0.999999 at the same speed. The global-attention layers of the SAM encoder are computed in chunks of image rows (numerically identical) so the 16384-token relative-position bias is never materialized.
- Decoder: routed experts 4-bit, attention / shared experts / dense MLP /
lm_head8-bit (ONNX RuntimeMatMulNBits, block 32), router and activations fp32. The routed experts run densely (all 64 experts, weighted by the router with zeros outside each token's top 6), which equals the sparse dispatch.
Measured (Apple M5 Max, Chrome 156, WebGPU)
- Image encoding + prompt prefill: ~3 s · decoding: 65–70 tokens/s.
- The sample image of the original model card produces the same SVG structure as the original model in PyTorch
and MLX; 4-bit quantization shifts small details (coordinates by a few units, occasionally a
<defs>block). - Needs WebGPU: Chrome / Edge 113+ or Safari 26+, on https or localhost, and roughly 4 GB of free GPU memory.
Usage
A worker-based runtime (no build step) loads manifest.json from a base URL, caches the files, and streams SVG
text. Point it at this repository:
const base = "https://huggingface.co/languel/Unlimited-SVG-WebGPU/resolve/main/";
const eng = new WebSVG({ base });
await eng.load((p) => console.log(p.phase, p.loaded / p.total));
let svg = "";
for await (const ev of eng.stream(imageFile, { temperature: 0, maxTokens: 12288 })) {
if (ev.add) svg += ev.add;
}
Temperature: 0–0.3 for logos, diagrams, CAD and charts; 0.5–0.8 for photos.
License and attribution
The weights are a conversion of baidu/Unlimited-SVG, © 2026 Baidu,
released under the MIT License (see LICENSE). This repository changes only the format and precision.
@misc{unlimitedsvg2026,
title = {Unlimited SVG Works: Trace On -- Projection of Visual Worlds into SVG-Anything},
author = {Baidu ERNIE, Multimodal Team},
year = {2026},
url = {https://unlimited-svg.github.io/}
}
Model tree for languel/Unlimited-SVG-WebGPU
Base model
baidu/Unlimited-SVG