Multimodal LLM Diagram Reconstruction: Capabilities, Evaluation, and Engineering Practices
This article breaks down why multimodal large language models can recognize images but struggle to redraw diagrams as compilable vector code. It examines four capability layers behind diagram reconstruction, explains how to evaluate them with a reproducible, layered benchmark, and shares practical engineering techniques for improving syntax stability, spatial reasoning, and semantic mapping.
1. Background: The Leap from Reading Images to Drawing Them
A recurring observation in recent technical discussions is that multimodal LLMs have become fairly mature at recognizing image content, yet their success rate drops sharply once they are asked to redraw a diagram as compilable vector code. The reason is that these two types of tasks demand entirely different capabilities.
Recognition tasks are essentially classification and description: the model only needs to determine what is in the image and roughly where it sits. Diagram reconstruction, by contrast, requires a complete transformation from semantics to structure. The model must first understand the 3D construction behind a 2D projection, then infer occlusion and front-to-back relationships between objects, and finally map the result to coordinates, paths, line styles, fill regions, and drawing order. A mistake at any step makes the final output impossible to render correctly.
For this reason, discussing how a particular internal preview build performs has limited value. The more useful questions are where the capability boundaries of such tasks lie, how evaluation should be designed, and how engineering can compensate for a model’s weaknesses.
2. Task Breakdown: Four Capability Layers of Diagram Reconstruction
2.1 Reconstructing 3D Structure from 2D Input
Diagrams are usually projections of 3D objects onto paper. The model must identify which lines are real edges and which are merely intersections produced by projection, then recover the proportional relationships among length, width, and height. This layer relies most heavily on spatial reasoning and is where errors concentrate: models often treat foreshortened edges as equal-length edges, distorting the overall proportions.
2.2 Reasoning About Occlusion and Layer Order
Occluded parts are invisible in the image, so the model must infer them from context and determine the boundaries of what it infers. Drawing order also determines the rendered result: an entity drawn earlier is covered by an opaque entity drawn later. If the order is reversed, the image is still wrong even when every coordinate is correct.
2.3 Mapping Symbols to Semantics
Arrows, dashed lines, section lines, and annotation text all carry explicit meaning. The model needs to map them to the corresponding drawing primitives rather than simply tracing outlines. Dashed lines, for example, represent hidden contours; dash-dot lines commonly indicate axes; fill patterns often denote materials or cross-sections.
2.4 Code Generation and Compilability
The final output must be syntactically valid code that a rendering engine can parse. This requires the model to follow syntax constraints strictly, including environment declarations, coordinate formats, path closure, and macro usage rules. Even a single missing bracket causes the whole output to fail.
3. Why Internal Preview Builds Are Worth Attention
In engineering practice, improvements in model capability are rarely linear. Intermediate builds are typically used to verify whether a specific capability has genuinely taken effect, such as whether spatial reasoning has improved or whether syntax stability holds up under long contexts. For developers, the value of these stages lies in exposing problems rather than delivering final answers.
A pragmatic way to judge progress is to look not at the reconstruction result of a single image but at whether the failure modes of the same task category are converging. If errors shift from syntax collapse to proportion deviation, the underlying capability has advanced. If errors remain randomly distributed, the capability has not truly been established.
4. Evaluation Design: A Reproducible, Quantitative Approach
A layered evaluation is recommended, so that subjective impressions do not replace metrics.
The first layer is the compile pass rate, meaning whether the output code renders normally. This is the most basic threshold.
The second layer is structural similarity, comparing whether the number of key entities, their relative positions, and their topological relationships are correct.
The third layer is attribute consistency, checking whether line styles, fills, and annotations are mapped correctly.
The fourth layer is human scoring, a supplementary judgment on aesthetics and readability.
A sample evaluation skeleton looks like this:
def evaluate(sample, model_output):result = {}result["compile_ok"] = try_render(model_output) # Syntax and renderabilityresult["entity_f1"] = match_entities(sample, model_output) # Entities and topologyresult["attr_acc"] = compare_style(sample, model_output) # Line styles and fillsresult["human_score"] = manual_review(model_output) # Subjective readabilityreturn result
The point of layered evaluation is to localize problems: compile failures call for tighter syntax constraints, missing entities indicate insufficient spatial understanding, and attribute errors usually point to deviations in semantic mapping.
5. Engineering Recommendations
First, constrain the output format. Fixed templates and examples that pin down how coordinates, paths, and line styles are written can significantly reduce syntax errors.
Second, adopt two-stage generation. Have the model first produce a structured intermediate description, such as an entity list and hierarchy, then generate code from it. The clearer the intermediate representation, the more stable the coding stage.
Third, introduce an automated validation loop. When rendering fails, feed the error message back to the model for a retry; this typically achieves a higher success rate than one-shot generation.
Fourth, build a domain evaluation set. Collect real diagrams covering typical scenarios such as occlusion, cross-sections, and annotations, forming a baseline for continuous regression testing.
Fifth, make reasonable use of general-purpose cloud capabilities. Batch evaluation can rely on a container platform to schedule tasks, with results written uniformly to object storage, while logging and monitoring with alerting track changes in pass rates. This turns subjective experience into long-term observable metrics.
6. Common Failure Modes and Mitigations
Proportion distortion often stems from misjudging perspective and can be eased by explicitly requiring key dimensional relationships to be annotated in the prompt. Incorrect drawing order can be improved by forcing the model to output the hierarchy before the paths. Syntax collapse usually requires both template constraints and automated retries. Lost annotations often result from information decay in long contexts, so annotations are best listed as a mandatory check item.
7. Conclusion
Diagram reconstruction is an effective test of a multimodal model’s spatial reasoning and code generation ability. Rather than chasing the single-point performance of a particular build, it is better to establish layered evaluation and automated validation, turning capability improvement into a measurable, regression-friendly engineering process. For development teams, this approach applies equally well to other structured-output scenarios and offers strong reusability.
