The one-paragraph version
Back2Struct tackles a familiar frustration: diagrams, flowcharts, charts, and architecture sketches are often shared as flat pixel images, so you cannot click a box, fix a label, or move an arrow without redrawing everything. The paper treats those images not as photos but as symbolic artifacts made of shapes, text, connections, and layout, and trains a 7-billion-parameter vision-language model to look at the pixels and write out editable vector-graphics code — Scalable Vector Graphics, meaning a text file that describes shapes mathematically rather than as colored dots — that can be opened in PowerPoint and edited. It starts with ordinary supervised fine-tuning, meaning learning to imitate ground-truth code token by token, then adds reinforcement learning with a simple two-part reward: the code must actually render into an image, and that rendered image must look semantically like the input. On a new 84,121-pair dataset called StructHub, this small model renders successfully more often and matches structure and style better than larger general models, including StarVector-8B and even GPT-5 and Gemini-2.5-Pro in the authors' tests.
The problem they're solving, and why it matters
Researchers, engineers, and designers communicate with structured images: system diagrams, neural-network blocks, database schemas, flowcharts, plots. Unlike a natural photo, the value is in discrete relationships — this box connects to that diamond, these labels are centered, these columns are aligned.
Once that graphic is exported as a screenshot or embedded in a paper or slide, the symbolic information is lost. Pixel-generators can make something that looks plausible but you still cannot select or edit it. Classic vectorizers can trace curves and outlines, but they do not recover meaning: which shape is a node, which line is a directed edge, what text belongs to what box. Large vision-language models, meaning AI models that take images plus text as input, can describe images and write code, but the authors argue they are not optimized to produce code that is valid, concise, and visually faithful at the same time.
The practical consequence is manual rework: to reuse a figure you must rebuild it. Back2Struct aims to turn the static image back into an editable, checkable object-level description of text, shapes, topology, meaning connections, and layout, meaning spatial arrangement.
The key idea, in plain words
Do not copy pixels. Predict the program that would draw the diagram.
For example, instead of learning that “this region is blueish,” learn to output something like: “draw a light-blue rounded rectangle at the center, put white centered text saying ‘start’ inside it, then draw a thin blue arrow straight down from it to a thick green horizontal line.” That code explicitly keeps objects separate, so a user can later change the fill color, fix a typo, or drag the rectangle.
The second key idea is that imitating code token-by-token is the wrong training target. Two code files can look identical but use different word order or number formatting, while a one-character typo can make a file unrendersable. So after a warm start that imitates examples, the authors train directly for what users care about in deployment: does it render at all, and does the rendered result actually depict the right diagram.
They do this with a gated reward, meaning a score that multiplies two conditions. Think of rendering as a gatekeeper: if the code fails to produce any image, score zero no matter what else. Only if it passes the gate do you measure visual similarity. And that similarity is measured against a blank-page baseline, so an almost-empty diagram does not get undeserved credit just because most diagrams are mostly white background.
How it actually works, step by step
1. Build paired training data, StructHub. The team collects 84,121 pairs of a raster image, meaning a fixed grid of pixels, in this case 512 by 512 PNGs rendered with a browser engine, plus its ground-truth vector code. There are three sources: StarDiag-HQ with 52,875 examples from a web-scraped collection, focused on network, cloud, flowchart, and data-flow diagrams; OpenDiag with 27,953 examples from GitHub, Wikimedia Commons, and tools like draw.io, PlantUML, and Excalidraw, cleaned to remove embedded photos, editor metadata, unused definitions, and bloat, with 18,800 short enough to train on; and NNArch with 3,293 neural-architecture diagrams, denser and more path-heavy, with 1,453 short enough to train on. The cutoff for training is 8,192 tokens, meaning pieces of code text. Longer examples are kept aside to test generalization. A held-out benchmark of 1,000 examples — 569, 334, and 97 from each source — is split by code length into easy, medium, and hard tiers of about 333 each.
2. Warm start by imitation. They start from Qwen2.5-VL-7B, an open 7-billion-parameter vision-language model, and fine-tune it with LoRA, meaning a parameter-efficient adapter that updates only a small set of added weights, for one pass over about 73,000 pairs to predict the code sequence autoregressively, meaning one token at a time conditioned on the image.
3. Refine with comparison-based reinforcement learning. They frame generation as learning a policy, meaning a strategy that assigns probabilities to possible code outputs given an input image. They use Group Relative Policy Optimization, or GRPO, meaning an algorithm that samples several candidate codes for the same image — here four per image — scores each, and pushes the model toward candidates better than their group average, without needing a separate value-predicting network. Updates are stabilized with clipping, meaning limiting how far the policy can move in one step, plus a penalty for drifting too far from a frozen reference model. For engineering throughput they generate samples with a separate fast server and correct small mismatches with truncated importance sampling, meaning capping how much weight any single token mismatch gets.
4. The reward itself is deliberately simple. The syntactic part is binary: 1 if the code rasterizes successfully onto a white canvas, 0 otherwise. This is stricter than just checking that the text is well-formed XML, because some well-formed files still cannot draw. The perceptual part renders the prediction, embeds both prediction and target with a frozen DINOv2 ViT-B/14 encoder, meaning a vision model that turns an image into a normalized feature vector capturing semantic appearance, and takes cosine similarity, meaning the angle between those vectors as a likeness score. Then it subtracts the similarity a blank canvas would get for that same target and renormalizes, so blank gets 0 and a perceptually accurate render gets 1. Final score is the product of the two. The paper notes this replaced an earlier idea of adding separate length and language-model judge rewards, because additive rewards were hackable: the model learned to emit short, valid but nearly empty diagrams to collect the rendering bonus.
5. Evaluation fixes a measurement trap. Prior work resized diagrams with padding and scored failures as white images, which the authors show can make failures score higher than flawed-but-real attempts on metrics like SSIM and LPIPS. They instead preserve aspect ratio without padding, resize to 512 by 512, and score failures as black images, heavily penalizing them. Image metrics are DINO score, LPIPS — Learned Perceptual Image Patch Similarity, where lower distance is better — and SSIM — Structural Similarity Index, which compares luminance, contrast, and structure — plus render success rate. They also introduce GPTScore, where a language model rates the code itself on structure, flow accuracy for nodes, edges and arrow direction, and style similarity for colors, fonts, strokes, and corner radii, each 0 to 5, combined to 0 to 100.
What they showed — results, honestly, with limitations
On the full StructHub benchmark where failures are fully penalized, Back2Struct with reinforcement learning leads the open baselines the authors test, with about 71.5% render success overall versus 52.3% for the base Qwen2.5-VL-7B, 42.8% after supervised fine-tuning alone, 31.4% for StarVector-8B, and 18.8% for Qwen3-VL-30B-A3B, alongside the best DINO, LPIPS, SSIM, and GPTScore numbers. Gains hold across easy, medium, and hard tiers, though absolute performance falls on hard: success drops from 84.0% on easy to 55.0% on hard.
When looking only at examples that did render — a 200-sample comparison to limit API cost — the 7B model is competitive with or slightly ahead of commercial systems on the authors' metrics, for example best LPIPS and SSIM and a GPT score of 78.63 versus 77.95 for Gemini-2.5-Pro and 77.21 for GPT-5 in that subset. The paper also reports that fine-tuning the same model for text-to-SVG, meaning generating diagrams from step-by-step drawing instructions, stays competitive with those large models.
Ablations suggest composition matters more than adding signals. Partial or language-model-judge rewards leave easy success flat around 56% and hurt hard performance, while summing rule-based rewards improves success but worsens perceptual distance. Switching to the gated product improves both: about +28 to +30 points in success over supervised fine-tuning alone, up to +0.21 DINO and +0.22 SSIM, and lower LPIPS at all tiers.
Limitations are real. The new evaluation protocol is argued to be fairer, but it means scores are not directly comparable to prior papers. GPTScore is a model-based judge and inherits subjectivity. The 8K token limit excludes the most complex dense diagrams from training. The authors also note they had to build on a general vision-language model rather than a specialized image-aware code model, since none open-source was available. The paper does not fully detail compute for baselines or release status at time of writing, so treat the dataset and code availability claim as aspirational until verified.
Why this might matter to me
For spatial reasoning in vision-language models, this is a stricter test than captioning or question answering: to succeed the model must recover counts, relative positions, alignment, grouping, and directed connectivity, not just mention them. Errors are visible and executable, which makes it a useful probe for whether a model truly grounds layout and topology.
For world models, the lesson is code as a latent state. A compact, editable program that renders to the observation is more interpretable and intervenable than a flat feature vector. The blank-baseline trick and render-gate are directly transferable: reward what the world looks like when your hypothesized state is rendered, not how its tokens match a reference.
For text-to-CAD and parametric geometry, the analogy is close. CAD sketches and extrusions, like SVG primitives, are symbolic, constrained, and validity-gated — a tiny syntax error breaks the solid. The finding that additive validity plus similarity rewards invite empty-but-valid hacks, while multiplicative gating plus baseline subtraction forces meaningful content, is relevant to rewarding sketches, constraints, or programs that must both compile and match a drawing.
For 3D generation and scene representation, replace 2D rasterization with differentiable or neural rendering and the same pattern applies: supervise in the rendered view with a perceptual embedding, gate on successful construction of the scene graph or mesh, and keep object-level structure so assets remain selectable and restyleable rather than baked pixels or soupy geometry.
Terms worth knowing
- Structured image: a diagram-like image whose meaning lives in symbols and relations — boxes, arrows, labels, alignment — rather than texture.
- SVG / XML: Scalable Vector Graphics in Extensible Markup Language; a text file describing shapes, paths, colors, and text mathematically, so it scales and stays editable.
- Object-level code vs. pixel vectorization: predicting separate editable objects with labels and connections, versus merely tracing pixel contours into curves.
- Supervised fine-tuning (SFT): training to imitate ground-truth token sequences with cross-entropy loss.
- Policy: the model's learned distribution over possible code outputs given an image.
- GRPO: Group Relative Policy Optimization; learns by comparing multiple samples for the same input against their group average instead of using a learned value function.
- Render gate / syntactic reward: a 0-or-1 check for whether the generated code actually produces an image.
- Perceptual reward: similarity measured between rendered images using a vision encoder, here DINOv2, rather than between code strings.
- DINO score, LPIPS, SSIM: image similarity metrics capturing semantic embedding similarity, learned perceptual distance, and structural likeness, respectively.
- Render success rate (SR): share of outputs that compile and rasterize without extra repair tools.
- GPTScore: the authors' rubric where a language model rates predicted code versus ground truth on structure, flow accuracy, and style.
- StructHub: the paper's dataset of about 84K image-code pairs and 1K-example benchmark split into easy, medium, and hard by code length.