Table of Contents
Fetching ...

Clarify Before You Draw: Proactive Agents for Robust Text-to-CAD Generation

Bo Yuan, Zelin Zhao, Petr Molodyk, Bin Hu, Yongxin Chen

TL;DR

ProCAD addresses the fragility of text-to-CAD systems by introducing a proactive two-agent pipeline that first clarifies ambiguous prompts and then generates CadQuery code from a self-consistent specification. The clarifying agent audits prompts and interacts with users to resolve missing or conflicting dimensions, while the coding agent translates the resolved description into executable CadQuery programs. The authors build a high-quality 10k Text-to-CadQuery dataset with leakage and completeness checks and train both agents via supervised fine-tuning and agentic SFT. Experimental results show substantial improvements in geometric fidelity (lower Chamfer distance) and lower invalidity, outperforming frontier models and showing robust generalization to out-of-distribution simulators. The work highlights the importance of high-quality NL-to-CadQuery data and presents a scalable framework for proactive, interactive program synthesis in CAD contexts.

Abstract

Large language models have recently enabled text-to-CAD systems that synthesize parametric CAD programs (e.g., CadQuery) from natural language prompts. In practice, however, geometric descriptions can be under-specified or internally inconsistent: critical dimensions may be missing and constraints may conflict. Existing fine-tuned models tend to reactively follow user instructions and hallucinate dimensions when the text is ambiguous. To address this, we propose a proactive agentic framework for text-to-CadQuery generation, named ProCAD, that resolves specification issues before code synthesis. Our framework pairs a proactive clarifying agent, which audits the prompt and asks targeted clarification questions only when necessary to produce a self-consistent specification, with a CAD coding agent that translates the specification into an executable CadQuery program. We fine-tune the coding agent on a curated high-quality text-to-CadQuery dataset and train the clarifying agent via agentic SFT on clarification trajectories. Experiments show that proactive clarification significantly improves robustness to ambiguous prompts while keeping interaction overhead low. ProCAD outperforms frontier closed-source models, including Claude Sonnet 4.5, reducing the mean Chamfer distance by 79.9 percent and lowering the invalidity ratio from 4.8 percent to 0.9 percent. Our code and datasets will be made publicly available.

Clarify Before You Draw: Proactive Agents for Robust Text-to-CAD Generation

TL;DR

ProCAD addresses the fragility of text-to-CAD systems by introducing a proactive two-agent pipeline that first clarifies ambiguous prompts and then generates CadQuery code from a self-consistent specification. The clarifying agent audits prompts and interacts with users to resolve missing or conflicting dimensions, while the coding agent translates the resolved description into executable CadQuery programs. The authors build a high-quality 10k Text-to-CadQuery dataset with leakage and completeness checks and train both agents via supervised fine-tuning and agentic SFT. Experimental results show substantial improvements in geometric fidelity (lower Chamfer distance) and lower invalidity, outperforming frontier models and showing robust generalization to out-of-distribution simulators. The work highlights the importance of high-quality NL-to-CadQuery data and presents a scalable framework for proactive, interactive program synthesis in CAD contexts.

Abstract

Large language models have recently enabled text-to-CAD systems that synthesize parametric CAD programs (e.g., CadQuery) from natural language prompts. In practice, however, geometric descriptions can be under-specified or internally inconsistent: critical dimensions may be missing and constraints may conflict. Existing fine-tuned models tend to reactively follow user instructions and hallucinate dimensions when the text is ambiguous. To address this, we propose a proactive agentic framework for text-to-CadQuery generation, named ProCAD, that resolves specification issues before code synthesis. Our framework pairs a proactive clarifying agent, which audits the prompt and asks targeted clarification questions only when necessary to produce a self-consistent specification, with a CAD coding agent that translates the specification into an executable CadQuery program. We fine-tune the coding agent on a curated high-quality text-to-CadQuery dataset and train the clarifying agent via agentic SFT on clarification trajectories. Experiments show that proactive clarification significantly improves robustness to ambiguous prompts while keeping interaction overhead low. ProCAD outperforms frontier closed-source models, including Claude Sonnet 4.5, reducing the mean Chamfer distance by 79.9 percent and lowering the invalidity ratio from 4.8 percent to 0.9 percent. Our code and datasets will be made publicly available.
Paper Structure (44 sections, 4 equations, 4 figures, 9 tables)

This paper contains 44 sections, 4 equations, 4 figures, 9 tables.

Figures (4)

  • Figure 1: Diagram of our two-agent text-to-CadQuery pipeline. A proactive clarifying agent audits the user prompt, asks targeted clarification questions when needed, and outputs a standardized specification, which a coding agent then outputs a CadQuery program. We also provide one example where the ambiguous prompt does not include the radius of the inner icicle.
  • Figure 2: Semi-automatic annotation pipeline: render each shape and use its CadQuery to prompt a frontier VLM for a text description; accept only if it passes (i) code-leakage filtering and (ii) completeness verification by regenerating CadQuery with Chamfer distance below a threshold; otherwise retry up to a limit. If the maximum number of retries is reached, we defer the case to CAD experts for manual review.
  • Figure 3: One failure example in Text2CAD for text-to-CadQuery generation.
  • Figure 4: Qualitative comparison with the coding agent fixed as ProCAD-coder. We compare different clarification agents: GPT-4o-mini, Claude Sonnet 4.5, and ProCAD-clarifier. For each example, we visualize the ground-truth shape and the CAD model generated from the clarified specification. Off-the-shelf clarifiers frequently miss or mis-handle key constraints, leading to non-executable programs or noticeable geometric deviations, whereas ProCAD-clarifier asks targeted questions, produces a corrected specification, and enables faithful reconstruction.