Multimodal LLM Evaluation: A Guide to Testing Graphic-to-Vector Code Generation
This article breaks down why generating compilable vector drawing code from an image is a demanding test of multimodal model capability. It examines four capability layers—visual parsing, spatial reasoning, symbolic mapping, and compilability—and outlines a structured evaluation approach using layered test sets, automated metrics, and manual spot checks. Engineering recommendations cover input preprocessing, prompt constraints, result validation, failure attribution, and a two-stage pipeline, along with guidance on setting realistic expectations for real-world use.
1. Background: Why “Image to Vector Code” Is a Hard Multimodal Test
Model release cycles have accelerated over the past year or two, and limited gray releases of intermediate builds have become common practice. In these internal tests, the tasks that attract the most discussion are rarely pure text reasoning. Instead, they involve prompts like “here is a diagram, now output compilable vector drawing code.” The reason is straightforward: this task compresses perception, reasoning, and code generation into a single call, so any weak link is exposed in the final result.
Looking at the task chain, the model must complete at least four steps: identify the shapes and text in the image; infer the 3D structure and occlusion behind a 2D projection; reconstruct layers and drawing order; and finally map the result into drawing instructions such as coordinates, paths, solid and dashed lines, and fill regions. Compared with a single-point task like “classify the object,” this places far higher demands on both spatial consistency and symbolic representation.
It is worth stressing that evaluating this capability should not rely on the impression left by a single case. A good result on one sample may simply mean the training distribution happens to cover it. Only a structured, reproducible test set yields conclusions with engineering value.
2. Capability Breakdown: Four Layers from Pixels to Drawing Instructions
2.1 Visual Parsing: Shapes, Text, and Style Recognition
The first layer decomposes a bitmap into semantic units, including line segments, arrows, rectangles, rounded boxes, text labels, and attributes such as line width, dashed style, and fill color. Typical failure modes at this layer include missing small-font annotations, merging adjacent shapes into a single unit, or misclassifying similar grayscale values as different layers.
From an engineering standpoint, it helps to apply basic constraints to the input image: sufficient resolution, no obvious compression noise, and no overlap between text and lines. These constraints are not about “lowering the difficulty”; they make evaluation results attributable.
2.2 Spatial Reasoning: 3D Structure, Occlusion, and Layer Relationships
The second layer is the real dividing line. Diagrams often use isometric or perspective drawing to represent 3D objects, and the model must decide which edges are visible outlines and which are hidden edges that are occluded, then use solid and dashed lines accordingly. Meanwhile, the overlap relationships among multiple layers determine fill regions and drawing order: whether to draw the base plate first or the upper components first directly affects whether the final render is correct.
A practical way to judge capability is to check whether the model explicitly expresses “hierarchy” and “order” in its output, rather than flattening every shape into the same layer. Output that lacks layer awareness often “looks right” visually but breaks the moment you change anything structurally.
2.3 Symbolic Mapping: Coordinates, Paths, and Drawing Semantics
The third layer translates semantic units into drawing-language instructions: coordinate system and units, path start and end points with polylines or curves, closure and fill, line style, and arrow endpoints. The key here is not syntactic correctness but semantic equivalence—the same figure can be written with countless coordinate variations, and the model must choose the one that matches the original proportions and positional relationships.
A schematic output structure can be abstracted as:
canvas: coordinate system and canvas sizelayers: [background layer, structure layer, annotation layer]elements:- type: path | rect | circle | textgeometry: coordinate sequence / parametersstyle: line width, solid/dashed, fillz_order: drawing index within the layer
A clear concept of canvas, layers, and z_order is an important signal for judging whether the output is maintainable.
2.4 Compilability and Reproducibility: Results Must Work in Practice
The fourth layer is often overlooked: the generated code must compile on the first try and stay consistent across different rendering environments. Common problems include out-of-bounds coordinates, unclosed paths that cause fill anomalies, and missing fonts that misalign annotations. The evaluation process should therefore fix the rendering environment and treat “compilation success rate” and “rendering consistency” as hard metrics.
3. Evaluation Method: Avoiding Misleading Single Showcase Samples
It is advisable to build a layered test set covering four sample types: simple flat block diagrams, 3D structures with occlusion, exploded views with multiple stacked layers, and engineering diagrams with dense annotations. For each sample type, record three metrics: structural fidelity (deviation in shape count and position), style fidelity (line style and fill), and compilation rate.
Scoring can combine “automated metrics + manual spot checks.” Automated metrics focus on shape recall and coordinate error; manual spot checks focus on whether the output matches the original intent, especially occlusion and order, which are hard to quantify automatically. Sampling the same input multiple times and observing output stability is also an effective way to identify whether a model truly understands structure rather than “guessing a common template.”
4. Engineering Implementation Recommendations
- Input preprocessing: unify resolution and margins to avoid cropping that loses annotations.
- Prompt constraints: explicitly require the canvas, layers, and drawing order to reduce the model’s free-form latitude.
- Result validation: run syntax and boundary checks first, then render comparison, then manual review.
- Failure attribution: classify errors as recognition errors, spatial reasoning errors, mapping errors, or rendering errors, and optimize prompts or the pipeline accordingly.
- Capability orchestration: for highly complex images, use a two-stage flow of “structured description first, code generation second” to reduce single-call reasoning pressure; when necessary, combine container platforms and logging services for batch evaluation and result tracking.
On the infrastructure side, a common practice is to store test images and artifacts in object storage, schedule batch jobs with a message queue, and track failure-rate changes with monitoring and alerting. This kind of general-purpose category capability can significantly shorten the evaluation iteration cycle and make it easier to accumulate reusable regression baselines.
5. Capability Boundaries and Realistic Expectations
An objective view is needed: samples from intermediate-build internal tests are usually curated, so the demonstrated results skew optimistic. Real-world hand-drawn sketches, low-quality screenshots, and densely annotated drawings will still expose weaknesses in spatial reasoning and long-range consistency. A reasonable expectation is to treat it as a “high-leverage first-draft generator,” with humans handling validation and fine-tuning, rather than expecting end-to-end unattended operation.
For developers, what truly matters is not the impression from a single internal test but three verifiable questions: is the structure self-consistent, is the style controllable, and is the artifact reproducible? Building these three points into evaluation and process design is what keeps engineering judgment stable amid rapid model iteration.
