Evaluating Multimodal Models for Image-to-Vector Code Generation

    This article presents a practical framework for evaluating multimodal models that convert 2D images into executable, editable vector drawing code. It covers task challenges, a four-layer evaluation methodology, output contracts, scoring dimensions, regression testing, sandbox rendering, and the role of intermediate model releases in establishing reliable engineering quality baselines.

    1. Background: Why Intermediate Model Releases Matter

    As multimodal models increasingly combine visual understanding with code generation, model iteration cycles are becoming much faster. Intermediate releases and internal previews have therefore become valuable windows for observing capability improvements.

    Compared with official releases, intermediate versions often reveal more specific, task-level changes in areas such as image understanding, structured output, drawing instruction generation, and complex-scene reconstruction. For developers and enterprise teams, monitoring these releases is not about chasing version numbers. The more important question is whether a capability has become reliable enough for engineering use:

    Can the model consistently convert spatial relationships, occlusion relationships, and layer order in a 2D image into vector drawing code that is editable, verifiable, and renderable?

    Image-to-vector code generation is a composite task with significant technical difficulty. The input is a 2D image, but the model must infer three-dimensional structure, visible contours, hidden objects, front-to-back relationships, and drawing order. The output must keep coordinates, paths, solid and dashed lines, filled regions, and rendering order consistent with one another.

    A single incorrect relationship can cause the final graphic to shift, reverse its occlusion order, or lose its intended style. As a result, evaluation cannot focus only on whether the output “looks similar.” It must also consider structural correctness, explainability of relationships, code executability, and reproducibility.

    2. Task Challenges: Mapping 2D Images to Vector Drawing Instructions

    2.1 Abstracting 3D Structure into Geometric Relationships

    The first challenge is converting three-dimensional structure implied by a 2D image into explicit geometric relationships. The model must do more than identify that “an object exists.” It must determine the object’s spatial position, boundary connections, and visible portions.

    For complex diagrams, semantic understanding must be transformed into coordinate points and path sequences. This places substantial demands on the model’s spatial reasoning capabilities.

    2.2 Handling Occlusion and Layer Relationships

    Occlusion and layer order are central challenges. When one object is partially covered by another, the output should preserve the visible contour while also recording the occlusion relationship, front-to-back hierarchy, and drawing order in structured metadata.

    Without this information, the individual paths may appear correct, but the rendered result can still show reversed layers or incorrect object visibility.

    2.3 Maintaining Consistent Style Mapping

    Style mapping must also remain consistent. Solid lines, dashed lines, filled regions, stroke colors, and closed paths should correspond to the semantics of the source image.

    The model may generate an approximate result, but style fields must remain readable, editable, and easy to review.

    2.4 Producing Executable Output

    Vector drawing code is not a natural-language description. Out-of-range coordinates, unclosed paths, missing layer fields, or conflicting drawing orders can all cause rendering failures.

    For this reason, evaluation should treat parseability, renderability, and editability as basic requirements.

    3. A Layered Evaluation Framework: From Perception to Engineering Usability

    A practical evaluation framework can be divided into four layers:

    1. Visual perception: Whether the model identifies the main objects, boundaries, and styles.
    2. Spatial relationships: Whether it correctly represents occlusion, layers, and drawing order.
    3. Code generation: Whether paths, coordinates, closure status, style fields, and overall structure are valid.
    4. Engineering usability: Whether the output can be executed reliably by a sandbox renderer and pass rule-based validation and human review.

    To make evaluation reproducible, teams should build a layered test set:

    • Simple geometric cases to verify basic coordinate and path generation.
    • Occlusion cases to test front-to-back relationships.
    • Multi-object layer cases to validate rendering order.
    • Complex diagrams to evaluate structural abstraction and error recovery.
    • Error-injection cases with missing contours, style conflicts, or local blur, to observe whether the model can provide reasonable explanations and conservative outputs.

    A general output contract could look like this:

    1. {
    2. "canvas": {"width": 1.0, "height": 1.0, "units": "normalized"},
    3. "objects": [
    4. {
    5. "id": "obj_a",
    6. "shape": "polygon",
    7. "path": [[0.1, 0.2], [0.4, 0.2], [0.4, 0.5]],
    8. "closed": true,
    9. "z_index": 1,
    10. "occluded_by": ["obj_b"],
    11. "style": {"stroke": "solid", "fill": "light", "dash": false}
    12. }
    13. ],
    14. "render_order": ["obj_a", "obj_b"]
    15. }

    This contract is not a proprietary interface for a specific product. It represents a general engineering constraint. Normalized coordinates, unique object identifiers, layer fields, occlusion declarations, style fields, and rendering order should all be expressed explicitly.

    Doing so reduces integration costs between model output and the rendering pipeline.

    4. Scoring Dimensions: Balancing Structure, Relationships, Style, and Stability

    Evaluation should not rely solely on final image similarity. A multi-dimensional scoring system is more appropriate.

    • Geometric structure: Whether paths align with the source, paths close correctly, and coordinates remain within valid bounds.
    • Occlusion relationships: Whether hidden objects are correctly identified and front-to-back relationships are consistent.
    • Drawing order: Whether rendering order matches the intended semantics.
    • Style: Whether solid and dashed lines, fills, and strokes are mapped correctly.
    • Editability: Whether the output preserves object-level structure instead of producing one large, difficult-to-maintain path.
    • Stability: How much the output varies when the same image is processed repeatedly.

    The scoring logic can be represented with the following pseudocode:

    1. score = weighted_sum(
    2. geometry_match,
    3. occlusion_match,
    4. layer_order_match,
    5. style_match,
    6. executability,
    7. human_review_score
    8. )

    Executability should be treated as a hard gate. An output that cannot be parsed or rendered should not receive a high score merely because it has visual similarities to the source.

    Human review is useful for semantic ambiguity. For example, when partial occlusion makes an object boundary impossible to determine uniquely, the model may be allowed to make a reasonable inference. However, it should also indicate uncertainty where appropriate.

    5. Engineering Recommendations: Turning Internal Testing into a Quality Baseline

    5.1 Build a Versioned Regression Set

    Every intermediate model release should be evaluated against the same set of benchmark cases. Teams should record structural errors, occlusion errors, and rendering failures to create a traceable quality trend over time.

    5.2 Combine Rule Validation, Sandbox Rendering, and Human Review

    A robust workflow should combine three processes:

    • Rule validation for coordinates, required fields, and path closure.
    • Sandbox rendering for verifying actual execution results.
    • Human sampling and review for assessing semantic plausibility.

    5.3 Add an Iterative Correction Loop

    Models can be asked to generate corrected drawing instructions based on validation errors. However, every corrected result should still be tested against the same regression set.

    5.4 Address Security and Compliance

    Sensitive images should not be used as evaluation inputs without appropriate safeguards. Generated code should run in an isolated environment, and audit records should be retained.

    Conclusion

    Intermediate model releases often show a stronger willingness to reconstruct image structure in image-to-vector code tasks. In particular, they may become more consistent in handling occlusion relationships and drawing order than earlier experimental versions.

    However, issues such as local coordinate shifts, missing style fields, and layer confusion in complex scenes may still occur.

    Teams should therefore treat intermediate evaluations as opportunities to establish quality baselines, not as direct replacements for human review. Only by combining evaluation cases, output contracts, rendering validation, and regression testing can organizations keep the engineering workflow controlled and reproducible while models continue to evolve rapidly.