How Multimodal Large Models Reconstruct Graphics: From Image-to-Image to Image-to-Code
This article explains why generating compilable vector graphics from a diagram is a cross-stage leap for multimodal large models, going beyond a simple output format change. It breaks the task into four layers—visual element recognition, spatial relationship reasoning, 3D structure reconstruction, and structured output—and outlines common failure modes such as occlusion misjudgment, solid/dashed line confusion, wrong drawing order, coordinate drift, and text-geometry coupling, along with methods to locate them. It also covers evaluation design and practical deployment advice, emphasizing reproducible metrics and traceable error analysis over a single impression of quality.
1. Background: Why Moving from Image-to-Image to Image-to-Code Is a Cross-Stage Leap
In engineering practice, asking a model to generate a compilable vector graphics description from a schematic diagram may look like just an “output format change.” In reality, it tests the combination of three capabilities: visual semantic parsing, spatial structure reasoning, and structured code generation. The comparison experience mentioned in the original material essentially reflects a clear improvement in the model’s ability to reconstruct complex layer relationships during an intermediate internal testing stage.
It is worth emphasizing that model version iteration is a common R&D rhythm in the industry: first validate an intermediate version on a small scale, then converge capability boundaries based on feedback. For developers, what really matters is not a specific version number, but whether the evaluation dimensions are complete, whether errors can be located, and whether outputs are reproducible.
2. Task Breakdown: Four Layers from 2D Pixels to Vector Instructions
- Visual element recognition: distinguish basic primitives such as line segments, arrows, text, color blocks, and dashed boxes.
- Spatial relationship reasoning: determine occlusion, intersection, containment, alignment, and hierarchy.
- 3D structure reconstruction: restore perspective, projection, and isometric views into an expressible 2D topology.
- Structured output: generate coordinates, paths, line types, fills, and drawing order to form renderable graphics code.
The illustrative output structure can be abstracted into the following pseudocode, used only to explain how information is organized:
scene:layers: [background, midground, foreground]primitives:- type: pathpoints: [(x1,y1), (x2,y2), ...]style: {stroke: solid|dashed, fill: none|color}z_order: 3
The key is that z_order and style must be consistent with the visual semantics; otherwise, even if the coordinates are correct, the rendered result will show “layer disorder.”
3. Common Failure Modes and How to Locate Them
- Occlusion misjudgment: completing an occluded edge as a full solid line. The localization method is layered rendering and layer-by-layer comparison.
- Solid/dashed line confusion: treating auxiliary lines as solid outlines. It is recommended to explicitly state in the prompt that “auxiliary lines do not participate in filling.”
- Wrong drawing order: a later-drawn background covers the foreground. This can be constrained by a fixed layer order template.
- Coordinate drift: overall scaling or offset. Normalized coordinates and bounding box validation can be introduced.
- Text and graphics coupling: text is treated as a path. Text nodes and geometry nodes should be explicitly distinguished.
In engineering, a “dual-channel validation” approach is recommended: one channel performs structural validity checks (whether closed, whether out of bounds), and the other performs visual similarity comparison (outline and color block coverage).
4. Evaluation Design: Turning “Experience Improvement” into Quantifiable Conclusions
It is recommended to build a three-level evaluation set: simple block diagrams, composite diagrams with occlusion, and complex diagrams with 3D perspective. Metrics include structural accuracy, layer order accuracy, line type accuracy, and compilability rate. Each model iteration should fix the random seed and prompt template to avoid mistaking prompt changes for model capability improvements.
5. Implementation Suggestions
In real business scenarios, this capability can be embedded in scenarios such as “sketch to prototype,” “automatic illustration generation for documents,” and “batch generation of report diagrams.” It can be combined with object storage to save original images and outputs, message queues for asynchronous task peak shaving, container platforms to host inference services, and logging services with monitoring and alerting for quality tracking. If using related general capabilities from Baidu AI Cloud, it is also recommended to integrate them in a categorized manner to keep the architecture portable.
Overall, judging whether a multimodal model is “better at reconstructing graphics” should return to reproducible evaluation and locatable error analysis, rather than a single visual impression.
