Multimodal LLM Vector Graphics Reconstruction: A Practical Analysis

    This article breaks down how multimodal large language models reconstruct vector graphics from raster images, treating the task as cross-modal semantic reconstruction rather than simple visual imitation. It divides the capability into four sub-tasks, outlines a three-stage prompt and workflow design with verifiable intermediate outputs, proposes a three-layer evaluation method, lists common failure modes with practical mitigations, and closes with deployment advice and current capability boundaries. Readers will learn how to structure prompts, enforce constraints, and build a generate-validate-human-review loop for more reliable delivery.

    1. The Core Problem: Semantic Reconstruction from Pixels to Vector Code

    Discussion around multimodal large language models “generating vector graphics from an image” has been heating up in the industry, and hands-on impressions of some intermediate internal builds are frequently mentioned. Setting specific products aside, this type of task is, from an engineering perspective, a classic case of cross-modal semantic reconstruction: the model must first infer 3D structure, occlusion relationships, and layer membership from a 2D raster image, then map those inferences onto a strict vector description language, including coordinates, paths, line styles (solid/dashed), fill regions, and drawing order.

    The difficulty is not “drawing something that looks similar,” but rather that the chain of constraint propagation is extremely long. Raster images lose explicit information about depth and object boundaries, so the model has to fill in the gaps from context; meanwhile, vector code is highly sensitive to syntax, coordinate systems, path closure, and layer order, and any single inference error gets amplified into a visible defect at render time. Therefore, when evaluating this capability, you cannot look only at the similarity of the final screenshot; you also need to check whether the code compiles, whether the structure is sound, and whether the semantics are traceable.

    2. Capability Breakdown: Four Sub-Tasks That Must Be Verified Separately

    Breaking the overall task apart helps pinpoint failure causes instead of vaguely judging whether “the results look good.”

    1. 3D structure and occlusion reasoning: Determining which layer is in front and which is covered is the prerequisite for correct reconstruction. A common mistake is completing an occluded edge into a full outline, which produces visible “see-through” artifacts after rendering.
    2. Layer and drawing-order planning: Vector rendering follows the rule that later elements cover earlier ones. If the order is wrong, the output will display incorrectly even when the geometry is completely accurate.
    3. Line style and stroke recognition: Solid, dashed, and dash-dot lines often occupy only a few pixels in the source image and must be inferred from context and legends rather than judged pixel by pixel.
    4. Coordinate and path reconstruction: Pixel coordinates need to be normalized into a unified viewport, and curves need reasonable fitting, avoiding bloated files from too many path nodes or deformation from too few.

    A schematic output structure can look like the following (it only expresses organization, not the syntax of any specific tool):

    1. scene:
    2. viewport: {width: 1024, height: 768}
    3. layers:
    4. - id: background
    5. z_order: 0
    6. shapes: [rect, ...]
    7. - id: mid
    8. z_order: 1
    9. shapes: [path(dashed=false), ...]
    10. annotations:
    11. - type: dashed_line
    12. from: [x1, y1]
    13. to: [x2, y2]

    This way of organizing output—declaring the viewport and layers first, then filling in geometry and styles—can significantly reduce the probability of inconsistencies across long sequences generated by the model.

    3. Prompt and Workflow Design: Containing Uncertainty

    In practice, single-shot generation is often unstable. A more reliable approach is to split the workflow into three stages, each with a verifiable intermediate artifact.

    • Stage 1: Structure understanding. Output only the layer inventory and occlusion relationships, without coordinates. Describe “what is in front and what is blocked” in natural language or a structured list so a human can quickly correct mistakes.
    • Stage 2: Geometry placement. Under a fixed viewport, output normalized coordinates and paths, requiring all closed paths to be explicitly closed and prohibiting dangling endpoints.
    • Stage 3: Styling and ordering. Fill in line styles, fills, and z_order, then run a self-check: are there redundant layers that are fully covered yet still drawn?

    An example of a reusable constraint snippet:

    1. Constraints:
    2. 1. All coordinates must fall within the normalized range [0,1];
    3. 2. Every closed region must be explicitly closed;
    4. 3. z_order must be unique and continuous;
    5. 4. Layers that are fully occluded must not be output;
    6. 5. After output, run a self-check and list uncertain items at the end.

    Item 5 is especially important: having the model proactively expose uncertain regions is more valuable from an engineering standpoint than letting it “confidently draw the wrong thing,” because uncertain items can be routed directly to human review.

    4. Evaluation Method: Three Layers of Metrics to Avoid “Judging by Appearance”

    To determine whether a reconstruction is usable, it is recommended to establish three layers of metrics and converge layer by layer:

    • Syntax layer: Whether the code compiles and renders successfully. If this layer fails, subsequent comparison is meaningless.
    • Structure layer: Whether the number of layers, occlusion relationships, and closure match the source image; this can be compared structurally rather than pixel by pixel.
    • Visual layer: Given correct structure, then compare outline similarity and line-style consistency.

    From an engineering perspective, you can also introduce a “minimum discernible difference” approach: first render thumbnails for coarse filtering, then zoom in on differing regions for closer review. This controls manual cost while localizing problems to specific layers instead of producing a vague overall score.

    5. Common Failure Modes and Mitigations

    • Over-completion of occlusion: Explicitly state in the prompt that “unobserved edges must not be fabricated,” and require uncertainty markers in the output.
    • Order errors: Enforce continuous and unique z_order, and run a coverage-relationship check before rendering.
    • Line-style misjudgment: Make line-style recognition a separate step—classify first, then draw—to avoid coupling it with geometry generation.
    • Path node explosion: Set a fitting tolerance for curves and add nodes only when the tolerance is exceeded.
    • Long-sequence drift: Generate in stages and freeze intermediate artifacts to avoid contradictions caused by overly long single-shot output.

    6. Implementation Advice and Capability Boundaries

    For teams looking to adopt this capability, it is advisable to first build a small, stable internal evaluation set covering four typical scenarios—occlusion, dashed lines, fills, and nested layers—and establish a regression baseline before gradually expanding it. For deployment, you can host the inference service on a general-purpose container platform, store samples and artifacts in object storage, and track generation success rate and compile pass rate through logging and monitoring/alerting services. These all belong to common industry capability categories and do not point to any specific solution.

    It is also important to recognize clearly that current capabilities in this area have improved markedly in “structure understanding” but still make mistakes on highly complex occlusion and fine-grained line styles. Designing the workflow as a closed loop of “generate—validate—human fallback” is more realistic than pursuing one-shot full automation, and it makes stable delivery in real projects easier to achieve.