Back2Struct: Making Structured Images Editable Again

Pengyu Yan, Yixin Wu, Yunjie Tian, David DoermannarXiv 2026

TL;DR

Back2Struct is a new framework that transforms static images of diagrams, charts, and flowcharts back into fully editable SVG/XML code. By fine-tuning a 7B-parameter vision-language model with a novel reward-based reinforcement learning approach, it significantly outperforms massive models like GPT-5 and Qwen3-Max at recovering the underlying symbolic structure of complex graphics.

What Problem Does This Paper Address?

Structured images—like neural network architectures, flowcharts, and data visualizations—are inherently symbolic. They consist of discrete elements (nodes, edges, text) arranged with specific logical relationships. However, these are almost always shared as rasterized pixels (PNGs or JPEGs).

Once rendered into pixels, the underlying "logic" is lost. You can't easily change a label, move a box, or restyle the arrows without manually recreating the entire graphic from scratch. Existing solutions fall short: standard vectorization tools focus on low-level curves rather than high-level semantics, and even the most advanced multimodal Large Language Models (LLMs) often struggle to generate SVG code that is both syntactically valid and visually faithful to the original layout.

Methods

The authors introduce Back2Struct, which treats structured image recovery as a code-generation task. The framework follows a two-stage training process:

  1. Supervised Fine-Tuning (SFT): The base model (Qwen2.5-VL-7B) is first trained on a large-scale dataset of image-SVG pairs to learn the basic mapping between pixels and code.
  2. Reinforcement Learning with GRPO: To move beyond simple token imitation, the authors use Group Relative Policy Optimization (GRPO). This stage optimizes the model based on the actual utility of the generated code at deployment time.

The core innovation lies in their Composite Reward Design. Instead of just checking if the generated code matches the ground truth tokens, they evaluate the rendered output:

  • Syntactic Reward (The Render Gate): The SVG is passed to a renderer. If it fails to compile or render, the reward is zero. This enforces strict validity.
  • Perceptual Reward: If the SVG renders, the resulting image is compared to the original input using a frozen DINOv2 encoder to measure visual and structural similarity.
  • Gated Composition: Crucially, these rewards are multiplied rather than added. This "gating" prevents "reward hacking," where a model might generate a very short, valid, but empty SVG to get a high "validity" score without actually drawing anything useful.
Overview of the Back2Struct framework, showing the transition from input image to editable SVG via RL-based optimization.

Datasets

The researchers introduced StructHub, a massive dataset of 84,121 structured diagram SVGs paired with their rasterized renderings. It draws from three distinct sources:

  • StarDiag-HQ: Web-scraped architecture diagrams and flowcharts.
  • OpenDiag: Real-world diagrams from open-source repositories like GitHub and Wikimedia.
  • NNArch: A specialized, high-complexity subset focusing on neural network architecture diagrams, which are often path-heavy and topologically dense.

They also established the StructHub-Benchmark, a held-out set of 1,000 samples stratified into Easy, Medium, and Hard tiers based on the complexity (token count) of the underlying SVG code.

Statistics of the StructHub dataset, showing token length distributions and content categories across its three sub-components.

Key Insights and Ideas

  • Symbolic Recovery over Pixel Generation: The authors argue that diagrams should be treated as symbolic artifacts. Predicting object-level SVG code is more useful than generating pixels because it preserves the ability to edit, restyle, and reuse the content.
  • The Power of the "Render Gate": Standard training (SFT) often overlooks small syntax errors that break an entire SVG. By making successful rendering a prerequisite for any reward during RL, the model learns to produce much more reliable code.
  • Multiplicative Gating vs. Additive Rewards: Additive rewards often lead to models finding shortcuts (e.g., generating tiny but valid SVGs). Multiplicative gating forces the model to balance validity with visual faithfulness.
  • Efficiency Matters: A specialized 7B-parameter model, when trained with the right domain-specific rewards, can significantly outperform general-purpose models that are orders of magnitude larger (like GPT-5 or Qwen3-Max).

Key Results

Back2Struct demonstrates a clear lead over state-of-the-art baselines across all difficulty levels:

  • Higher Success Rates: In the "Hard" benchmark tier, Back2Struct achieved a 55.0% render success rate, compared to just 10.2% for Qwen3-VL-30B and 11.1% for StarVector-8B.
  • Superior Fidelity: Qualitative comparisons show that while massive models like GPT-5 often miss connections, misalign arrows, or drop text labels, Back2Struct preserves fine-grained spatial layout and object hierarchies.
  • Generalization: The model also shows strong performance on Text-to-SVG tasks, proving that the structural knowledge gained from image-conditioned training transfers well to purely text-based prompts.
Figure 1: A qualitative comparison on recovering the reference images among the most advanced LLMs, including GPT-5 (Thinking mode) [45], Qwen3-Max (over 1 trillion parameters) [61], Gemini- 2.5-Pro [12], and Back2Struct (Ours). Back2Struct exceeds its counterparts with negligible confusion or mistakes in its responses, showcasing its superior ability in “making structured images editable again”. Note that Back2Struct has only 7B parameters.

Limitations and Future Work

  • Token Limits: The current model is capped at 8,192 output tokens, which prevents it from generating extremely large or overly detailed diagrams.
  • Base Model Constraints: Back2Struct is built on a general-purpose vision-language model. The authors suggest that using a base model specifically pre-trained for code generation might further enhance its capabilities.
  • Future Directions: Expanding the token budget and exploring even more complex structured domains (like CAD drawings or circuit board layouts) are promising next steps.

Summary updated

BibTeX
@misc{yan2026back,
  author = {Pengyu Yan and Yixin Wu and Yunjie Tian and David Doermann},
  title = {{Back2Struct: Making Structured Images Editable Again}},
  year = {2026},
  eprint = {2609.37016},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2609.37016},
}
Figure