EvoCAD: Evolutionary CAD Code Generation with Vision Language Models

Tobias Preintner, Weixuan Yuan, Adrian König, Thomas Bäck, Elena Raponi, Niki van SteinarXiv 2025

TL;DR

EvoCAD introduces a novel framework that marries Large Language Models (LLMs) and Vision Language Models (VLMs) with evolutionary computation to generate functional computer-aided design (CAD) code from text prompts. By replacing rigid self-refinement loops with an evolutionary exploration strategy and introducing topology-based evaluation metrics, EvoCAD achieves state-of-the-art performance in generating geometrically and structurally accurate 3D objects.

What Problem Does This Paper Address?

Generating 3D physical objects directly from textual descriptions is a major goal for AI in manufacturing and engineering. While generating raw 3D representations like point clouds or meshes is common, generating CAD code (such as CADQuery scripts) is highly preferred because it produces lightweight, fully parametric, and easily editable models.

Existing state-of-the-art methods rely on a single LLM paired with a VLM in a "self-refinement" loop: the LLM generates code, the VLM looks at the rendered 3D object, provides feedback, and the LLM tries to fix it. However, these methods suffer from two major flaws:

  1. Early Plateauing: Single-model refinement loops lack exploratory power and typically stop improving after just two iterations.
  2. Blind Spots in Evaluation: Standard 3D evaluation metrics (like Chamfer Distance or Intersection over Union) only measure spatial overlap. They completely miss structural or "semantic" correctness—for instance, failing to notice if a mechanical part is missing a critical bolt hole if the rest of the shape aligns well spatially.

Methods

EvoCAD addresses these limitations by treating CAD code generation as an evolutionary optimization problem.

Fig. 1: Visual illustration of our evolutionary CAD code generation method. Beginning with a textual user prompt describing the desired object, our approach initializes a population of CAD codes using a large language model, followed by evolutionary optimization with vision and reasoning language models.

The workflow operates in a classic evolutionary loop:

  • Initialization: An LLM generates an initial population ($M=6$) of diverse CADQuery scripts based on the text prompt, utilizing few-shot examples and a non-zero temperature setting. A basic self-debugging step fixes immediate compilation errors.
  • Two-Step Evaluation (Fitness Function): Instead of relying on flawed mathematical distance metrics, EvoCAD splits the evaluation between two specialized models:
  • A VLM (e.g., GPT-4o) inspects multi-view renders of the 3D object and generates a detailed textual description using chain-of-thought prompting.
  • A Reasoning Language Model (RLM) (specifically OpenAI's o3-mini) reviews these descriptions, compares them to the original user prompt, and ranks the population from best to worst text-to-3D alignment.
  • Crossover and Mutation: Parents are selected using an exponential probability distribution based on their ranks. The LLM acts as the crossover operator, analyzing the code of two parent scripts to combine their strengths into a superior offspring. A mutation step allows the LLM to freely refine individual scripts to discover novel design variations.
  • Elitism: The highest-ranked individual from each generation is preserved unchanged to ensure performance never degrades.

Novel Topological Metrics

To properly evaluate structural correctness, the authors introduced two metrics based on the Euler characteristic ($\chi = V - E + F$), a topological property that intuitively counts the number of "holes" in a watertight mesh:

  • Topology Error ($T_{err}$): The absolute difference between the Euler characteristic of the generated object and the ground truth.
  • Topology Correctness ($T_{corr}$): The percentage of generated objects that perfectly match the ground truth's topological structure.

Datasets

The authors evaluated EvoCAD on the CADPrompt benchmark dataset, which consists of 200 diverse text prompts describing geometric and mechanical CAD objects.

Key Insights and Ideas

  • Exploration Beats Pure Refinement: By maintaining a population and utilizing crossover mechanics, EvoCAD avoids getting trapped in local minima, allowing it to continuously improve across generations where standard self-refinement methods plateau.
  • Model Specialization Matters: Dividing the evaluation phase leverages the distinct strengths of modern AI architectures—VLMs excel at visual perception, while RLMs excel at complex, logical decision-making and ranking.
  • The Spatial Metric Paradox: The authors observed a slight negative correlation between spatial metrics and topological metrics. Traditional spatial metrics often favor an object that completely misses a required hole over one that includes the hole but places it slightly out of position. This underscores why topology-based metrics are essential for engineering applications.

Key Results

EvoCAD was tested using both GPT-4V and GPT-4o as the core generative engines, running for $N=4$ generations.

Fig. 2: Left: Tcorr defined as the ratio of samples where the Euler characteristic of the generated object matches that of the ground truth. Right: Terr as average difference between the Euler characteristics of the generated object and the ground truth.
  • Superior Topology: EvoCAD-4o achieved a Topology Correctness ($T_{corr}$) of 87.2%, significantly outperforming the leading baseline, CADCodeVerify (80.5%), and 3D-Premise (79.9%).
  • Reduced Structural Errors: The average Topology Error ($T_{err}$) dropped sharply to 0.410, compared to CADCodeVerify's 0.629.
  • Geometric Accuracy: Beyond topology, EvoCAD achieved the lowest Point Cloud Distance (PCD) and Hausdorff Distance (HDD), alongside the highest Dice Similarity Coefficient (DSC) among all compared methods.

Limitations and Future Work

The primary bottleneck of EvoCAD is its computational and financial cost. Because the evolutionary loop requires rendering objects and making multiple calls to frontier LLM/VLM APIs per individual per generation, the authors restricted their experiments to a small population size ($M=6$) and few generations ($N=4$). This constraint risks early convergence and limits deeper exploration.

However, the authors note that as high-performance reasoning models (like DeepSeek-R1) become faster and significantly cheaper, scaling up the population size and running longer evolutionary runs will become highly practical. Future work will focus on scaling this method to increasingly complex, multi-part industrial CAD assemblies.

Summary updated

BibTeX
@misc{preintner2025evocad,
  author = {Tobias Preintner and Weixuan Yuan and Adrian König and Thomas Bäck and Elena Raponi and Niki van Stein},
  title = {{EvoCAD: Evolutionary CAD Code Generation with Vision Language Models}},
  year = {2025},
  eprint = {2510.11631},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2510.11631},
}
Figure