Multimodal LLM Diagram Reconstruction: Capabilities, Failure Modes, and Evaluation
This article breaks down how multimodal large language models reconstruct diagrams from images into structured drawing instructions. It explains the four-stage pipeline from visual encoding to structured generation, catalogs common failure modes such as occlusion errors and coordinate drift, and outlines a layered evaluation approach covering structure, geometry, style, ordering, and renderability. Practical recommendations and cloud architecture patterns for batch evaluation are included.
1. Why Reconstructing a Diagram Is Harder Than It Looks
Within the capability map of multimodal large language models, reconstructing vector graphics from an image is one of the more demanding tasks. The model must first infer the three-dimensional structure implied by two-dimensional pixels, along with occlusion relationships between objects and the stacking order of layers. It then has to translate that understanding into structured drawing instructions: coordinates, paths, solid and dashed lines, fill regions, and drawing order. Compared with “recognizing which objects appear in an image,” this task adds a requirement to rebuild the underlying construction logic, which makes it a better reflection of a model’s real level in visual encoding and structured generation.
In recent internal testing discussions of intermediate builds, one observation came up repeatedly: the new version reconstructs complex diagrams noticeably better than earlier experimental builds. Behind this is not a single-point capability gain, but coordinated improvements across three areas: visual understanding, spatial reasoning, and code-style output.
2. Task Breakdown: Four Stages from Pixels to Drawing Instructions
Start by splitting the pipeline apart.
- Visual encoding: The model splits the input image into patches and encodes them into visual representations, forming an initial perception of the overall composition and local details.
- Structural understanding: On top of the visual representations, the model identifies geometric elements, including line directions, curve shapes, text positions, arrow directions, and region boundaries.
- Spatial reasoning: The model determines front-to-back occlusion, stacking order, and connections. This is the most error-prone stage, because a two-dimensional image carries no depth information; the model has to infer it from cues such as continuity, shadows, and where lines break.
- Structured generation: The model maps the reasoning result into coordinates and path descriptions in a drawing language, and decides what to draw first and what to draw later.
A schematic output structure typically looks like this (a generic shape only, not a specific interface):
elements:- type: pathpoints: [[x1,y1],[x2,y2],[x3,y3]]style: dashedfill: nonez_order: 1- type: rectbounds: [x,y,w,h]fill: "#DDDDDD"z_order: 2
Here z_order corresponds to drawing order, style to solid versus dashed lines, and fill to the fill region. Field names vary by tool, but the semantics are largely the same.
3. Common Failure Modes and Their Causes
- Incorrect occlusion judgment: Hidden edges are drawn as solid lines, or a visible break is misread as a dashed line, which inverts the structural relationship.
- Coordinate drift: The overall outline is correct but proportions are distorted, usually because there is no consistent global scale reference.
- Reversed layer order: An opaque region drawn later covers lines that should remain visible, leaving “missing blocks” in the image.
- Uncontrolled text and graphic mixing: Labels shift out of position and may even overlap paths.
- Inconsistent styling: Solid and dashed lines, line widths, and fill rules are not applied uniformly across the same element type, which hurts readability.
The common thread is that the model tends to “copy the visual appearance” rather than “reconstruct the construction intent.” The usual direction for improvement is to strengthen the intermediate representation, so the model first outputs a structured list of elements and relationship descriptions, and only then generates drawing code.
4. Evaluation Approach: How to Judge Reconstruction Quality
Layered evaluation is preferable to judging only whether the final image “looks similar.”
- Structure layer: Whether the number and types of elements are complete, and whether connections are correct.
- Geometry layer: Position error of key points, proportion deviation, and curve smoothness.
- Style layer: Whether solid and dashed lines, line widths, and fills match the original image.
- Order layer: Whether occlusion is rendered correctly and whether any abnormal covering occurs.
- Renderability: Whether the generated result renders on the first pass, along with the error rate and number of repair rounds.
A practical approach is to collect automated metrics first, then sample results for manual review, classifying errors into the five layers above to build a defect distribution that can be tracked over time.
5. Practical Recommendations: Key Actions to Improve Reconstruction
- Improve input quality: Too low a resolution loses thin lines and dashed segments, so moderate upscaling and contrast enhancement during preprocessing works better.
- Constrain output size: When there are too many elements, describe them layer by layer and generate layer by layer, avoiding a single large output that degrades quality toward the end.
- Declare drawing order explicitly: Write occlusion relationships as explicit constraints instead of letting the model guess implicitly.
- Allow fallback on failure: Keep a “render, compare, correct” loop in place, permitting a limited number of self-verification rounds.
- Standardize style rules: Define line types, line widths, and color rules in advance to reduce style drift.
For enterprise deployment, input images and intermediate artifacts can be placed in object storage, a message queue can decouple generation from rendering tasks, a container platform can host stateless rendering services, and logging and monitoring with alerting can track failure rates and latency distribution. This kind of general cloud architecture can significantly improve the efficiency of batch evaluation and iteration.
6. Outlook
The experience gap between experimental and intermediate builds shows that progress on this type of task comes mainly from a paradigm shift toward “understand the structure first, then generate code,” rather than from parameter scaling alone. For developers, what is worth investing in is the design of intermediate representations, a more complete evaluation system, and automation of the rendering loop. Only when these three are solid will capability gains translate reliably into usable engineering results.
